Skip to content

Commit 38960ac

Browse files
theihoranakryiko
authored andcommitted
selftests/bpf: Specify libbpf headers required for %.bpf.o progs
Test %.bpf.o objects actually depend only on some libbpf headers. Define a list of required headers and use it as TRUNNER_BPF_OBJS dependency. bpf_*.h list was determined by: $ grep -rh 'include <bpf/bpf_' progs | sort -u Signed-off-by: Ihor Solodrai <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: Link: https://lore.kernel.org/bpf/[email protected] https://lore.kernel.org/bpf/CAEf4BzYQ-j2i_xjs94Nn=8+FVfkWt51mLZyiYKiz9oA4Z=pCeA@mail.gmail.com/
1 parent 181b0d1 commit 38960ac

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/testing/selftests/bpf/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ xdp_features.skel.h-deps := xdp_features.bpf.o
516516
LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps))
517517
LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS))
518518

519+
HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h) \
520+
$(addprefix $(BPFDIR)/, bpf_core_read.h \
521+
bpf_endian.h \
522+
bpf_helpers.h \
523+
bpf_tracing.h)
524+
519525
# Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
520526
# $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
521527
# Parameters:
@@ -566,8 +572,7 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o: \
566572
$(TRUNNER_BPF_PROGS_DIR)/%.c \
567573
$(TRUNNER_BPF_PROGS_DIR)/*.h \
568574
$$(INCLUDE_DIR)/vmlinux.h \
569-
$(wildcard $(BPFDIR)/bpf_*.h) \
570-
$(wildcard $(BPFDIR)/*.bpf.h) \
575+
$(HEADERS_FOR_BPF_OBJS) \
571576
| $(TRUNNER_OUTPUT) $$(BPFOBJ)
572577
$$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@, \
573578
$(TRUNNER_BPF_CFLAGS) \

0 commit comments

Comments
 (0)