Message ID | 20201215182011.15755-1-kamal@canonical.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | BPF |
Headers | show |
Series | [v2] selftests/bpf: clarify build error if no vmlinux | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Tue, Dec 15, 2020 at 10:20 AM Kamal Mostafa <kamal@canonical.com> wrote: > > If Makefile cannot find any of the vmlinux's in its VMLINUX_BTF_PATHS list, > it tries to run btftool incorrectly, with VMLINUX_BTF unset: > > bpftool btf dump file $(VMLINUX_BTF) format c > > Such that the keyword 'format' is misinterpreted as the path to vmlinux. > The resulting build error message is fairly cryptic: > > GEN vmlinux.h > Error: failed to load BTF from format: No such file or directory > > This patch makes the failure reason clearer by yielding this instead: > > Makefile:...: *** cannot find a vmlinux for VMLINUX_BTF at any of > "{paths}". Stop. > > Fixes: acbd06206bbb ("selftests/bpf: Add vmlinux.h selftest exercising tracing of syscalls") > Cc: stable@vger.kernel.org # 5.7+ > Signed-off-by: Kamal Mostafa <kamal@canonical.com> > --- Applied to bpf tree, thanks. This conflicted with a67079b03165 ("selftests/bpf: fix bpf_testmod.ko recompilation logic"), I resolved the conflict and capitalized "Cannot" in the error message. > > [v2] moves the check to right after the VMLINUX_BTF definition. > > tools/testing/selftests/bpf/Makefile | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index 542768f5195b..7ba631f495f7 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -146,6 +146,9 @@ VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \ > /sys/kernel/btf/vmlinux \ > /boot/vmlinux-$(shell uname -r) > VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))) > +ifeq ($(VMLINUX_BTF),) > +$(error cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)") > +endif > > DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool > > -- > 2.17.1 >
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 542768f5195b..7ba631f495f7 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -146,6 +146,9 @@ VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \ /sys/kernel/btf/vmlinux \ /boot/vmlinux-$(shell uname -r) VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))) +ifeq ($(VMLINUX_BTF),) +$(error cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)") +endif DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
If Makefile cannot find any of the vmlinux's in its VMLINUX_BTF_PATHS list, it tries to run btftool incorrectly, with VMLINUX_BTF unset: bpftool btf dump file $(VMLINUX_BTF) format c Such that the keyword 'format' is misinterpreted as the path to vmlinux. The resulting build error message is fairly cryptic: GEN vmlinux.h Error: failed to load BTF from format: No such file or directory This patch makes the failure reason clearer by yielding this instead: Makefile:...: *** cannot find a vmlinux for VMLINUX_BTF at any of "{paths}". Stop. Fixes: acbd06206bbb ("selftests/bpf: Add vmlinux.h selftest exercising tracing of syscalls") Cc: stable@vger.kernel.org # 5.7+ Signed-off-by: Kamal Mostafa <kamal@canonical.com> --- [v2] moves the check to right after the VMLINUX_BTF definition. tools/testing/selftests/bpf/Makefile | 3 +++ 1 file changed, 3 insertions(+)