Skip to content

Commit 03dcb78

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
selftests/bpf: Add simple per-test targets to Makefile
Currently it's impossible to do `make test_progs` and have only test_progs be built, because all the binary targets are defined in terms of $(OUTPUT)/<binary>, and $(OUTPUT) is absolute path to current directory (or whatever gets overridden to by user). This patch adds simple re-directing targets for all test targets making it possible to do simple and nice `make test_progs` (and any other target). Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191016060051.2024182-5-andriin@fb.com
1 parent ee6c52e commit 03dcb78

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎tools/testing/selftests/bpf/Makefile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ TEST_GEN_PROGS_EXTENDED = test_libbpf_open test_sock_addr test_skb_cgroup_id_use
8484

8585
include ../lib.mk
8686

87+
# Define simple and short `make test_progs`, `make test_sysctl`, etc targets
88+
# to build individual tests.
89+
# NOTE: Semicolon at the end is critical to override lib.mk's default static
90+
# rule for binaries.
91+
$(notdir $(TEST_GEN_PROGS) \
92+
$(TEST_PROGS) \
93+
$(TEST_PROGS_EXTENDED) \
94+
$(TEST_GEN_PROGS_EXTENDED) \
95+
$(TEST_CUSTOM_PROGS)): %: $(OUTPUT)/% ;
96+
8797
# NOTE: $(OUTPUT) won't get default value if used before lib.mk
8898
TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read
8999
all: $(TEST_CUSTOM_PROGS)

0 commit comments

Comments
 (0)