diff mbox series

[bpf-next] selftests/bpf: fix Makefile for cgroup_helpers.c

Message ID 151852795500.28668.16124579036826944845.stgit@firesoul
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] selftests/bpf: fix Makefile for cgroup_helpers.c | expand

Commit Message

Jesper Dangaard Brouer Feb. 13, 2018, 1:19 p.m. UTC
The current selftests Makefile construct result in cgroup_helpers.c
gets compiled together with all the TEST_GEN_PROGS. And it also result
in invoking the libbpf Makefile two times (tools/lib/bpf).

These issues were introduced in commit 9d1f15941967 ("bpf: move
cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/").

The only test program that requires the cgroup helpers is 'test_dev_cgroup'.

Thus, create a make target $(OUTPUT)/test_dev_cgroup that extend[1]
the 'prerequisite' for the 'stem' %-style pattern in ../lib.mk,
for this particular test program.

Reviewers notice the make-rules in tools/testing/selftests/lib.mk
differ from the normal kernel kbuild rules, and it is practical
to use 'make -p' to follow how these 'Implicit/static pattern stem'
gets expanded.

[1] https://www.gnu.org/software/make/manual/html_node/Static-Usage.html

Fixes: 9d1f15941967 ("bpf: move cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 tools/testing/selftests/bpf/Makefile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Alexei Starovoitov Feb. 14, 2018, 2:04 a.m. UTC | #1
On Tue, Feb 13, 2018 at 02:19:15PM +0100, Jesper Dangaard Brouer wrote:
> The current selftests Makefile construct result in cgroup_helpers.c
> gets compiled together with all the TEST_GEN_PROGS. And it also result
> in invoking the libbpf Makefile two times (tools/lib/bpf).
> 
> These issues were introduced in commit 9d1f15941967 ("bpf: move
> cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/").
> 
> The only test program that requires the cgroup helpers is 'test_dev_cgroup'.
> 
> Thus, create a make target $(OUTPUT)/test_dev_cgroup that extend[1]
> the 'prerequisite' for the 'stem' %-style pattern in ../lib.mk,
> for this particular test program.
> 
> Reviewers notice the make-rules in tools/testing/selftests/lib.mk
> differ from the normal kernel kbuild rules, and it is practical
> to use 'make -p' to follow how these 'Implicit/static pattern stem'
> gets expanded.
> 
> [1] https://www.gnu.org/software/make/manual/html_node/Static-Usage.html
> 
> Fixes: 9d1f15941967 ("bpf: move cgroup_helpers from samples/bpf/ to tools/testing/selftesting/bpf/")
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>

Applied to bpf-next, Thanks Jesper.
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 5c43c187f27c..8567a858b789 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -35,12 +35,14 @@  TEST_GEN_PROGS_EXTENDED = test_libbpf_open
 
 include ../lib.mk
 
-BPFOBJ := $(OUTPUT)/libbpf.a cgroup_helpers.c
+BPFOBJ := $(OUTPUT)/libbpf.a
 
 $(TEST_GEN_PROGS): $(BPFOBJ)
 
 $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/libbpf.a
 
+$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
+
 .PHONY: force
 
 # force a rebuild of BPFOBJ when its dependencies are updated