From 264614afb9dcbe0c8f841e174962e57931ec6b46 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 8 Sep 2023 00:07:14 +0200 Subject: tests/shell: cleanup print_test_result() and show TAINTED error code We will add more special error codes (122 for VALGRIND). Minor refactor of print_test_result() to make it easier to extend for that. Also, we will soon colorize the output. This preparation patch makes that easier too. Signed-off-by: Thomas Haller Signed-off-by: Florian Westphal --- tests/shell/run-tests.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh index 423c5465..e0adb27a 100755 --- a/tests/shell/run-tests.sh +++ b/tests/shell/run-tests.sh @@ -471,25 +471,27 @@ print_test_result() { shift 3 local result_msg_level="I" - local result_msg_status="OK" local result_msg_suffix="" local result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" "$NFT_TEST_TESTTMPDIR/ruleset-diff" ) + local result_msg_status if [ "$rc_got" -eq 0 ] ; then ((ok++)) - elif [ "$rc_got" -eq 124 ] ; then - ((failed++)) - result_msg_level="W" - result_msg_status="DUMP FAIL" + result_msg_status="OK" elif [ "$rc_got" -eq 77 ] ; then ((skipped++)) - result_msg_level="I" result_msg_status="SKIPPED" else ((failed++)) result_msg_level="W" - result_msg_status="FAILED" - result_msg_suffix="got $rc_got" + if [ "$rc_got" -eq 123 ] ; then + result_msg_status="TAINTED" + elif [ "$rc_got" -eq 124 ] ; then + result_msg_status="DUMP FAIL" + else + result_msg_status="FAILED" + result_msg_suffix="got $rc_got" + fi result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" ) fi -- cgit v1.2.3