Re: [PATCH bpf-next v2 26/26] selftests/bpf: Add tests for rqspinlock

Kumar Kartikeya Dwivedi
2025-02-13T06:26:18Z

On Wed, 12 Feb 2025 at 01:14, Eduard Zingerman <eddyz87@gmail.com> wrote:
>
> On Thu, 2025-02-06 at 02:54 -0800, Kumar Kartikeya Dwivedi wrote:
>
> [...]
>
> > +void test_res_spin_lock(void)
> > +{
> > + if (test__start_subtest("res_spin_lock_success"))
> > + test_res_spin_lock_success();
> > + if (test__start_subtest("res_spin_lock_failure"))
> > + test_res_spin_lock_failure();
> > +}
>
> Such organization makes it impossible to select sub-tests from
> res_spin_lock_failure using ./test_progs -t.
> I suggest doing something like below:
>
> @@ -6,7 +6,7 @@
> #include "res_spin_lock.skel.h"
> #include "res_spin_lock_fail.skel.h"
>
> -static void test_res_spin_lock_failure(void)
> +void test_res_spin_lock_failure(void)
> {
> RUN_TESTS(res_spin_lock_fail);
> }
> @@ -30,7 +30,7 @@ static void *spin_lock_thread(void *arg)
> pthread_exit(arg);
> }
>
> -static void test_res_spin_lock_success(void)
> +void test_res_spin_lock_success(void)
> {
> LIBBPF_OPTS(bpf_test_run_opts, topts,
> .data_in = &pkt_v4,
> @@ -89,11 +89,3 @@ static void test_res_spin_lock_success(void)
> res_spin_lock__destroy(skel);
> return;
> }
> -
> -void test_res_spin_lock(void)
> -{
> - if (test__start_subtest("res_spin_lock_success"))
> - test_res_spin_lock_success();
> - if (test__start_subtest("res_spin_lock_failure"))
> - test_res_spin_lock_failure();
> -}
>

Ack, will fix.

> [...]
>