Skip to contentSkip to conversation

selftests: fib_rule_tests: print the result and return 1 if any tests failed

PATCH Applied Hangbin Liu 3 participants 3 messages Apr 30, 2019 – May 1, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: fib_rule_tests: print the result and return 1 if any tests failed

Fixes 65b2b4939a64 ("selftests: net: initial fib rule tests")
---
 tools/testing/selftests/net/fib_rule_tests.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/net/fib_rule_tests.sh +6 -0
index d4cfb6a7a086..d84193bdc307 100755
@@ -27,6 +27,7 @@ log_test()
 		nsuccess=$((nsuccess+1))
 		printf "\n    TEST: %-50s  [ OK ]\n" "${msg}"
 	else
+		ret=1
 		nfail=$((nfail+1))
 		printf "\n    TEST: %-50s  [FAIL]\n" "${msg}"
 		if [ "${PAUSE_ON_FAIL}" = "yes" ]; then
@@ -245,4 +246,9 @@ setup
 run_fibrule_tests
 cleanup
 
+if [ "$TESTS" != "none" ]; then
+	printf "\nTests passed: %3d\n" ${nsuccess}
+	printf "Tests failed: %3d\n"   ${nfail}
+fi
+
 exit $ret
Signature · 1 line
2.19.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Hangbin Liu
Fixes 65b2b4939a64 ("selftests: net: initial fib rule tests")
---
 tools/testing/selftests/net/fib_rule_tests.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/net/fib_rule_tests.sh +1 -0
index d4cfb6a7a086..d84193bdc307 100755
@@ -27,6 +27,7 @@ log_test()
 		nsuccess=$((nsuccess+1))
 		printf "\n    TEST: %-50s  [ OK ]\n" "${msg}"
 	else
+		ret=1
 		nfail=$((nfail+1))
 		printf "\n    TEST: %-50s  [FAIL]\n" "${msg}"
 		if [ "${PAUSE_ON_FAIL}" = "yes" ]; then

tools/testing/selftests/net/fib_rule_tests.sh setup · line 254

Quoted 9 lines
tools/testing/selftests/net/fib_rule_tests.sh +5 -0
@@ -245,4 +246,9 @@ setup
 run_fibrule_tests
 cleanup
 
+if [ "$TESTS" != "none" ]; then
+	printf "\nTests passed: %3d\n" ${nsuccess}
+	printf "Tests failed: %3d\n"   ${nfail}
+fi
+
 exit $ret

Thanks for adding the summary.