controllers/cpuset/cpuset_regression_test.sh: fix shellcheck error
PATCH 1/1 controllers/cpuset/cpuset_regression_test.sh: fix shellcheck error
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh:89:10:error:
-n doesn't work with unquoted arguments. Quote or use [[ ]]. [SC2070]
--- testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh +1 -1
@@ -86,7 +86,7 @@ cleanup() rmdir ${root_cpuset_dir}/testdir fi - if [ -n ${cpu_exclusive_value} -a ${cpu_exclusive_value} -ne 1 ]; then + if [ -n "${cpu_exclusive_value}" ] && [ ${cpu_exclusive_value} -ne 1 ]; then # Need to flush, or may be output: # "write error: Device or resource busy" sync
Signature · 1 line
2.14.1
PATCH 1/1 controllers/cpuset/cpuset_regression_test.sh: fix shellcheck error
Hi Yixin,
Quoted 13 lines
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh:89:10:error:
-n doesn't work with unquoted arguments. Quote or use [[ ]]. [SC2070]Signed-off-by Yixin Zhang <[email protected]>--- testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/controllers/cpuset/cpuset_regression_test.sh +0
-0
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh cleanup() · line 92
Quoted 8 lines
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh +1
-1@@ -86,7 +86,7 @@ cleanup() rmdir ${root_cpuset_dir}/testdir fi - if [ -n ${cpu_exclusive_value} -a ${cpu_exclusive_value} -ne 1 ]; then + if [ -n "${cpu_exclusive_value}" ] && [ ${cpu_exclusive_value} -ne 1 ]; then # Need to flush, or may be output: # "write error: Device or resource busy" sync
Thanks for your patch, pushed.
I dared to simplify the expression (see bellow, this is posix compliant as well, we use it in LTP) + shorten commit message title a bit. Hope you don't mind.
if [ "$cpu_exclusive_value" != 1 ]; then
BTW this tests also needs to be rewritten to new shell API.
Kind regards,
Petr