selftests: net/fcnal-test.sh: add exit code
authorLi Zhijian <zhijianx.li@intel.com>
Fri, 3 Dec 2021 02:32:13 +0000 (10:32 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Dec 2021 14:17:34 +0000 (14:17 +0000)
Previously, the selftest framework always treats it as *ok* even though
some of them are failed actually. That's because the script always
returns 0.

It supports PASS/FAIL/SKIP exit code now.

CC: Philip Li <philip.li@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Li Zhijian <zhijianx.li@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/fcnal-test.sh

index 7f5b265..a1da013 100755 (executable)
@@ -4077,3 +4077,11 @@ cleanup 2>/dev/null
 
 printf "\nTests passed: %3d\n" ${nsuccess}
 printf "Tests failed: %3d\n"   ${nfail}
+
+if [ $nfail -ne 0 ]; then
+       exit 1 # KSFT_FAIL
+elif [ $nsuccess -eq 0 ]; then
+       exit $ksft_skip
+fi
+
+exit 0 # KSFT_PASS