On Thu, May 12, 2022 at 4:57 PM Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote: > > On Thu, May 12, 2022 at 08:38:16AM IST, Andrii Nakryiko wrote: > > On Wed, May 11, 2022 at 12:46 PM Kumar Kartikeya Dwivedi > > <memxor@xxxxxxxxx> wrote: > > > > > > This uses the newly added SEC("?foo") naming to disable autoload of > > > programs, and then loads them one by one for the object and verifies > > > that loading fails and matches the returned error string from verifier. > > > This is similar to already existing verifier tests but provides coverage > > > for BPF C. > > > > > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > > > --- > > > .../selftests/bpf/prog_tests/map_kptr.c | 87 +++- > > > .../selftests/bpf/progs/map_kptr_fail.c | 418 ++++++++++++++++++ > > > 2 files changed, 504 insertions(+), 1 deletion(-) > > > create mode 100644 tools/testing/selftests/bpf/progs/map_kptr_fail.c > > > > > > > [...] > > > > > + > > > +static void test_map_kptr_success(void) > > > { > > > struct map_kptr *skel; > > > int key = 0, ret; > > > @@ -35,3 +113,10 @@ void test_map_kptr(void) > > > > > > map_kptr__destroy(skel); > > > } > > > + > > > +void test_map_kptr(void) > > > +{ > > > + if (test__start_subtest("success")) > > > + test_map_kptr_success(); > > > + test_map_kptr_fail(); > > > > I think the intent for this was to be another subtest, right? Worth > > fixing in a follow up? > > > > No, instead I am calling test__start_subtest inside it for each program name > that is failing, to make them the subtest. In that case, it should be alright? Ah, ok, it's quite confusing to have test__start_subtest in different functions (though not illegal, I suppose). I'd rather have that test loop right here in test_map_kptr() function, but it's no big deal > > > > +} > > > diff --git a/tools/testing/selftests/bpf/progs/map_kptr_fail.c b/tools/testing/selftests/bpf/progs/map_kptr_fail.c > > > new file mode 100644 > > > index 000000000000..05e209b1b12a > > > --- /dev/null > > > +++ b/tools/testing/selftests/bpf/progs/map_kptr_fail.c > > > @@ -0,0 +1,418 @@ > > > > [...] > > -- > Kartikeya