OSDN Git Service

selftests: bpf: centre kernel bpf objects under new subdir "progs"
authorJiong Wang <jiong.wang@netronome.com>
Mon, 11 Feb 2019 12:01:20 +0000 (12:01 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 12 Feb 2019 04:31:38 +0000 (20:31 -0800)
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>
50 files changed:
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/progs/bpf_flow.c [moved from tools/testing/selftests/bpf/bpf_flow.c with 100% similarity]
tools/testing/selftests/bpf/progs/connect4_prog.c [moved from tools/testing/selftests/bpf/connect4_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/connect6_prog.c [moved from tools/testing/selftests/bpf/connect6_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/dev_cgroup.c [moved from tools/testing/selftests/bpf/dev_cgroup.c with 100% similarity]
tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c [moved from tools/testing/selftests/bpf/get_cgroup_id_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/netcnt_prog.c [moved from tools/testing/selftests/bpf/netcnt_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/sample_map_ret0.c [moved from tools/testing/selftests/bpf/sample_map_ret0.c with 100% similarity]
tools/testing/selftests/bpf/progs/sample_ret0.c [moved from tools/testing/selftests/bpf/sample_ret0.c with 100% similarity]
tools/testing/selftests/bpf/progs/sendmsg4_prog.c [moved from tools/testing/selftests/bpf/sendmsg4_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/sendmsg6_prog.c [moved from tools/testing/selftests/bpf/sendmsg6_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/socket_cookie_prog.c [moved from tools/testing/selftests/bpf/socket_cookie_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/sockmap_parse_prog.c [moved from tools/testing/selftests/bpf/sockmap_parse_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c [moved from tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c [moved from tools/testing/selftests/bpf/sockmap_verdict_prog.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_adjust_tail.c [moved from tools/testing/selftests/bpf/test_adjust_tail.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_btf_haskv.c [moved from tools/testing/selftests/bpf/test_btf_haskv.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_btf_nokv.c [moved from tools/testing/selftests/bpf/test_btf_nokv.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c [moved from tools/testing/selftests/bpf/test_get_stack_rawtp.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_l4lb.c [moved from tools/testing/selftests/bpf/test_l4lb.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_l4lb_noinline.c [moved from tools/testing/selftests/bpf/test_l4lb_noinline.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c [moved from tools/testing/selftests/bpf/test_lirc_mode2_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_lwt_seg6local.c [moved from tools/testing/selftests/bpf/test_lwt_seg6local.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_map_in_map.c [moved from tools/testing/selftests/bpf/test_map_in_map.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_map_lock.c [moved from tools/testing/selftests/bpf/test_map_lock.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_obj_id.c [moved from tools/testing/selftests/bpf/test_obj_id.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_pkt_access.c [moved from tools/testing/selftests/bpf/test_pkt_access.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_pkt_md_access.c [moved from tools/testing/selftests/bpf/test_pkt_md_access.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_queue_map.c [moved from tools/testing/selftests/bpf/test_queue_map.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c [moved from tools/testing/selftests/bpf/test_select_reuseport_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c [moved from tools/testing/selftests/bpf/test_sk_lookup_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c [moved from tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_sock_fields_kern.c [moved from tools/testing/selftests/bpf/test_sock_fields_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_sockhash_kern.c [moved from tools/testing/selftests/bpf/test_sockhash_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_sockmap_kern.c [moved from tools/testing/selftests/bpf/test_sockmap_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_spin_lock.c [moved from tools/testing/selftests/bpf/test_spin_lock.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_stack_map.c [moved from tools/testing/selftests/bpf/test_stack_map.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c [moved from tools/testing/selftests/bpf/test_stacktrace_build_id.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_stacktrace_map.c [moved from tools/testing/selftests/bpf/test_stacktrace_map.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_tcp_estats.c [moved from tools/testing/selftests/bpf/test_tcp_estats.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c [moved from tools/testing/selftests/bpf/test_tcpbpf_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c [moved from tools/testing/selftests/bpf/test_tcpnotify_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_tracepoint.c [moved from tools/testing/selftests/bpf/test_tracepoint.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_tunnel_kern.c [moved from tools/testing/selftests/bpf/test_tunnel_kern.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_xdp.c [moved from tools/testing/selftests/bpf/test_xdp.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_xdp_meta.c [moved from tools/testing/selftests/bpf/test_xdp_meta.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_xdp_noinline.c [moved from tools/testing/selftests/bpf/test_xdp_noinline.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_xdp_redirect.c [moved from tools/testing/selftests/bpf/test_xdp_redirect.c with 100% similarity]
tools/testing/selftests/bpf/progs/test_xdp_vlan.c [moved from tools/testing/selftests/bpf/test_xdp_vlan.c with 100% similarity]
tools/testing/selftests/bpf/progs/xdp_dummy.c [moved from tools/testing/selftests/bpf/xdp_dummy.c with 100% similarity]

index f2c1147..575746e 100644 (file)
@@ -25,24 +25,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
        test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
        test_netcnt test_tcpnotify_user test_sock_fields
 
-BPF_OBJ_FILES = \
-       test_xdp_redirect.o test_xdp_meta.o sockmap_parse_prog.o \
-       sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o \
-       test_tcpnotify_kern.o sample_map_ret0.o test_tcpbpf_kern.o \
-       sockmap_tcp_msg_prog.o connect4_prog.o connect6_prog.o \
-       test_btf_haskv.o test_btf_nokv.o test_sockmap_kern.o \
-       test_tunnel_kern.o test_sockhash_kern.o test_lwt_seg6local.o \
-       sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
-       get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
-       test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
-       xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
-       test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
-       test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
-       test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
-       test_stacktrace_map.o test_stacktrace_build_id.o \
-       test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
-       test_stack_map.o test_sock_fields_kern.o
-
+BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
 TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
 # 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) \
        $(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \
                trace_helpers.c $(OUTPUT)/libbpf.a $(LDLIBS)
 
-$(ALU32_BUILD_DIR)/%.o: %.c $(ALU32_BUILD_DIR) $(ALU32_BUILD_DIR)/test_progs_32
+$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
+                                       $(ALU32_BUILD_DIR)/test_progs_32
        $(CLANG) $(CLANG_FLAGS) \
                 -O2 -target bpf -emit-llvm -c $< -o - |      \
        $(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \
@@ -196,7 +180,7 @@ endif
 
 # Have one program compiled without "-target bpf" to test whether libbpf loads
 # it successfully
-$(OUTPUT)/test_xdp.o: test_xdp.c
+$(OUTPUT)/test_xdp.o: progs/test_xdp.c
        $(CLANG) $(CLANG_FLAGS) \
                -O2 -emit-llvm -c $< -o - | \
        $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
@@ -204,7 +188,7 @@ ifeq ($(DWARF2BTF),y)
        $(BTF_PAHOLE) -J $@
 endif
 
-$(OUTPUT)/%.o: %.c
+$(OUTPUT)/%.o: progs/%.c
        $(CLANG) $(CLANG_FLAGS) \
                 -O2 -target bpf -emit-llvm -c $< -o - |      \
        $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@