selftests/bpf: fix ima_setup.sh missing issue
Subsystems (5)
v2 cover selftests/bpf: fix ima_setup.sh missing issue
The ima_setup.sh is needed by test_progs test_ima. But the file is missed if we build test_progs separately or installed bpf test to another folder. This patch set fixed the issue in 2 different scenarios.
v2: no code update, just repost to bpf-next
Hangbin Liu (2):
selftests/bpf: Fix build error with ima_setup.sh selftests/bpf: add missed ima_setup.sh in Makefile
tools/testing/selftests/bpf/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.35.1
PATCH v2 1/2 selftests/bpf: Fix build error with ima_setup.sh
KP fixed ima_setup.sh missing issue when build test_progs separately with commit 854055c0cf30 ("selftests/bpf: Fix flavored variants of test_ima"). But the fix is incorrect because the build will failed with error:
$ OUTPUT="/tmp/bpf" make test_progs
[...]
make: *** No rule to make target '/tmp/bpf/ima_setup.sh', needed by 'ima_setup.sh'. Stop.Fix it by adding a new variable TRUNNER_EXTRA_BUILD to build extra binaries. Left TRUNNER_EXTRA_FILES only for copying files
--- tools/testing/selftests/bpf/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/Makefile +5 -4
@@ -466,10 +466,10 @@ $(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o: \ # non-flavored in-srctree builds receive special treatment, in particular, we # do not need to copy extra resources (see e.g. test_btf_dump_case()) -$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT) +$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_BUILD) | $(TRUNNER_OUTPUT) ifneq ($2:$(OUTPUT),:$(shell pwd)) $$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES)) - $(Q)rsync -aq $$^ $(TRUNNER_OUTPUT)/ + $(Q)rsync -aq $(TRUNNER_EXTRA_FILES) $(TRUNNER_OUTPUT)/ endif $(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \
@@ -490,9 +490,9 @@ TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ network_helpers.c testing_helpers.c \ btf_helpers.c flow_dissector_load.h \ cap_helpers.c -TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ - ima_setup.sh \ +TRUNNER_EXTRA_BUILD := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ $(wildcard progs/btf_dump_test_case_*.c) +TRUNNER_EXTRA_FILES := $(TRUNNER_EXTRA_BUILD) ima_setup.sh TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS) -DENABLE_ATOMICS_TESTS $(eval $(call DEFINE_TEST_RUNNER,test_progs))
@@ -513,6 +513,7 @@ endif TRUNNER_TESTS_DIR := map_tests TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_maps.c +TRUNNER_EXTRA_BUILD := TRUNNER_EXTRA_FILES := TRUNNER_BPF_BUILD_RULE := $$(error no BPF objects should be built) TRUNNER_BPF_CFLAGS :=
Signature · 1 line
2.35.1
Re: [PATCHv2 bpf-next 1/2] selftests/bpf: Fix build error with ima_setup.sh
Quoted 10 lines · Hangbin Liu
KP fixed
ima_setup.shmissing issue when buildtest_progsseparately with commit854055c0cf30("selftests/bpf: Fix flavored variants oftest_ima"). But the fix is incorrect because the build will failed with error:$ OUTPUT="/tmp/bpf" make test_progs [...] make: *** No rule to make target '/tmp/bpf/ima_setup.sh', needed by 'ima_setup.sh'. Stop.
Quoted 6 lines
Fix it by adding a new variable
TRUNNER_EXTRA_BUILDto build extra binaries. LeftTRUNNER_EXTRA_FILESonly for copying filesFixes 854055c0cf30 ("selftests/bpf: Fix flavored variants of test_ima")Signed-off-by Hangbin Liu <[email protected]>---
Oops, replied on older version of patch, but my comments still stand. Not sure how this is actually fixing anything, tbh.
Quoted 43 lines
tools/testing/selftests/bpf/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)tools/testing/selftests/bpf/Makefile +5
-5@@ -466,10 +466,10 @@ $(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o: \ # non-flavored in-srctree builds receive special treatment, in particular, we # do not need to copy extra resources (see e.g. test_btf_dump_case()) -$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT) +$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_BUILD) | $(TRUNNER_OUTPUT) ifneq ($2:$(OUTPUT),:$(shell pwd)) $$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES)) - $(Q)rsync -aq $$^ $(TRUNNER_OUTPUT)/ + $(Q)rsync -aq $(TRUNNER_EXTRA_FILES) $(TRUNNER_OUTPUT)/ endif $(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \@@ -490,9 +490,9 @@ TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ network_helpers.c testing_helpers.c \ btf_helpers.c flow_dissector_load.h \ cap_helpers.c -TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ - ima_setup.sh \ +TRUNNER_EXTRA_BUILD := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ $(wildcard progs/btf_dump_test_case_*.c) +TRUNNER_EXTRA_FILES := $(TRUNNER_EXTRA_BUILD) ima_setup.sh TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS) -DENABLE_ATOMICS_TESTS $(eval $(call DEFINE_TEST_RUNNER,test_progs))@@ -513,6 +513,7 @@ endif TRUNNER_TESTS_DIR := map_tests TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_maps.c +TRUNNER_EXTRA_BUILD := TRUNNER_EXTRA_FILES := TRUNNER_BPF_BUILD_RULE := $$(error no BPF objects should be built) TRUNNER_BPF_CFLAGS := --2.35.1
PATCH v2 2/2 selftests/bpf: add missed ima_setup.sh in Makefile
In reply to Hangbin LiuWhen build bpf test and install it to another folder, e.g.
make -j10 install -C tools/testing/selftests/ TARGETS="bpf" \
SKIP_TARGETS="" INSTALL_PATH=/tmp/kselftests
The ima_setup.sh is missed in target folder, which makes test_ima failed.
Fix it by adding ima_setup.sh to TEST_PROGS_EXTENDED.
--- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/Makefile +1 -1
@@ -75,7 +75,7 @@ TEST_PROGS := test_kmod.sh \ test_xsk.sh TEST_PROGS_EXTENDED := with_addr.sh \ - with_tunnels.sh \ + with_tunnels.sh ima_setup.sh \ test_xdp_vlan.sh test_bpftool.py # Compile but not part of 'make run_tests'
Signature · 1 line
2.35.1
Daniel Borkmann
maintainerQuoted 6 lines · Hangbin Liu
The
ima_setup.shis needed bytest_progstest_ima. But the file is missed if we buildtest_progsseparately or installed bpf test to another folder. This patch set fixed the issue in 2 different scenarios.v2: no code update, just repost to bpf-next
Is this against an old tree? This doesn't apply to bpf-next, fwiw, please rebase your series.
Quoted 7 lines
Hangbin Liu (2):
selftests/bpf: Fix build error withima_setup.shselftests/bpf: add missedima_setup.shinMakefiletools/testing/selftests/bpf/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
Thanks,
Daniel