On Sat, Apr 23, 2022 at 7:30 AM Yuntao Wang <ytcoode@xxxxxxxxx> wrote: > > Currently, when we run 'make test_progs', the output is: > > CLNG-BPF [test_maps] atomic_bounds.o > ... > GEN-SKEL [test_progs] atomic_bounds.skel.h > ... > TEST-OBJ [test_progs] align.test.o > ... > TEST-HDR [test_progs] tests.h > EXT-OBJ [test_progs] test_progs.o > ... > BINARY test_progs > > As you can see, the TRUNNER_BINARY name in the CLNG-BPF part is test_maps, > which is incorrect. It's not incorrect. test_maps and test_progs share the same set of BPF object files under progs/ so whichever rule is picked first by make gets to output it's [test_maps] or [test_progs] "badge". Is that a big deal? Adding this $$(TRUNNER_BINARY) indirection and per-target private TRUNNER_BINARY envvar is an unnecessary complication of already complicated Makefile, IMO. Did you run into any problems with the way Makefile is right now? > > Similarly, when we run 'make test_maps', the output is: > > CLNG-BPF [test_maps] atomic_bounds.o > ... > GEN-SKEL [test_progs] atomic_bounds.skel.h > ... > TEST-OBJ [test_maps] array_map_batch_ops.test.o > ... > TEST-HDR [test_maps] tests.h > EXT-OBJ [test_maps] test_maps.o > ... > BINARY test_maps > > At this time, the TRUNNER_BINARY name in the GEN-SKEL part is wrong. > > Again, if we run 'make /full/path/to/selftests/bpf/test_vmlinux.skel.h', > the output is: > > CLNG-BPF [test_maps] test_vmlinux.o > GEN-SKEL [test_progs] test_vmlinux.skel.h > > Here, the TRUNNER_BINARY names are inappropriate and meaningless, they > should be removed. > > This patch fixes these and all other similar issues. > > With the patch applied, the output becomes: > > $ make test_progs > > CLNG-BPF [test_progs] atomic_bounds.o > ... > GEN-SKEL [test_progs] atomic_bounds.skel.h > ... > TEST-OBJ [test_progs] align.test.o > ... > TEST-HDR [test_progs] tests.h > EXT-OBJ [test_progs] test_progs.o > ... > BINARY test_progs > > $ make test_maps > > CLNG-BPF [test_maps] atomic_bounds.o > ... > GEN-SKEL [test_maps] atomic_bounds.skel.h > ... > TEST-OBJ [test_maps] array_map_batch_ops.test.o > ... > TEST-HDR [test_maps] tests.h > EXT-OBJ [test_maps] test_maps.o > ... > BINARY test_maps > > $ make /full/path/to/selftests/bpf/test_vmlinux.skel.h > > CLNG-BPF test_vmlinux.o > GEN-SKEL test_vmlinux.skel.h > > Signed-off-by: Yuntao Wang <ytcoode@xxxxxxxxx> > --- > tools/testing/selftests/bpf/Makefile | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > [...]