selftests/bpf: regroup and declare similar kfuncs selftests in an array
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 6 Sep 2022 15:12:57 +0000 (17:12 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Sep 2022 17:57:28 +0000 (10:57 -0700)
commit012ba1156e4a7b38062d109b818cb479a68c87ba
treeedd5c9606266df10f9142b860542c05073230f5c
parent028a9642217e0ae094fc8b3d764a9339fea6c9ee
selftests/bpf: regroup and declare similar kfuncs selftests in an array

Similar to tools/testing/selftests/bpf/prog_tests/dynptr.c:
we declare an array of tests that we run one by one in a for loop.

Followup patches will add more similar-ish tests, so avoid a lot of copy
paste by grouping the declaration in an array.

For light skeletons, we have to rely on the offsetof() macro so we can
statically declare which program we are using.
In the libbpf case, we can rely on bpf_object__find_program_by_name().
So also change the Makefile to generate both light skeletons and normal
ones.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220906151303.2780789-2-benjamin.tissoires@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/kfunc_call.c