Re: [PATCH bpf-next v2 8/9] selftests/bpf: Add selftests for load-acquire and store-release instructions

From: Peilin Ye
Date: Tue Feb 11 2025 - 15:51:23 EST


On Tue, Feb 11, 2025 at 12:15:25PM -0800, Eduard Zingerman wrote:
> > > Nit: why is dummy_test() necessary?
> >
> > It's just to make it clear when these tests are (effectively) skipped.
> > Otherwise, e.g. -cpuv4 runner with LLVM-18 on x86-64 would give:
> >
> > #518 verifier_load_acquire:OK
> >
> > With dummy_test(), we would see:
> >
> > (FWIW, for v3 I'm planning to change __description() to the following,
> > since new tests no longer depend on __BPF_FEATURE_LOAD_ACQ_STORE_REL.)
> >
> > #518/1 verifier_load_acquire/Clang version < 18, or JIT does not support load-acquire; use a dummy test:OK
> > #518 verifier_load_acquire:OK
> >
> > Commit 147c8f4470ee ("selftests/bpf: Add unit tests for new
> > sign-extension load insns") did similar thing in verifier_ldsx.c.
>
> I see, thank you for explaining.
> We do have a concept of skipped tests in the test-suite,
> but it is implemented by calling test__skip() from the prog_tests/<smth>.c.
> This would translate as something like below in prog_tests/verifier.c:
>
> void test_verifier_store_release(void) {
> #if defined(ENABLE_ATOMICS_TESTS) && defined(__TARGET_ARCH_arm64)
> RUN(verifier_store_release);
> #else
> test__skip()
> #endif
> }

> The number of tests skipped is printed after tests execution.

Sounds nice!

> Up to you if you'd like to change it like that or not.

I'll do that in v3, thanks for the suggestion.

Peilin Ye