Skip to content

Commit 9bae8f4

Browse files
kkdwivediAlexei Starovoitov
authored andcommitted
selftests/bpf: Make res_spin_lock test less verbose
Currently, the res_spin_lock test is too chatty as it constantly prints the test_run results for each iteration in each thread, so in case verbose output is requested or things go wrong, it will flood the logs of CI and other systems with repeated messages that offer no valuable insight. Reduce this by doing assertions when the condition actually flips, and proceed to break out and exit the threads. We still assert to mark the test as failed and print the expected and reported values. Suggested-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20250403220841.66654-1-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent a8662bc commit 9bae8f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/testing/selftests/bpf/prog_tests/res_spin_lock.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ static void *spin_lock_thread(void *arg)
2525

2626
while (!READ_ONCE(skip)) {
2727
err = bpf_prog_test_run_opts(prog_fd, &topts);
28-
ASSERT_OK(err, "test_run");
29-
ASSERT_OK(topts.retval, "test_run retval");
28+
if (err || topts.retval) {
29+
ASSERT_OK(err, "test_run");
30+
ASSERT_OK(topts.retval, "test_run retval");
31+
break;
32+
}
3033
}
3134
pthread_exit(arg);
3235
}

0 commit comments

Comments
 (0)