From ecfcaed0b5cb6680685cdb976375601eb4ca59ae Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Wed, 18 Aug 2021 18:21:06 +0000 Subject: [PATCH] fix some shellcheck-identified issues in scripts --- tests/run_all | 13 ++++++------- tests/run_all.coverage | 9 ++++----- tests/run_some | 9 ++++----- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/run_all b/tests/run_all index 2b511407..09a3c3cc 100755 --- a/tests/run_all +++ b/tests/run_all @@ -51,10 +51,10 @@ echo "-: test failed" # Empty the complete log. > testsuite.log -find ${build_path} -name "*.gcda" -delete +find "${build_path}" -name "*.gcda" -delete run_test ./su/01/su_root.test run_test ./su/01/su_user.test -find ${build_path} -name "*.gcda" -exec chmod a+rw {} \; +find "${build_path}" -name "*.gcda" -exec chmod a+rw {} \; run_test ./su/02/env_FOO-options_--login run_test ./su/02/env_FOO-options_--login_bash run_test ./su/02/env_FOO-options_--preserve-environment @@ -121,7 +121,7 @@ run_test ./su/11_su_sulog_failure/su.test run_test ./su/12_su_child_failure/su.test run_test ./su/13_su_child_success/su.test run_test ./chage/01/run -find ${build_path} -name "*.gcda" -exec chmod a+rw {} \; +find "${build_path}" -name "*.gcda" -exec chmod a+rw {} \; run_test ./chage/02/run run_test ./chage/03_chsh_usage/chage.test run_test ./chage/04_chsh_usage_invalid_option/chage.test @@ -1221,7 +1221,7 @@ run_test ./passwd/22_passwd_usage/passwd.test run_test ./login/01_login_prompt/login.test run_test ./login/02_login_user/login.test run_test ./login/03_login_check_tty/login.test -find ${build_path} -name "*.gcda" -exec chmod a+rw {} \; +find "${build_path}" -name "*.gcda" -exec chmod a+rw {} \; run_test ./subids/01_useradd_no_subids/useradd.test run_test ./subids/02_useradd_with_subids/useradd.test run_test ./subids/03_useradd_no_subgid/useradd.test @@ -1301,9 +1301,8 @@ echo echo "$succeeded test(s) passed" echo "$failed test(s) failed" echo "log written in 'testsuite.log'" -if [ "$failed" != "0" ] +if [ "$failed" != 0 ] then echo "the following tests failed:" - echo $failed_tests + echo "$failed_tests" fi - diff --git a/tests/run_all.coverage b/tests/run_all.coverage index 92d0c4a3..0eed77dd 100755 --- a/tests/run_all.coverage +++ b/tests/run_all.coverage @@ -16,8 +16,8 @@ failed_tests="" run_test() { - find $build_path -name "*.gcda" -delete - find $build_path -name "*.gcno" | while read f + find "$build_path" -name "*.gcda" -delete + find "$build_path" -name "*.gcno" | while read f do g=${f%gcno}gcda touch $g @@ -1320,9 +1320,8 @@ echo echo "$succeeded test(s) passed" echo "$failed test(s) failed" echo "log written in 'testsuite.log'" -if [ "$failed" != "0" ] +if [ "$failed" != 0 ] then echo "the following tests failed:" - echo $failed_tests + echo "$failed_tests" fi - diff --git a/tests/run_some b/tests/run_some index e6f6eb5a..2f8e5846 100755 --- a/tests/run_some +++ b/tests/run_some @@ -51,10 +51,10 @@ echo "-: test failed" # Empty the complete log. > testsuite.log -find ${build_path} -name "*.gcda" -delete +find "${build_path}" -name "*.gcda" -delete run_test ./su/01/su_root.test run_test ./su/01/su_user.test -find ${build_path} -name "*.gcda" -exec chmod a+rw {} \; +find "${build_path}" -name "*.gcda" -exec chmod a+rw {} \; run_test ./su/02/env_FOO-options_--login run_test ./su/02/env_FOO-options_--login_bash run_test ./su/02/env_FOO-options_--preserve-environment @@ -133,9 +133,8 @@ echo echo "$succeeded test(s) passed" echo "$failed test(s) failed" echo "log written in 'testsuite.log'" -if [ "$failed" != "0" ] +if [ "$failed" != 0 ] then echo "the following tests failed:" - echo $failed_tests + echo "$failed_tests" fi -