selftests/bpf: Add test verifying bpf_ringbuf_reserve retval use in map ops
authorDave Marchevsky <davemarchevsky@fb.com>
Thu, 20 Oct 2022 16:07:20 +0000 (09:07 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 22 Oct 2022 02:23:34 +0000 (19:23 -0700)
commit51ee71d38d8ce5a30496251200ab2f12b71e1fb6
tree8678c3ad0da143bac254b1c0053594a5f7c6023f
parentd1673304097c1f5b04e062cf62fb40200ef1546b
selftests/bpf: Add test verifying bpf_ringbuf_reserve retval use in map ops

Add a test_ringbuf_map_key test prog, borrowing heavily from extant
test_ringbuf.c. The program tries to use the result of
bpf_ringbuf_reserve as map_key, which was not possible before previouis
commits in this series. The test runner added to prog_tests/ringbuf.c
verifies that the program loads and does basic sanity checks to confirm
that it runs as expected.

Also, refactor test_ringbuf such that runners for existing test_ringbuf
and newly-added test_ringbuf_map_key are subtests of 'ringbuf' top-level
test.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20221020160721.4030492-3-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/ringbuf.c
tools/testing/selftests/bpf/progs/test_ringbuf_map_key.c [new file with mode: 0644]