On 9/9/26 12:24, Thiébaud Weksteen wrote:
> In test_global_percpu_data.c, dump_percpu_data is defined after two
> non-autoload SEC("?kprobe") programs (verifier_strncmp and
> verifier_snprintf). Verify in test_global_percpu_data_lskel() that
> lskel->progs.dump_percpu_data.prog_fd is properly populated (> 0) when
> loaded via the light skeleton.
> 
> Signed-off-by: Thiébaud Weksteen <[email protected]>
> ---
> No changes since v1.

The Fixes tags of v1 are dropped.

> 
>  tools/testing/selftests/bpf/prog_tests/global_data_init.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/global_data_init.c 
> b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> index 7c539cbcf3a1..ebda60200b71 100644
> --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> @@ -214,6 +214,8 @@ static void test_global_percpu_data_lskel(void)
>       lskel = test_global_percpu_data_lskel__open_and_load();
>       if (!ASSERT_OK_PTR(lskel, 
> "test_global_percpu_data_lskel__open_and_load"))
>               goto out;
> +     if (!ASSERT_GT(lskel->progs.dump_percpu_data.prog_fd, 0, 
> "dump_percpu_data.prog_fd"))
> +             goto out;

When the light skeleton does not skip the non-autoload progs,
lskel->progs.dump_percpu_data.prog_fd is 0, actually.

But, theoretically, this ASSERT_GT() is not good enough to prove the FD
is the correct FD of dump_percpu_data prog.

How about running the iter subtest against the lskel? Factor out
test_global_percpu_data_iter_fd() helper first. Then, add an iter
subtest using lskel.
When factoring out test_global_percpu_data_iter_fd() helper, pls change
'do { } while (0);' to '{ /* no-op */ }' btw.

Thanks,
Leon


Reply via email to