If a BPF selftest program requires (recent) UAPI headers [1], it is
currently needed to duplicate these header files into tools/include/uapi.
That's not a good solution, because it is a duplication that needs to be
kept up-to-date, while the required files are only a few directories
away.
A solution to avoid these duplicated files is to use the KHDR_INCLUDES
from the kselftest infrastructure. That is what is being done in the
first patch.
The second patch removes 'if_xdp.h', which is no longer needed, and was
causing a warning when building the libbpf required by the BPF
selftests. There could be more duplicated UAPI header files that could
be removed, but I didn't spend too much time checking which ones are not
used by anything else from the 'tools' directory.
Hopefully, these modifications should not cause any issues on the
different CIs, because it is using the recommended method for the kernel
selftests. If this causes issues on the CIs side, it should be easy to
fix by overriding the KHDR_INCLUDES variable, and it might be better to
do that, because it likely means the CI is not following the recommended
way to execute the kernel selftests. See patch 1/2 for more details
about that.
Link: https://lore.kernel.org/all/08f925cd-e267-4a6b-84b1-792515c4e199@kernel.org/T/#u [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Matthieu Baerts (NGI0) (2):
selftests: bpf: use KHDR_INCLUDES for the UAPI headers
selftests: bpf: remove duplicated UAPI if_xdp headers
tools/include/uapi/linux/if_xdp.h | 173 ---------------------
tools/lib/bpf/Makefile | 3 -
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/prog_tests/assign_reuse.c | 2 +-
tools/testing/selftests/bpf/prog_tests/tc_links.c | 4 +-
tools/testing/selftests/bpf/prog_tests/tc_netkit.c | 2 +-
tools/testing/selftests/bpf/prog_tests/tc_opts.c | 2 +-
.../selftests/bpf/prog_tests/user_ringbuf.c | 2 +-
.../testing/selftests/bpf/prog_tests/xdp_bonding.c | 2 +-
.../selftests/bpf/prog_tests/xdp_cpumap_attach.c | 2 +-
.../selftests/bpf/prog_tests/xdp_devmap_attach.c | 2 +-
.../selftests/bpf/prog_tests/xdp_do_redirect.c | 2 +-
tools/testing/selftests/bpf/prog_tests/xdp_link.c | 2 +-
tools/testing/selftests/bpf/xdp_features.c | 4 +-
14 files changed, 14 insertions(+), 190 deletions(-)
---
base-commit: fdf1c728fac541891ef1aa773bfd42728626769c
change-id: 20240816-ups-bpf-next-selftests-use-khdr-28f935c8848a
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>