diff mbox series

[bpf-next] selftests/bpf: restore $(OUTPUT)/test_stub.o rule

Message ID 20191024184205.1798-1-iii@linux.ibm.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] selftests/bpf: restore $(OUTPUT)/test_stub.o rule | expand

Commit Message

Ilya Leoshkevich Oct. 24, 2019, 6:42 p.m. UTC
`make O=/linux-build kselftest TARGETS=bpf` fails with

	make[3]: *** No rule to make target '/linux-build/bpf/test_stub.o', needed by '/linux-build/bpf/test_verifier'

The same command without the O= part works, presumably thanks to the
implicit rule.

Fix by restoring the explicit $(OUTPUT)/test_stub.o rule.

Fixes: 74b5a5968fe8 ("selftests/bpf: Replace test_progs and test_maps w/ general rule")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/testing/selftests/bpf/Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrii Nakryiko Oct. 25, 2019, 9:01 p.m. UTC | #1
On Fri, Oct 25, 2019 at 11:54 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> `make O=/linux-build kselftest TARGETS=bpf` fails with
>
>         make[3]: *** No rule to make target '/linux-build/bpf/test_stub.o', needed by '/linux-build/bpf/test_verifier'
>
> The same command without the O= part works, presumably thanks to the
> implicit rule.
>
> Fix by restoring the explicit $(OUTPUT)/test_stub.o rule.
>
> Fixes: 74b5a5968fe8 ("selftests/bpf: Replace test_progs and test_maps w/ general rule")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tools/testing/selftests/bpf/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 59b93a5667c8..9d63a12f932b 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -89,6 +89,9 @@ $(notdir $(TEST_GEN_PROGS)                                            \
>  $(OUTPUT)/urandom_read: urandom_read.c
>         $(CC) -o $@ $< -Wl,--build-id
>
> +$(OUTPUT)/test_stub.o: test_stub.c
> +       $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

Looks good to me, even though we never pass $(CPPFLAGS) to any other
objects, so for consistency we might want to drop them.

But either way:

Acked-by: Andrii Nakryiko <andriin@fb.com>

> +
>  BPFOBJ := $(OUTPUT)/libbpf.a
>
>  $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
> --
> 2.23.0
>
Daniel Borkmann Oct. 25, 2019, 9:39 p.m. UTC | #2
On Fri, Oct 25, 2019 at 02:01:40PM -0700, Andrii Nakryiko wrote:
> On Fri, Oct 25, 2019 at 11:54 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> >
> > `make O=/linux-build kselftest TARGETS=bpf` fails with
> >
> >         make[3]: *** No rule to make target '/linux-build/bpf/test_stub.o', needed by '/linux-build/bpf/test_verifier'
> >
> > The same command without the O= part works, presumably thanks to the
> > implicit rule.
> >
> > Fix by restoring the explicit $(OUTPUT)/test_stub.o rule.
> >
> > Fixes: 74b5a5968fe8 ("selftests/bpf: Replace test_progs and test_maps w/ general rule")
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 59b93a5667c8..9d63a12f932b 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -89,6 +89,9 @@ $(notdir $(TEST_GEN_PROGS)                                            \
> >  $(OUTPUT)/urandom_read: urandom_read.c
> >         $(CC) -o $@ $< -Wl,--build-id
> >
> > +$(OUTPUT)/test_stub.o: test_stub.c
> > +       $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
> 
> Looks good to me, even though we never pass $(CPPFLAGS) to any other
> objects, so for consistency we might want to drop them.
> 
> But either way:
> 
> Acked-by: Andrii Nakryiko <andriin@fb.com>

+1, Ilya could you respin with CPPFLAGS removed. Feel free to retain
Andrii's ACK then.

Thanks,
Daniel
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 59b93a5667c8..9d63a12f932b 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -89,6 +89,9 @@  $(notdir $(TEST_GEN_PROGS)						\
 $(OUTPUT)/urandom_read: urandom_read.c
 	$(CC) -o $@ $< -Wl,--build-id
 
+$(OUTPUT)/test_stub.o: test_stub.c
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+
 BPFOBJ := $(OUTPUT)/libbpf.a
 
 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)