fix some shellcheck-identified issues in scripts

This commit is contained in:
a1346054 2021-08-18 18:21:06 +00:00
parent f20c688a18
commit ecfcaed0b5
3 changed files with 14 additions and 17 deletions

View File

@ -51,10 +51,10 @@ echo "-: test failed"
# Empty the complete log. # Empty the complete log.
> testsuite.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_root.test
run_test ./su/01/su_user.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
run_test ./su/02/env_FOO-options_--login_bash run_test ./su/02/env_FOO-options_--login_bash
run_test ./su/02/env_FOO-options_--preserve-environment 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/12_su_child_failure/su.test
run_test ./su/13_su_child_success/su.test run_test ./su/13_su_child_success/su.test
run_test ./chage/01/run 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/02/run
run_test ./chage/03_chsh_usage/chage.test run_test ./chage/03_chsh_usage/chage.test
run_test ./chage/04_chsh_usage_invalid_option/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/01_login_prompt/login.test
run_test ./login/02_login_user/login.test run_test ./login/02_login_user/login.test
run_test ./login/03_login_check_tty/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/01_useradd_no_subids/useradd.test
run_test ./subids/02_useradd_with_subids/useradd.test run_test ./subids/02_useradd_with_subids/useradd.test
run_test ./subids/03_useradd_no_subgid/useradd.test run_test ./subids/03_useradd_no_subgid/useradd.test
@ -1301,9 +1301,8 @@ echo
echo "$succeeded test(s) passed" echo "$succeeded test(s) passed"
echo "$failed test(s) failed" echo "$failed test(s) failed"
echo "log written in 'testsuite.log'" echo "log written in 'testsuite.log'"
if [ "$failed" != "0" ] if [ "$failed" != 0 ]
then then
echo "the following tests failed:" echo "the following tests failed:"
echo $failed_tests echo "$failed_tests"
fi fi

View File

@ -16,8 +16,8 @@ failed_tests=""
run_test() run_test()
{ {
find $build_path -name "*.gcda" -delete find "$build_path" -name "*.gcda" -delete
find $build_path -name "*.gcno" | while read f find "$build_path" -name "*.gcno" | while read f
do do
g=${f%gcno}gcda g=${f%gcno}gcda
touch $g touch $g
@ -1320,9 +1320,8 @@ echo
echo "$succeeded test(s) passed" echo "$succeeded test(s) passed"
echo "$failed test(s) failed" echo "$failed test(s) failed"
echo "log written in 'testsuite.log'" echo "log written in 'testsuite.log'"
if [ "$failed" != "0" ] if [ "$failed" != 0 ]
then then
echo "the following tests failed:" echo "the following tests failed:"
echo $failed_tests echo "$failed_tests"
fi fi

View File

@ -51,10 +51,10 @@ echo "-: test failed"
# Empty the complete log. # Empty the complete log.
> testsuite.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_root.test
run_test ./su/01/su_user.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
run_test ./su/02/env_FOO-options_--login_bash run_test ./su/02/env_FOO-options_--login_bash
run_test ./su/02/env_FOO-options_--preserve-environment run_test ./su/02/env_FOO-options_--preserve-environment
@ -133,9 +133,8 @@ echo
echo "$succeeded test(s) passed" echo "$succeeded test(s) passed"
echo "$failed test(s) failed" echo "$failed test(s) failed"
echo "log written in 'testsuite.log'" echo "log written in 'testsuite.log'"
if [ "$failed" != "0" ] if [ "$failed" != 0 ]
then then
echo "the following tests failed:" echo "the following tests failed:"
echo $failed_tests echo "$failed_tests"
fi fi