Skip to contentSkip to conversation

selftests/bpf: restore $(OUTPUT)/test_stub.o rule

PATCH Superseded Ilya Leoshkevich 3 participants 3 messages Oct 24, 2019 – Oct 25, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: restore $(OUTPUT)/test_stub.o rule

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")
---
 tools/testing/selftests/bpf/Makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/Makefile +3 -0
index 59b93a5667c8..9d63a12f932b 100644
@@ -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)
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Ilya Leoshkevich

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")
---
 tools/testing/selftests/bpf/Makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/Makefile +0 -0
index 59b93a5667c8..9d63a12f932b 100644

tools/testing/selftests/bpf/Makefile $(notdir $(TEST_GEN_PROGS) \ · line 93

Quoted 5 lines
tools/testing/selftests/bpf/Makefile +2 -0
@@ -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:

Quoted 7 lines
tools/testing/selftests/bpf/Makefile +1 -1
+
 BPFOBJ := $(OUTPUT)/libbpf.a
 
 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
--

2.23.0

maintainer
#2 lore raw
Quoted 31 lines · Andrii Nakryiko
Quoted 21 lines · Ilya Leoshkevich

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")
---
 tools/testing/selftests/bpf/Makefile | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/Makefile +0 -0
index 59b93a5667c8..9d63a12f932b 100644

tools/testing/selftests/bpf/Makefile $(notdir $(TEST_GEN_PROGS) \ · line 93

Quoted 5 lines
tools/testing/selftests/bpf/Makefile +2 -0
@@ -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.

Quoted 3 lines

But either way:

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

Thanks,
Daniel