]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/bpf: less spam in the log for message matching
authorEduard Zingerman <eddyz87@gmail.com>
Tue, 20 Aug 2024 10:23:49 +0000 (03:23 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 21 Aug 2024 18:03:00 +0000 (11:03 -0700)
When running test_loader based tests in the verbose mode each matched
message leaves a trace in the stderr, e.g.:

    ./test_progs -vvv -t ...
    validate_msgs:PASS:expect_msg 0 nsec
    validate_msgs:PASS:expect_msg 0 nsec
    validate_msgs:PASS:expect_msg 0 nsec
    validate_msgs:PASS:expect_msg 0 nsec
    validate_msgs:PASS:expect_msg 0 nsec

This is not very helpful when debugging such tests and clobbers the
log a lot.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240820102357.3372779-2-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_loader.c

index 12b0c41e8d64c304cbd6c0d33c78b9436a3c2dd7..1b1290e090e74f75343d98ee4bf2daa37fc662ce 100644 (file)
@@ -531,7 +531,8 @@ static void validate_msgs(char *log_buf, struct expected_msgs *msgs,
                        }
                }
 
-               if (!ASSERT_OK_PTR(match, "expect_msg")) {
+               if (!match) {
+                       PRINT_FAIL("expect_msg\n");
                        if (env.verbosity == VERBOSE_NONE)
                                emit_fn(log_buf, true /*force*/);
                        for (j = 0; j <= i; j++) {