> selftests/bpf: Skip libarena on kernels with too many possible CPUs

TL;DR: Nit only: the libarena selftest skips silently on too many possible
CPUs; suggests printing a reason first, as arena_spin_lock.c does, though
leaving it may be acceptable.

> diff --git a/tools/testing/selftests/bpf/prog_tests/libarena.c 
> b/tools/testing/selftests/bpf/prog_tests/libarena.c
> index daade4150af6..070a08856ee0 100644
> --- a/tools/testing/selftests/bpf/prog_tests/libarena.c
> +++ b/tools/testing/selftests/bpf/prog_tests/libarena.c

[ ... ]

> @@ -240,6 +240,15 @@ void serial_test_libarena(void)
>       if (!ASSERT_OK(ret, "arena_alloc_reserve"))
>               goto out;
>
> +     /* Skip on kernels with more possible CPUs than arena spin locks 
> support */
> +     ret = libarena_run_prog(bpf_program__fd(skel->progs.arena_buddy_reset));
> +     if (ret == -EOPNOTSUPP) {
> +             test__skip();
> +             goto out;
> +     }
> +     if (!ASSERT_OK(ret, "arena_buddy_reset"))
> +             goto out;
> +

This isn't a bug, but a subsystem guideline flags a test that skips for a
missing capability without printing any reason.

When arena_buddy_reset returns -EOPNOTSUPP, this path calls a bare
test__skip(), so the test log shows SKIP with nothing indicating why.  The
explanation only exists in the source comment above the call.

The sibling prog_tests/arena_spin_lock.c prints a reason before skipping
for the same condition:

    printf("%s:SKIP: CONFIG_NR_CPUS exceed the maximum supported by arena 
spinlock\n",
           __func__);
    test__skip();

Would it make sense to print a similar message here before test__skip()?

On the other hand, test__skip() takes no message argument, and the existing
skip in run_libarena_parallel_test() for a disabled parallel test is also
bare, so leaving it as is may be acceptable.

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/37873620927

Reply via email to