diff options
author | Thomas Haller <thaller@redhat.com> | 2023-09-18 21:59:23 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-09-18 22:09:13 +0200 |
commit | 6d19a902c1d77cb51b940b1ce65f31b1cad38b74 (patch) | |
tree | e1247d959b7030d5463f50df64b6dad92634c16a /tests | |
parent | f741af746b8ee20c43d9cc4ff712b6883cf0f57a (diff) |
tests/shell: simplify collecting error result in "test-wrapper.sh"
The previous pattern was unnecessarily confusing.
The "$rc_{dump,valgrind,tainted}" variable should only remember whether
that particular check failed, not the overall exit code of the test
wrapper.
Otherwise, if you want to know in which case the wrapper exits with code
122, you have to oddly follow the rc_valgrind variable.
This change will make more sense, when we add another such variable, but
which will be assigned the non-zero value at multiple places. Assigning
there the exit code of the wrapper, duplicates the places where the
condition maps to the exit code.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/helpers/test-wrapper.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/shell/helpers/test-wrapper.sh b/tests/shell/helpers/test-wrapper.sh index ad6a7103..165a944d 100755 --- a/tests/shell/helpers/test-wrapper.sh +++ b/tests/shell/helpers/test-wrapper.sh @@ -124,7 +124,7 @@ rc_dump=0 if [ "$rc_test" -ne 77 -a -f "$DUMPFILE" ] ; then if [ "$dump_written" != y ] ; then if ! $DIFF -u "$DUMPFILE" "$NFT_TEST_TESTTMPDIR/ruleset-after" &> "$NFT_TEST_TESTTMPDIR/ruleset-diff" ; then - rc_dump=124 + rc_dump=1 else rm -f "$NFT_TEST_TESTTMPDIR/ruleset-diff" fi @@ -135,27 +135,27 @@ if [ "$rc_dump" -ne 0 ] ; then fi rc_valgrind=0 -[ -f "$NFT_TEST_TESTTMPDIR/rc-failed-valgrind" ] && rc_valgrind=122 +[ -f "$NFT_TEST_TESTTMPDIR/rc-failed-valgrind" ] && rc_valgrind=1 rc_tainted=0 if [ "$tainted_before" != "$tainted_after" ] ; then echo "$tainted_after" > "$NFT_TEST_TESTTMPDIR/rc-failed-tainted" - rc_tainted=123 + rc_tainted=1 fi if [ "$rc_valgrind" -ne 0 ] ; then - rc_exit="$rc_valgrind" + rc_exit=122 elif [ "$rc_tainted" -ne 0 ] ; then - rc_exit="$rc_tainted" + rc_exit=123 elif [ "$rc_test" -ge 118 -a "$rc_test" -le 124 ] ; then # Special exit codes are reserved. Coerce them. - rc_exit="125" + rc_exit=125 elif [ "$rc_test" -ne 0 ] ; then rc_exit="$rc_test" elif [ "$rc_dump" -ne 0 ] ; then - rc_exit="$rc_dump" + rc_exit=124 else - rc_exit="0" + rc_exit=0 fi |