[PATCH nft 02/11] tests/shell: cleanup print_test_result() and show TAINTED error code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <thaller@xxxxxxxxxx>
---
 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 423c5465c4d4..e0adb27ad104 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
 
-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux