Re: [PATCH bpf-next v1] selftests/bpf: Fix wrong binary in Makefile log output

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

 



On Fri, Jul 19, 2024 at 07:57:09PM -0700, Andrii Nakryiko wrote:
> On Fri, Jul 19, 2024 at 4:22 PM Tony Ambardar <tony.ambardar@xxxxxxxxx> wrote:
> >
> > Make log output incorrectly shows 'test_maps' as the binary name for every
> > 'CLNG-BPF' build step, apparently picking up the last value defined for the
> > $(TRUNNER_BINARY) variable. Update the 'CLANG_BPF_BUILD_RULE' variants to
> > fix this confusing output.
> >
> > Current output:
> >   CLNG-BPF [test_maps] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs] access_map_in_map.skel.h
> >   ...
> >   CLNG-BPF [test_maps] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs-no_alu32] access_map_in_map.skel.h
> >   ...
> >   CLNG-BPF [test_maps] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs-cpuv4] access_map_in_map.skel.h
> >
> > After fix:
> >   CLNG-BPF [test_progs] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs] access_map_in_map.skel.h
> >   ...
> >   CLNG-BPF [test_progs-no_alu32] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs-no_alu32] access_map_in_map.skel.h
> >   ...
> >   CLNG-BPF [test_progs-cpuv4] access_map_in_map.bpf.o
> >   GEN-SKEL [test_progs-cpuv4] access_map_in_map.skel.h
> >
> > Fixes: a5d0c26a2784 ("selftests/bpf: Add a cpuv4 test runner for cpu=v4 testing")
> > Fixes: 89ad7420b25c ("selftests/bpf: Drop the need for LLVM's llc")
> > Signed-off-by: Tony Ambardar <tony.ambardar@xxxxxxxxx>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 25 +++++++++++++------------
> >  1 file changed, 13 insertions(+), 12 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 0b4bfbc0ef68..67921e3367dd 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -425,27 +425,28 @@ $(OUTPUT)/flow_dissector_load.o: flow_dissector_load.h
> >  $(OUTPUT)/cgroup_getset_retval_hooks.o: cgroup_getset_retval_hooks.h
> >
> >  # Build BPF object using Clang
> > -# $1 - input .c file
> > -# $2 - output .o file
> > -# $3 - CFLAGS
> > +# $1 - binary name
> > +# $2 - input .c file
> > +# $3 - output .o file
> > +# $4 - CFLAGS
> >  define CLANG_BPF_BUILD_RULE
> > -       $(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
> > -       $(Q)$(CLANG) $3 -O2 --target=bpf -c $1 -mcpu=v3 -o $2
> > +       $(call msg,CLNG-BPF,$1,$3)
> > +       $(Q)$(CLANG) $4 -O2 --target=bpf -c $2 -mcpu=v3 -o $3
> 
> this works, but did you have to renumber all parameters? Let's maybe
> pass this binary name as the 4th argument?
> 

OK, I'll update as requested and minimize the diff.

> pw-bot: cr
> 
> >  endef
> >  # Similar to CLANG_BPF_BUILD_RULE, but with disabled alu32
> >  define CLANG_NOALU32_BPF_BUILD_RULE
> > -       $(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
> > -       $(Q)$(CLANG) $3 -O2 --target=bpf -c $1 -mcpu=v2 -o $2
> > +       $(call msg,CLNG-BPF,$1,$3)
> > +       $(Q)$(CLANG) $4 -O2 --target=bpf -c $2 -mcpu=v2 -o $3
> >  endef
> >  # Similar to CLANG_BPF_BUILD_RULE, but with cpu-v4
> >  define CLANG_CPUV4_BPF_BUILD_RULE
> > -       $(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
> > -       $(Q)$(CLANG) $3 -O2 --target=bpf -c $1 -mcpu=v4 -o $2
> > +       $(call msg,CLNG-BPF,$1,$3)
> > +       $(Q)$(CLANG) $4 -O2 --target=bpf -c $2 -mcpu=v4 -o $3
> >  endef
> >  # Build BPF object using GCC
> >  define GCC_BPF_BUILD_RULE
> > -       $(call msg,GCC-BPF,$(TRUNNER_BINARY),$2)
> > -       $(Q)$(BPF_GCC) $3 -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes -O2 -c $1 -o $2
> > +       $(call msg,GCC-BPF,$1,$3)
> > +       $(Q)$(BPF_GCC) $4 -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes -O2 -c $2 -o $3
> >  endef
> >
> >  SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c
> > @@ -534,7 +535,7 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o:                             \
> >                      $(wildcard $(BPFDIR)/bpf_*.h)                      \
> >                      $(wildcard $(BPFDIR)/*.bpf.h)                      \
> >                      | $(TRUNNER_OUTPUT) $$(BPFOBJ)
> > -       $$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,                      \
> > +       $$(call $(TRUNNER_BPF_BUILD_RULE),$(TRUNNER_BINARY),$$<,$$@,    \
> >                                           $(TRUNNER_BPF_CFLAGS)         \
> >                                           $$($$<-CFLAGS)                \
> >                                           $$($$<-$2-CFLAGS))
> > --
> > 2.34.1
> >




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux