* [PATCH bpf] selftests/bpf: exit with error code if test failed
@ 2022-03-17 7:18 Hangbin Liu
2022-03-18 15:05 ` Daniel Borkmann
2022-03-21 2:41 ` [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code Hangbin Liu
0 siblings, 2 replies; 4+ messages in thread
From: Hangbin Liu @ 2022-03-17 7:18 UTC (permalink / raw)
To: netdev; +Cc: Sean Young, Alexei Starovoitov, Daniel Borkmann, Hangbin Liu
The test_lirc_mode2.sh test exit with 0 even test failed. Fix it by
exiting with an error code.
Fixes: 6bdd533cee9a ("bpf: add selftest for lirc_mode2 type program")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
tools/testing/selftests/bpf/test_lirc_mode2.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh
index ec4e15948e40..420dc86362f5 100755
--- a/tools/testing/selftests/bpf/test_lirc_mode2.sh
+++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh
@@ -36,3 +36,5 @@ then
echo -e ${GREEN}"PASS: $TYPE"${NC}
fi
fi
+
+exit $ret
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf] selftests/bpf: exit with error code if test failed
2022-03-17 7:18 [PATCH bpf] selftests/bpf: exit with error code if test failed Hangbin Liu
@ 2022-03-18 15:05 ` Daniel Borkmann
2022-03-21 2:41 ` [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code Hangbin Liu
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2022-03-18 15:05 UTC (permalink / raw)
To: Hangbin Liu, netdev; +Cc: Sean Young, Alexei Starovoitov
On 3/17/22 8:18 AM, Hangbin Liu wrote:
> The test_lirc_mode2.sh test exit with 0 even test failed. Fix it by
> exiting with an error code.
>
> Fixes: 6bdd533cee9a ("bpf: add selftest for lirc_mode2 type program")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> tools/testing/selftests/bpf/test_lirc_mode2.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh
> index ec4e15948e40..420dc86362f5 100755
> --- a/tools/testing/selftests/bpf/test_lirc_mode2.sh
> +++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh
> @@ -36,3 +36,5 @@ then
> echo -e ${GREEN}"PASS: $TYPE"${NC}
> fi
> fi
> +
> +exit $ret
nit: Shouldn't this also exit with error if no test_lirc_mode2_user was run?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code
2022-03-17 7:18 [PATCH bpf] selftests/bpf: exit with error code if test failed Hangbin Liu
2022-03-18 15:05 ` Daniel Borkmann
@ 2022-03-21 2:41 ` Hangbin Liu
2022-03-21 13:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Hangbin Liu @ 2022-03-21 2:41 UTC (permalink / raw)
To: netdev; +Cc: Sean Young, Alexei Starovoitov, Daniel Borkmann, Hangbin Liu
When test_lirc_mode2_user exec failed, the test report failed but still
exit with 0. Fix it by exiting with an error code.
Another issue is for the LIRCDEV checking. With bash -n, we need to quote
the variable, or it will always be true. So if test_lirc_mode2_user was
not run, just exit with skip code.
Fixes: 6bdd533cee9a ("bpf: add selftest for lirc_mode2 type program")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
tools/testing/selftests/bpf/test_lirc_mode2.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh
index ec4e15948e40..5252b91f48a1 100755
--- a/tools/testing/selftests/bpf/test_lirc_mode2.sh
+++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh
@@ -3,6 +3,7 @@
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
+ret=$ksft_skip
msg="skip all tests:"
if [ $UID != 0 ]; then
@@ -25,7 +26,7 @@ do
fi
done
-if [ -n $LIRCDEV ];
+if [ -n "$LIRCDEV" ];
then
TYPE=lirc_mode2
./test_lirc_mode2_user $LIRCDEV $INPUTDEV
@@ -36,3 +37,5 @@ then
echo -e ${GREEN}"PASS: $TYPE"${NC}
fi
fi
+
+exit $ret
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code
2022-03-21 2:41 ` [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code Hangbin Liu
@ 2022-03-21 13:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-21 13:50 UTC (permalink / raw)
To: Hangbin Liu; +Cc: netdev, sean, ast, daniel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Mon, 21 Mar 2022 10:41:49 +0800 you wrote:
> When test_lirc_mode2_user exec failed, the test report failed but still
> exit with 0. Fix it by exiting with an error code.
>
> Another issue is for the LIRCDEV checking. With bash -n, we need to quote
> the variable, or it will always be true. So if test_lirc_mode2_user was
> not run, just exit with skip code.
>
> [...]
Here is the summary with links:
- [PATCHv2,bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code
https://git.kernel.org/bpf/bpf-next/c/ec80906b0fbd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-21 13:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-17 7:18 [PATCH bpf] selftests/bpf: exit with error code if test failed Hangbin Liu
2022-03-18 15:05 ` Daniel Borkmann
2022-03-21 2:41 ` [PATCHv2 bpf] selftests/bpf/test_lirc_mode2.sh: exit with proper code Hangbin Liu
2022-03-21 13:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).