From: qinyu qinyu16@huawei.com
euleros inclusion category: bugfix bugzilla: 46887
--------------------------------
this patch fixes following warnings:
1. tools/perf/perf-completion.sh:268:10: error: Can only return 0-255. Other data should be written to stdout. [SC2152] 2. tools/testing/selftests/ntb/ntb_test.sh:558:11: error: Argument to implicit -n is always true due to literal strings. [SC2157] 3. tools/testing/selftests/cpufreq/cpufreq.sh:225:10: error: -n doesn't work with unquoted arguments. Quote or use [[ ]]. [SC2070] 4. tools/testing/selftests/efivarfs/efivarfs.sh:80:16: error: You need a space before the ]. [SC1020] 5. tools/testing/selftests/bpf/test_lirc_mode2.sh:27:9: error: -n doesn't work with unquoted arguments. Quote or use [[ ]]. [SC2070]
Signed-off-by: luochunsheng luochunsheng@huawei.com Signed-off-by: qinyu qinyu16@huawei.com Reviewed-by: Zou Wei zou_wei@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- tools/perf/perf-completion.sh | 2 +- tools/testing/selftests/bpf/test_lirc_mode2.sh | 2 +- tools/testing/selftests/cpufreq/cpufreq.sh | 2 +- tools/testing/selftests/efivarfs/efivarfs.sh | 2 +- tools/testing/selftests/ntb/ntb_test.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh index fdf75d45efff..b1673abe5efe 100644 --- a/tools/perf/perf-completion.sh +++ b/tools/perf/perf-completion.sh @@ -265,7 +265,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then let cword=CURRENT-1 emulate ksh -c __perf_main let _ret && _default && _ret=0 - return _ret + return $_ret }
compdef _perf perf diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh index 677686198df3..52e994987d76 100755 --- a/tools/testing/selftests/bpf/test_lirc_mode2.sh +++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh @@ -24,7 +24,7 @@ do fi done
-if [ -n $LIRCDEV ]; +if [[ -n $LIRCDEV ]]; then TYPE=lirc_mode2 ./test_lirc_mode2_user $LIRCDEV diff --git a/tools/testing/selftests/cpufreq/cpufreq.sh b/tools/testing/selftests/cpufreq/cpufreq.sh index b583a2fb4504..3143d8ecf5e0 100755 --- a/tools/testing/selftests/cpufreq/cpufreq.sh +++ b/tools/testing/selftests/cpufreq/cpufreq.sh @@ -222,7 +222,7 @@ do_suspend() return 1 fi
- if [ -n $filename ]; then + if [[ -n $filename ]]; then present=$(cat $SYSFS/power/state | grep $filename)
if [ -z "$present" ]; then diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh index d3866100e884..359113e4abb8 100755 --- a/tools/testing/selftests/efivarfs/efivarfs.sh +++ b/tools/testing/selftests/efivarfs/efivarfs.sh @@ -77,7 +77,7 @@ test_create_empty() test_create_read() { local file=$efivarfs_mount/$FUNCNAME-$test_guid - if [ -f $file]; then + if [[ -f $file ]]; then chattr -i $file rm -rf $file fi diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh index 17ca36403d04..4cc7a08007bb 100755 --- a/tools/testing/selftests/ntb/ntb_test.sh +++ b/tools/testing/selftests/ntb/ntb_test.sh @@ -555,7 +555,7 @@ function cleanup()
cleanup
-if ! [[ $$DONT_CLEANUP ]]; then +if ! [[ $DONT_CLEANUP ]]; then trap cleanup EXIT fi