Message ID | 20200507155824.9160-1-kamal@canonical.com |
---|---|
State | New |
Headers | show |
Series | [Unstable/oem-5.6] UBUNTU: SAUCE: skip building selftest 'runqslower' if kernel not built | expand |
On 7.5.2020 18.58, Kamal Mostafa wrote: > 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@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) > > yep, makes sense, thanks!
On Thu, May 07, 2020 at 08:58:24AM -0700, Kamal Mostafa wrote: > 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@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 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
Applied to oem-5.6-next. On Thu, May 07, 2020 at 08:58:24AM -0700, Kamal Mostafa wrote: > 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@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 >
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)
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@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(-)