]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Reduce test_xdp_adjust_frags_tail_grow logs
authorYonghong Song <yonghong.song@linux.dev>
Sat, 7 Jun 2025 01:36:10 +0000 (18:36 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 7 Jun 2025 02:21:43 +0000 (19:21 -0700)
For selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow, if tested failure,
I see a long list of log output like

    ...
    test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
    test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
    test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
    test_xdp_adjust_frags_tail_grow:PASS:9Kb+10b-untouched 0 nsec
    ...

There are total 7374 lines of the above which is too much. Let us
only issue such logs when it is an assert failure.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20250607013610.1551399-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c

index b2b2d85dbb1b4d5694a53595d4f2c09cb44464d7..e361129402a1e67188f4fd625afa61eba5634fce 100644 (file)
@@ -246,14 +246,20 @@ static void test_xdp_adjust_frags_tail_grow(void)
        ASSERT_EQ(topts.retval, XDP_TX, "9Kb+10b retval");
        ASSERT_EQ(topts.data_size_out, exp_size, "9Kb+10b size");
 
-       for (i = 0; i < 9000; i++)
-               ASSERT_EQ(buf[i], 1, "9Kb+10b-old");
+       for (i = 0; i < 9000; i++) {
+               if (buf[i] != 1)
+                       ASSERT_EQ(buf[i], 1, "9Kb+10b-old");
+       }
 
-       for (i = 9000; i < 9010; i++)
-               ASSERT_EQ(buf[i], 0, "9Kb+10b-new");
+       for (i = 9000; i < 9010; i++) {
+               if (buf[i] != 0)
+                       ASSERT_EQ(buf[i], 0, "9Kb+10b-new");
+       }
 
-       for (i = 9010; i < 16384; i++)
-               ASSERT_EQ(buf[i], 1, "9Kb+10b-untouched");
+       for (i = 9010; i < 16384; i++) {
+               if (buf[i] != 1)
+                       ASSERT_EQ(buf[i], 1, "9Kb+10b-untouched");
+       }
 
        /* Test a too large grow */
        memset(buf, 1, 16384);