Skip to contentSkip to conversation

selftests/bpf: Include runner extras for install target

PATCH In review Björn Töpel 2 participants 3 messages Jan 25, 2024 – Jan 27, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests/bpf: Include runner extras for install target

From: Björn Töpel <[email protected]>

When using the "install" or targets depending on install, e.g. "gen_tar", the "runner extras" weren't included for the BPF machine flavors.

Make sure the necessary helper scripts/tools are added to corresponding BPF machine flavor.

---
v2: Added btf_dump_test_case files
---
tools/testing/selftests/bpf/Makefile | 18 +++++++++++++++---

 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/Makefile +15 -3
index fd15017ed3b1..d5cff32997b3 100644
@@ -744,8 +744,20 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)	\
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
 	$(DEFAULT_INSTALL_RULE)
-	@for DIR in $(TEST_INST_SUBDIRS); do		  \
-		mkdir -p $(INSTALL_PATH)/$$DIR;   \
-		rsync -a $(OUTPUT)/$$DIR/*.bpf.o $(INSTALL_PATH)/$$DIR;\
+	@for DIR in $(TEST_INST_SUBDIRS); do			\
+		mkdir -p $(INSTALL_PATH)/$$DIR;			\
+		rsync -a --copy-unsafe-links			\
+			$(OUTPUT)/$$DIR/bpf_testmod.ko		\
+			$(OUTPUT)/$$DIR/bpftool			\
+			$(OUTPUT)/$$DIR/ima_setup.sh		\
+			$(OUTPUT)/$$DIR/liburandom_read.so	\
+			$(OUTPUT)/$$DIR/sign-file		\
+			$(OUTPUT)/$$DIR/uprobe_multi		\
+			$(OUTPUT)/$$DIR/urandom_read		\
+			$(OUTPUT)/$$DIR/verify_sig_setup.sh	\
+			$(OUTPUT)/$$DIR/xdp_synproxy		\
+			$(OUTPUT)/$$DIR/btf_dump_test_case_*.c	\
+			$(OUTPUT)/$$DIR/*.bpf.o			\
+			$(INSTALL_PATH)/$$DIR;			\
 	done
 endef

base-commit: c8632acf193beac64bbdaebef013368c480bf74f

Signature · 1 line
2.40.1
#1 lore raw
Quoted 33 lines · Björn Töpel

From: Björn Töpel <[email protected]>

When using the "install" or targets depending on install, e.g. "gen_tar", the "runner extras" weren't included for the BPF machine flavors.

Make sure the necessary helper scripts/tools are added to corresponding BPF machine flavor.

---
v2: Added btf_dump_test_case files
---
tools/testing/selftests/bpf/Makefile | 18 +++++++++++++++---

 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/Makefile +5 -3
index fd15017ed3b1..d5cff32997b3 100644
@@ -744,8 +744,20 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)     \
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
        $(DEFAULT_INSTALL_RULE)
-       @for DIR in $(TEST_INST_SUBDIRS); do              \
-               mkdir -p $(INSTALL_PATH)/$$DIR;   \
-               rsync -a $(OUTPUT)/$$DIR/*.bpf.o $(INSTALL_PATH)/$$DIR;\
+       @for DIR in $(TEST_INST_SUBDIRS); do                    \
+               mkdir -p $(INSTALL_PATH)/$$DIR;                 \
+               rsync -a --copy-unsafe-links                    \
+                       $(OUTPUT)/$$DIR/bpf_testmod.ko          \
+                       $(OUTPUT)/$$DIR/bpftool                 \

tools/testing/selftests/bpf/Makefile EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \ · line 761

Quoted 10 lines
tools/testing/selftests/bpf/Makefile +10 -0
+                       $(OUTPUT)/$$DIR/ima_setup.sh            \
+                       $(OUTPUT)/$$DIR/liburandom_read.so      \
+                       $(OUTPUT)/$$DIR/sign-file               \
+                       $(OUTPUT)/$$DIR/uprobe_multi            \
+                       $(OUTPUT)/$$DIR/urandom_read            \
+                       $(OUTPUT)/$$DIR/verify_sig_setup.sh     \
+                       $(OUTPUT)/$$DIR/xdp_synproxy            \
+                       $(OUTPUT)/$$DIR/btf_dump_test_case_*.c  \
+                       $(OUTPUT)/$$DIR/*.bpf.o                 \
+                       $(INSTALL_PATH)/$$DIR;                  \

My concern is that this will get out of sync and will go unnoticed next time we add another "extra" file. We have TRUNNER_EXTRA_FILES, should we use that list to keep these extras in fewer places?

Quoted 7 lines
tools/testing/selftests/bpf/Makefile +0 -0
        done
 endef

base-commit: c8632acf193beac64bbdaebef013368c480bf74f --
2.40.1

#2 lore raw
Quoted 40 lines · Andrii Nakryiko
Quoted 39 lines · Björn Töpel

From: Björn Töpel <[email protected]>

When using the "install" or targets depending on install, e.g. "gen_tar", the "runner extras" weren't included for the BPF machine flavors.

Make sure the necessary helper scripts/tools are added to corresponding BPF machine flavor.

---
v2: Added btf_dump_test_case files
---
tools/testing/selftests/bpf/Makefile | 18 +++++++++++++++---

 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/Makefile +11 -3
index fd15017ed3b1..d5cff32997b3 100644
@@ -744,8 +744,20 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)     \
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
        $(DEFAULT_INSTALL_RULE)
-       @for DIR in $(TEST_INST_SUBDIRS); do              \
-               mkdir -p $(INSTALL_PATH)/$$DIR;   \
-               rsync -a $(OUTPUT)/$$DIR/*.bpf.o $(INSTALL_PATH)/$$DIR;\
+       @for DIR in $(TEST_INST_SUBDIRS); do                    \
+               mkdir -p $(INSTALL_PATH)/$$DIR;                 \
+               rsync -a --copy-unsafe-links                    \
+                       $(OUTPUT)/$$DIR/bpf_testmod.ko          \
+                       $(OUTPUT)/$$DIR/bpftool                 \
+                       $(OUTPUT)/$$DIR/ima_setup.sh            \
+                       $(OUTPUT)/$$DIR/liburandom_read.so      \
+                       $(OUTPUT)/$$DIR/sign-file               \
+                       $(OUTPUT)/$$DIR/uprobe_multi            \
+                       $(OUTPUT)/$$DIR/urandom_read            \
+                       $(OUTPUT)/$$DIR/verify_sig_setup.sh     \
Quoted 8 lines

tools/testing/selftests/bpf/Makefile EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \ · line 761

Quoted 4 lines
tools/testing/selftests/bpf/Makefile +4 -0
+                       $(OUTPUT)/$$DIR/xdp_synproxy            \
+                       $(OUTPUT)/$$DIR/btf_dump_test_case_*.c  \
+                       $(OUTPUT)/$$DIR/*.bpf.o                 \
+                       $(INSTALL_PATH)/$$DIR;                  \

My concern is that this will get out of sync and will go unnoticed next time we add another "extra" file. We have TRUNNER_EXTRA_FILES, should we use that list to keep these extras in fewer places?

Yeah, you're completely right -- this was a lazy approach. I'll spin a more robust v3.

Cheers,
Björn