Re: [PATCH 2/8] selftests/bpf: build bench.o for any $(OUTPUT)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Andrii!

>>>>> On Tue, 26 May 2020 15:13:36 -0700, Andrii Nakryiko  wrote:

 > On Thu, May 21, 2020 at 9:14 PM Yauheni Kaliuta
 > <yauheni.kaliuta@xxxxxxxxxx> wrote:
 >> 
 >> bench.o is produced by implicit rule only if it's built in the same
 >> directory where bench.c is located. If OUTPUT points somewhere else,
 >> build fails.
 >> 
 >> Make an explicit rule for it (factor out common part).
 >> Add bench.c as a dependency to make it source for CC.

 > If that's the case, then the similar problem would happen to
 > test_l4lb_noinline.o, test_xdp_noinline.o, and
 > flow_dissector_load.o, at least. Let's fix the implicit rule
 > (or define our own, but generic one), instead of ad-hoc fixing
 > it for bench.o only.

I'll check why they did not cause problems.


 >> 
 >> Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxxx>
 >> ---
 >> tools/testing/selftests/bpf/Makefile | 11 ++++++++---
 >> 1 file changed, 8 insertions(+), 3 deletions(-)
 >> 
 >> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
 >> index 09700db35c2d..f0b7d41ed6dd 100644
 >> --- a/tools/testing/selftests/bpf/Makefile
 >> +++ b/tools/testing/selftests/bpf/Makefile
 >> @@ -243,6 +243,11 @@ define GCC_BPF_BUILD_RULE
 >> $(BPF_GCC) $3 $4 -O2 -c $1 -o $2
 >> endef
 >> 
 >> +define COMPILE_C_RULE
 >> +       $(call msg,CC,,$@)
 >> +       $(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
 >> +endef
 >> +
 >> SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c
 >> 
 >> # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
 >> @@ -409,11 +414,11 @@ $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
 >> 
 >> # Benchmark runner
 >> $(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h
 >> -       $(call msg,CC,,$@)
 >> -       $(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
 >> +       $(COMPILE_C_RULE)
 >> $(OUTPUT)/bench_rename.o: $(OUTPUT)/test_overhead.skel.h
 >> $(OUTPUT)/bench_trigger.o: $(OUTPUT)/trigger_bench.skel.h
 >> -$(OUTPUT)/bench.o: bench.h testing_helpers.h
 >> +$(OUTPUT)/bench.o: bench.c bench.h testing_helpers.h
 >> +       $(COMPILE_C_RULE)
 >> $(OUTPUT)/bench: LDLIBS += -lm
 >> $(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \
 >> $(OUTPUT)/bench_count.o \
 >> --
 >> 2.26.2
 >> 


-- 
WBR,
Yauheni Kaliuta




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux