diff mbox series

[bpf-next] selftests/bpf: Build testing_helpers.o out of tree

Message ID 20211129111508.404367-1-jean-philippe@linaro.org (mailing list archive)
State New
Headers show
Series [bpf-next] selftests/bpf: Build testing_helpers.o out of tree | expand

Commit Message

Jean-Philippe Brucker Nov. 29, 2021, 11:15 a.m. UTC
Add $(OUTPUT) prefix to testing_helpers.o, so it can be built out of
tree when necessary. At the moment, in addition to being built in-tree
even when out-of-tree is required, testing_helpers.o is not built with
the right recipe when cross-building.

Fixes: f87c1930ac29 ("selftests/bpf: Merge test_stub.c into testing_helpers.c")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
 tools/testing/selftests/bpf/Makefile | 32 ++++++++++++++--------------
 1 file changed, 16 insertions(+), 16 deletions(-)

Comments

Andrii Nakryiko Nov. 29, 2021, 11:23 p.m. UTC | #1
On Mon, Nov 29, 2021 at 3:17 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> Add $(OUTPUT) prefix to testing_helpers.o, so it can be built out of
> tree when necessary. At the moment, in addition to being built in-tree
> even when out-of-tree is required, testing_helpers.o is not built with
> the right recipe when cross-building.
>
> Fixes: f87c1930ac29 ("selftests/bpf: Merge test_stub.c into testing_helpers.c")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
>  tools/testing/selftests/bpf/Makefile | 32 ++++++++++++++--------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 35684d61aaeb..082f6aeec1d9 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -192,22 +192,22 @@ TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL)
>
>  $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
>
> -$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c testing_helpers.o

one of cgroup_helper.c (C source code) or testing_helper.o (object
file) is wrong, let's ensure that the dependencies are correct while
at it?


> -$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_sock: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_sock_addr: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_sockmap: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c testing_helpers.o
> -$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_sock_fields: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_sysctl: cgroup_helpers.c testing_helpers.o
> -$(OUTPUT)/test_tag: testing_helpers.o
> -$(OUTPUT)/test_lirc_mode2_user: testing_helpers.o
> -$(OUTPUT)/xdping: testing_helpers.o
> -$(OUTPUT)/flow_dissector_load: testing_helpers.o
> -$(OUTPUT)/test_maps: testing_helpers.o
> -$(OUTPUT)/test_verifier: testing_helpers.o
> +$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_sock: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_sock_addr: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_sockmap: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_sock_fields: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_sysctl: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_tag: $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_lirc_mode2_user: $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/xdping: $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/flow_dissector_load: $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_maps: $(OUTPUT)/testing_helpers.o
> +$(OUTPUT)/test_verifier: $(OUTPUT)/testing_helpers.o
>
>  BPFTOOL ?= $(DEFAULT_BPFTOOL)
>  $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
> --
> 2.34.0
>
Jean-Philippe Brucker Dec. 1, 2021, 2:13 p.m. UTC | #2
On Mon, Nov 29, 2021 at 03:23:02PM -0800, Andrii Nakryiko wrote:
> On Mon, Nov 29, 2021 at 3:17 AM Jean-Philippe Brucker
> <jean-philippe@linaro.org> wrote:
> >
> > Add $(OUTPUT) prefix to testing_helpers.o, so it can be built out of
> > tree when necessary. At the moment, in addition to being built in-tree
> > even when out-of-tree is required, testing_helpers.o is not built with
> > the right recipe when cross-building.
> >
> > Fixes: f87c1930ac29 ("selftests/bpf: Merge test_stub.c into testing_helpers.c")
> > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 32 ++++++++++++++--------------
> >  1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 35684d61aaeb..082f6aeec1d9 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -192,22 +192,22 @@ TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL)
> >
> >  $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
> >
> > -$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c testing_helpers.o
> 
> one of cgroup_helper.c (C source code) or testing_helper.o (object
> file) is wrong, let's ensure that the dependencies are correct while
> at it?

Sure, I'll change this to object files

Thanks,
Jean

> 
> 
> > -$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_sock: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_sock_addr: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_sockmap: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c testing_helpers.o
> > -$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_sock_fields: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_sysctl: cgroup_helpers.c testing_helpers.o
> > -$(OUTPUT)/test_tag: testing_helpers.o
> > -$(OUTPUT)/test_lirc_mode2_user: testing_helpers.o
> > -$(OUTPUT)/xdping: testing_helpers.o
> > -$(OUTPUT)/flow_dissector_load: testing_helpers.o
> > -$(OUTPUT)/test_maps: testing_helpers.o
> > -$(OUTPUT)/test_verifier: testing_helpers.o
> > +$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_sock: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_sock_addr: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_sockmap: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_sock_fields: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_sysctl: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_tag: $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_lirc_mode2_user: $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/xdping: $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/flow_dissector_load: $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_maps: $(OUTPUT)/testing_helpers.o
> > +$(OUTPUT)/test_verifier: $(OUTPUT)/testing_helpers.o
> >
> >  BPFTOOL ?= $(DEFAULT_BPFTOOL)
> >  $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
> > --
> > 2.34.0
> >
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 35684d61aaeb..082f6aeec1d9 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -192,22 +192,22 @@  TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL)
 
 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
 
-$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_sock: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_sock_addr: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_sockmap: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c testing_helpers.o
-$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_sock_fields: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_sysctl: cgroup_helpers.c testing_helpers.o
-$(OUTPUT)/test_tag: testing_helpers.o
-$(OUTPUT)/test_lirc_mode2_user: testing_helpers.o
-$(OUTPUT)/xdping: testing_helpers.o
-$(OUTPUT)/flow_dissector_load: testing_helpers.o
-$(OUTPUT)/test_maps: testing_helpers.o
-$(OUTPUT)/test_verifier: testing_helpers.o
+$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_sock: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_sock_addr: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_sockmap: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_sock_fields: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_sysctl: cgroup_helpers.c $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_tag: $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_lirc_mode2_user: $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/xdping: $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/flow_dissector_load: $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_maps: $(OUTPUT)/testing_helpers.o
+$(OUTPUT)/test_verifier: $(OUTPUT)/testing_helpers.o
 
 BPFTOOL ?= $(DEFAULT_BPFTOOL)
 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \