OSDN Git Service

selftests/bpf: implement and test custom testmod_seq iterator
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 8 Mar 2023 18:41:21 +0000 (10:41 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 9 Mar 2023 00:19:51 +0000 (16:19 -0800)
commit7e86a8c4ac8d5dcf7dd58f5a4779d1a6ff0a827d
tree902425fa97555d12bae99f5d10119e98aa92d393
parentf59b146092653bcf014ccdc9bd8bc94e79065ce3
selftests/bpf: implement and test custom testmod_seq iterator

Implement a trivial iterator returning same specified integer value
N times as part of bpf_testmod kernel module. Add selftests to validate
everything works end to end.

We also reuse these tests as "verification-only" tests to validate that
kernel prints the state of custom kernel module-defined iterator correctly:

  fp-16=iter_testmod_seq(ref_id=1,state=drained,depth=0)

"testmod_seq" part is an iterator type, and is coming from module's BTF
data dynamically at runtime.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230308184121.1165081-9-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/DENYLIST.s390x
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
tools/testing/selftests/bpf/prog_tests/iters.c
tools/testing/selftests/bpf/progs/iters_testmod_seq.c [new file with mode: 0644]