On Mon, Nov 29, 2021 at 2:39 PM Joanne Koong <joannekoong@xxxxxx> wrote: > > Add test for bpf_loop testing a variety of cases: > various nr_loops, null callback ctx, invalid flags, nested callbacks. > > Signed-off-by: Joanne Koong <joannekoong@xxxxxx> > --- LGTM, one small nit below. Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > .../selftests/bpf/prog_tests/bpf_loop.c | 138 ++++++++++++++++++ > tools/testing/selftests/bpf/progs/bpf_loop.c | 99 +++++++++++++ > 2 files changed, 237 insertions(+) > create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_loop.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_loop.c > > + err = bpf_prog_test_run(bpf_program__fd(skel->progs.test_prog), > + 1, &pkt_v4, sizeof(pkt_v4), NULL, NULL, > + &retval, &duration); > + if (!ASSERT_OK(err, "err") || !ASSERT_OK(retval, "retval")) > + return; Still think that usleep(1) is better and cleaner... pkt_v4 has nothing to do with what you are testing. > + ASSERT_EQ(skel->bss->nr_loops_returned, skel->bss->nr_loops, > + "0 loops"); > + > + /* test 500 loops */ > + skel->bss->nr_loops = 500; [...]