Skip to content

Commit bd4aed0

Browse files
Jiong WangAlexei Starovoitov
authored andcommitted
selftests: bpf: centre kernel bpf objects under new subdir "progs"
At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES. Listing them manually sometimes causing patch conflict when people are adding new testcases simultaneously. It is better to centre all the related source files under a subdir "progs", then auto-generate the object file list. Suggested-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 4836b46 commit bd4aed0

50 files changed

Lines changed: 5 additions & 21 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tools/testing/selftests/bpf/Makefile‎

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
2525
test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
2626
test_netcnt test_tcpnotify_user test_sock_fields
2727

28-
BPF_OBJ_FILES = \
29-
test_xdp_redirect.o test_xdp_meta.o sockmap_parse_prog.o \
30-
sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o \
31-
test_tcpnotify_kern.o sample_map_ret0.o test_tcpbpf_kern.o \
32-
sockmap_tcp_msg_prog.o connect4_prog.o connect6_prog.o \
33-
test_btf_haskv.o test_btf_nokv.o test_sockmap_kern.o \
34-
test_tunnel_kern.o test_sockhash_kern.o test_lwt_seg6local.o \
35-
sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
36-
get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
37-
test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
38-
xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
39-
test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
40-
test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
41-
test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
42-
test_stacktrace_map.o test_stacktrace_build_id.o \
43-
test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
44-
test_stack_map.o test_sock_fields_kern.o
45-
28+
BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
4629
TEST_GEN_FILES = $(BPF_OBJ_FILES)
4730

4831
# Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
@@ -184,7 +167,8 @@ $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \
184167
$(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \
185168
trace_helpers.c $(OUTPUT)/libbpf.a $(LDLIBS)
186169

187-
$(ALU32_BUILD_DIR)/%.o: %.c $(ALU32_BUILD_DIR) $(ALU32_BUILD_DIR)/test_progs_32
170+
$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
171+
$(ALU32_BUILD_DIR)/test_progs_32
188172
$(CLANG) $(CLANG_FLAGS) \
189173
-O2 -target bpf -emit-llvm -c $< -o - | \
190174
$(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \
@@ -196,15 +180,15 @@ endif
196180

197181
# Have one program compiled without "-target bpf" to test whether libbpf loads
198182
# it successfully
199-
$(OUTPUT)/test_xdp.o: test_xdp.c
183+
$(OUTPUT)/test_xdp.o: progs/test_xdp.c
200184
$(CLANG) $(CLANG_FLAGS) \
201185
-O2 -emit-llvm -c $< -o - | \
202186
$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
203187
ifeq ($(DWARF2BTF),y)
204188
$(BTF_PAHOLE) -J $@
205189
endif
206190

207-
$(OUTPUT)/%.o: %.c
191+
$(OUTPUT)/%.o: progs/%.c
208192
$(CLANG) $(CLANG_FLAGS) \
209193
-O2 -target bpf -emit-llvm -c $< -o - | \
210194
$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)