* [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail
@ 2023-12-19 6:57 Hangbin Liu
2023-12-20 14:06 ` Simon Horman
2023-12-21 8:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Hangbin Liu @ 2023-12-19 6:57 UTC (permalink / raw)
To: netdev; +Cc: Daniel Mendes, Florian Westphal, David Miller, Hangbin Liu
run_cmd_grep_fail should be used when expecting the cmd fail, or the ret
will be set to 1, and the total test return 1 when exiting. This would cause
the result report to fail if run via run_kselftest.sh.
Before fix:
# ./rtnetlink.sh -t kci_test_addrlft
PASS: preferred_lft addresses have expired
# echo $?
1
After fix:
# ./rtnetlink.sh -t kci_test_addrlft
PASS: preferred_lft addresses have expired
# echo $?
0
Fixes: 9c2a19f71515 ("kselftest: rtnetlink.sh: add verbose flag")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
tools/testing/selftests/net/rtnetlink.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 38be9706c45f..26827ea4e3e5 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -297,7 +297,7 @@ kci_test_addrlft()
done
sleep 5
- run_cmd_grep "10.23.11." ip addr show dev "$devdummy"
+ run_cmd_grep_fail "10.23.11." ip addr show dev "$devdummy"
if [ $? -eq 0 ]; then
check_err 1
end_test "FAIL: preferred_lft addresses remaining"
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail
2023-12-19 6:57 [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail Hangbin Liu
@ 2023-12-20 14:06 ` Simon Horman
2023-12-21 8:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-12-20 14:06 UTC (permalink / raw)
To: Hangbin Liu; +Cc: netdev, Daniel Mendes, Florian Westphal, David Miller
On Tue, Dec 19, 2023 at 02:57:37PM +0800, Hangbin Liu wrote:
> run_cmd_grep_fail should be used when expecting the cmd fail, or the ret
> will be set to 1, and the total test return 1 when exiting. This would cause
> the result report to fail if run via run_kselftest.sh.
>
> Before fix:
> # ./rtnetlink.sh -t kci_test_addrlft
> PASS: preferred_lft addresses have expired
> # echo $?
> 1
>
> After fix:
> # ./rtnetlink.sh -t kci_test_addrlft
> PASS: preferred_lft addresses have expired
> # echo $?
> 0
>
> Fixes: 9c2a19f71515 ("kselftest: rtnetlink.sh: add verbose flag")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Thanks,
I agree that this corrects inverted logic wrt setting
the global 'ret' value and in turn the exit value of the script.
I also agree that the problem was introduced by the cited commit.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail
2023-12-19 6:57 [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail Hangbin Liu
2023-12-20 14:06 ` Simon Horman
@ 2023-12-21 8:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-21 8:40 UTC (permalink / raw)
To: Hangbin Liu; +Cc: netdev, dmendes, fw, davem
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 19 Dec 2023 14:57:37 +0800 you wrote:
> run_cmd_grep_fail should be used when expecting the cmd fail, or the ret
> will be set to 1, and the total test return 1 when exiting. This would cause
> the result report to fail if run via run_kselftest.sh.
>
> Before fix:
> # ./rtnetlink.sh -t kci_test_addrlft
> PASS: preferred_lft addresses have expired
> # echo $?
> 1
>
> [...]
Here is the summary with links:
- [net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail
https://git.kernel.org/netdev/net/c/b8056f2ce07f
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] 3+ messages in thread
end of thread, other threads:[~2023-12-21 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 6:57 [PATCH net] kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail Hangbin Liu
2023-12-20 14:06 ` Simon Horman
2023-12-21 8:40 ` 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).