OSDN Git Service

selftests/bpf: add iterators tests
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 8 Mar 2023 18:41:19 +0000 (10:41 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 9 Mar 2023 00:19:51 +0000 (16:19 -0800)
commit57400dcce6c2cf3985120c4ee28b37a1f4238dbb
tree21e862f484486441f2e7553df38dba6faa6bdf4a
parent8c2b5e90505e474f36ecc3b7f3f8298b59d72e91
selftests/bpf: add iterators tests

Add various tests for open-coded iterators. Some of them excercise
various possible coding patterns in C, some go down to low-level
assembly for more control over various conditions, especially invalid
ones.

We also make use of bpf_for(), bpf_for_each(), bpf_repeat() macros in
some of these tests.

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