]> git.itanic.dy.fi Git - linux-stable/commitdiff
kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 19 Dec 2023 06:57:37 +0000 (14:57 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 21 Dec 2023 08:32:13 +0000 (09:32 +0100)
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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20231219065737.1725120-1-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/rtnetlink.sh

index 38be9706c45f18e410d12694a43696c09a47c211..26827ea4e3e5f20275c9a495639acf706d593672 100755 (executable)
@@ -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"