Skip to content

Commit

Permalink
selftests/bpf: Make res_spin_lock test less verbose
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kumar Kartikeya Dwivedi authored and Alexei Starovoitov committed Apr 5, 2025
1 parent a8662bc commit 9bae8f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/testing/selftests/bpf/prog_tests/res_spin_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ static void *spin_lock_thread(void *arg)

while (!READ_ONCE(skip)) {
err = bpf_prog_test_run_opts(prog_fd, &topts);
ASSERT_OK(err, "test_run");
ASSERT_OK(topts.retval, "test_run retval");
if (err || topts.retval) {
ASSERT_OK(err, "test_run");
ASSERT_OK(topts.retval, "test_run retval");
break;
}
}
pthread_exit(arg);
}
Expand Down

0 comments on commit 9bae8f4

Please sign in to comment.