Skip to content

Commit 44cdcca

Browse files
ytcoodeKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
selftests/bpf: Fix incorrect TRUNNER_BINARY name output
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. 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 <[email protected]>
1 parent 8a2749d commit 44cdcca

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tools/testing/selftests/bpf/Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.o: \
413413
$(TRUNNER_BPF_CFLAGS))
414414

415415
$(TRUNNER_BPF_SKELS): %.skel.h: %.o $(BPFTOOL) | $(TRUNNER_OUTPUT)
416-
$$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@)
416+
$$(call msg,GEN-SKEL,$$(TRUNNER_BINARY),$$@)
417417
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked1.o) $$<
418418
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked2.o) $$(<:.o=.linked1.o)
419419
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked3.o) $$(<:.o=.linked2.o)
@@ -422,20 +422,20 @@ $(TRUNNER_BPF_SKELS): %.skel.h: %.o $(BPFTOOL) | $(TRUNNER_OUTPUT)
422422
$(Q)$$(BPFTOOL) gen subskeleton $$(<:.o=.linked3.o) name $$(notdir $$(<:.o=)) > $$(@:.skel.h=.subskel.h)
423423

424424
$(TRUNNER_BPF_LSKELS): %.lskel.h: %.o $(BPFTOOL) | $(TRUNNER_OUTPUT)
425-
$$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@)
425+
$$(call msg,GEN-SKEL,$$(TRUNNER_BINARY),$$@)
426426
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked1.o) $$<
427427
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked2.o) $$(<:.o=.linked1.o)
428428
$(Q)$$(BPFTOOL) gen object $$(<:.o=.linked3.o) $$(<:.o=.linked2.o)
429429
$(Q)diff $$(<:.o=.linked2.o) $$(<:.o=.linked3.o)
430430
$(Q)$$(BPFTOOL) gen skeleton -L $$(<:.o=.linked3.o) name $$(notdir $$(<:.o=_lskel)) > $$@
431431

432432
$(TRUNNER_BPF_SKELS_LINKED): $(TRUNNER_BPF_OBJS) $(BPFTOOL) | $(TRUNNER_OUTPUT)
433-
$$(call msg,LINK-BPF,$(TRUNNER_BINARY),$$(@:.skel.h=.o))
433+
$$(call msg,LINK-BPF,$$(TRUNNER_BINARY),$$(@:.skel.h=.o))
434434
$(Q)$$(BPFTOOL) gen object $$(@:.skel.h=.linked1.o) $$(addprefix $(TRUNNER_OUTPUT)/,$$($$(@F)-deps))
435435
$(Q)$$(BPFTOOL) gen object $$(@:.skel.h=.linked2.o) $$(@:.skel.h=.linked1.o)
436436
$(Q)$$(BPFTOOL) gen object $$(@:.skel.h=.linked3.o) $$(@:.skel.h=.linked2.o)
437437
$(Q)diff $$(@:.skel.h=.linked2.o) $$(@:.skel.h=.linked3.o)
438-
$$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@)
438+
$$(call msg,GEN-SKEL,$$(TRUNNER_BINARY),$$@)
439439
$(Q)$$(BPFTOOL) gen skeleton $$(@:.skel.h=.linked3.o) name $$(notdir $$(@:.skel.h=)) > $$@
440440
$(Q)$$(BPFTOOL) gen subskeleton $$(@:.skel.h=.linked3.o) name $$(notdir $$(@:.skel.h=)) > $$(@:.skel.h=.subskel.h)
441441
endif
@@ -444,7 +444,7 @@ endif
444444
ifeq ($($(TRUNNER_TESTS_DIR)-tests-hdr),)
445445
$(TRUNNER_TESTS_DIR)-tests-hdr := y
446446
$(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c
447-
$$(call msg,TEST-HDR,$(TRUNNER_BINARY),$$@)
447+
$$(call msg,TEST-HDR,$$(TRUNNER_BINARY),$$@)
448448
$$(shell (echo '/* Generated header, do not edit */'; \
449449
sed -n -E 's/^void (serial_)?test_([a-zA-Z0-9_]+)\((void)?\).*/DEFINE_TEST(\2)/p' \
450450
$(TRUNNER_TESTS_DIR)/*.c | sort ; \
@@ -461,25 +461,27 @@ $(TRUNNER_TEST_OBJS): $(TRUNNER_OUTPUT)/%.test.o: \
461461
$(TRUNNER_BPF_LSKELS) \
462462
$(TRUNNER_BPF_SKELS_LINKED) \
463463
$$(BPFOBJ) | $(TRUNNER_OUTPUT)
464-
$$(call msg,TEST-OBJ,$(TRUNNER_BINARY),$$@)
464+
$$(call msg,TEST-OBJ,$$(TRUNNER_BINARY),$$@)
465465
$(Q)cd $$(@D) && $$(CC) -I. $$(CFLAGS) -c $(CURDIR)/$$< $$(LDLIBS) -o $$(@F)
466466

467467
$(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o: \
468468
%.c \
469469
$(TRUNNER_EXTRA_HDRS) \
470470
$(TRUNNER_TESTS_HDR) \
471471
$$(BPFOBJ) | $(TRUNNER_OUTPUT)
472-
$$(call msg,EXT-OBJ,$(TRUNNER_BINARY),$$@)
472+
$$(call msg,EXT-OBJ,$$(TRUNNER_BINARY),$$@)
473473
$(Q)$$(CC) $$(CFLAGS) -c $$< $$(LDLIBS) -o $$@
474474

475475
# non-flavored in-srctree builds receive special treatment, in particular, we
476476
# do not need to copy extra resources (see e.g. test_btf_dump_case())
477477
$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT)
478478
ifneq ($2:$(OUTPUT),:$(shell pwd))
479-
$$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES))
479+
$$(call msg,EXT-COPY,$$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES))
480480
$(Q)rsync -aq $$^ $(TRUNNER_OUTPUT)/
481481
endif
482482

483+
$(OUTPUT)/$(TRUNNER_BINARY): TRUNNER_BINARY = $(TRUNNER_BINARY)
484+
483485
$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \
484486
$(TRUNNER_EXTRA_OBJS) $$(BPFOBJ) \
485487
$(RESOLVE_BTFIDS) \
@@ -489,6 +491,8 @@ $(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \
489491
$(Q)$(RESOLVE_BTFIDS) --btf $(TRUNNER_OUTPUT)/btf_data.o $$@
490492
$(Q)ln -sf $(if $2,..,.)/tools/build/bpftool/bootstrap/bpftool $(if $2,$2/)bpftool
491493

494+
TRUNNER_BINARY =
495+
492496
endef
493497

494498
# Define test_progs test runner.

0 commit comments

Comments
 (0)