On Wed, May 6, 2020 at 10:41 PM Yonghong Song <yhs@xxxxxx> wrote: > > The added test includes the following subtests: > - test verifier change for btf_id_or_null > - test load/create_iter/read for > ipv6_route/netlink/bpf_map/task/task_file > - test anon bpf iterator > - test anon bpf iterator reading one char at a time > - test file bpf iterator > - test overflow (single bpf program output not overflow) > - test overflow (single bpf program output overflows) > - test bpf prog returning 1 > > The ipv6_route tests the following verifier change > - access fields in the variable length array of the structure. > > The netlink load tests the following verifier change > - put a btf_id ptr value in a stack and accessible to > tracing/iter programs. > > The anon bpf iterator also tests link auto attach through skeleton. > > $ test_progs -n 2 > #2/1 btf_id_or_null:OK > #2/2 ipv6_route:OK > #2/3 netlink:OK > #2/4 bpf_map:OK > #2/5 task:OK > #2/6 task_file:OK > #2/7 anon:OK > #2/8 anon-read-one-char:OK > #2/9 file:OK > #2/10 overflow:OK > #2/11 overflow-e2big:OK > #2/12 prog-ret-1:OK > #2 bpf_iter:OK > Summary: 1/12 PASSED, 0 SKIPPED, 0 FAILED > > Signed-off-by: Yonghong Song <yhs@xxxxxx> > --- I'm personally not a big fan of bpf_iter_test_kern_common.h approach (including it and parameterizing with #define), I'd rather just copy/paste BPF program code (it's just a few lines) and maybe even put them in the same file/skeleton, less files to jump between. But that's just personal preferences, so: Acked-by: Andrii Nakryiko <andriin@xxxxxx> > .../selftests/bpf/prog_tests/bpf_iter.c | 408 ++++++++++++++++++ > .../selftests/bpf/progs/bpf_iter_test_kern1.c | 4 + > .../selftests/bpf/progs/bpf_iter_test_kern2.c | 4 + > .../selftests/bpf/progs/bpf_iter_test_kern3.c | 18 + > .../selftests/bpf/progs/bpf_iter_test_kern4.c | 52 +++ > .../bpf/progs/bpf_iter_test_kern_common.h | 22 + > 6 files changed, 508 insertions(+) > create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_iter.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_test_kern2.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_test_kern3.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c > create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_test_kern_common.h > [...]