diff mbox series

[F/J,SRU,1/1] selftests: net/fcnal-test.sh: add exit code

Message ID 20230209082828.193762-2-po-hsu.lin@canonical.com
State New
Headers show
Series Fix return code for net/fcnal-test.sh test | expand

Commit Message

Po-Hsu Lin Feb. 9, 2023, 8:28 a.m. UTC
From: Li Zhijian <zhijianx.li@intel.com>

BugLink: https://bugs.launchpad.net/bugs/2006692

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>
(cherry picked from commit 0f8a3b48f91b8dc1f3eff06b77a63a17183fccbd)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 tools/testing/selftests/net/fcnal-test.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Stefan Bader Feb. 10, 2023, 9:34 a.m. UTC | #1
On 09.02.23 09:28, Po-Hsu Lin wrote:
> From: Li Zhijian <zhijianx.li@intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2006692
> 
> 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>
> (cherry picked from commit 0f8a3b48f91b8dc1f3eff06b77a63a17183fccbd)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>   tools/testing/selftests/net/fcnal-test.sh | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
> index 364c82b..2b3d5d0 100755
> --- a/tools/testing/selftests/net/fcnal-test.sh
> +++ b/tools/testing/selftests/net/fcnal-test.sh
> @@ -4115,3 +4115,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
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 364c82b..2b3d5d0 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -4115,3 +4115,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