[PATCH][Unstable/oem-5.6] UBUNTU: SAUCE: skip building selftest 'runqslower' if kernel not built

Kamal Mostafa kamal at canonical.com
Thu May 7 15:58:24 UTC 2020


Compiling the bpf selftest 'runqslower' requires access to the current
built vmlinux -- see the VMLINUX_BTF machinery in
  tools/bpf/runqslower/Makefile
  tools/testing/selftests/bpf/Makefile

This means that the kernel must be compiled before the selftests can be
compiled, which may be an annoyance.  In order to allow compiling the
selftests without the kernel, skip building 'runqslower' with just a
warning if it would otherwise fail this way.

Signed-off-by: Kamal Mostafa <kamal at canonical.com>
Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
Fixes: a835d38d41ca ("tools/bpf/runqslower: Fix override option for VMLINUX_BTF")
---
 tools/testing/selftests/bpf/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 257a1aaaa37d..44023e1387c9 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -133,9 +133,15 @@ VMLINUX_BTF_PATHS := $(abspath ../../../../vmlinux)			\
 			       /boot/vmlinux-$(shell uname -r)
 VMLINUX_BTF:= $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))
 $(OUTPUT)/runqslower: $(BPFOBJ)
-	$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower	\
+	$(Q)if [ ! -e "$(VMLINUX_BTF)" ] ; then \
+		echo "WARNING: Skipping build of runqslower, because\n" \
+		    "   Couldn't find kernel BTF (vmlinux not yet built?);\n" \
+		    "   Set VMLINUX_BTF to specify its location." >&2; \
+	    else
+		$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower	\
 		    OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF)   \
 		    BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR)
+	    fi
 
 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
 
-- 
2.17.1




More information about the kernel-team mailing list