Re: [PATCH bpf-next v1 14/14] selftests/bpf: Check BPFTOOL env var in detect_bpftool_path()
From: Alexis Lothoré
Date: Fri Feb 13 2026 - 05:37:07 EST
Hi Ihor,
On Thu Feb 12, 2026 at 2:13 AM CET, Ihor Solodrai wrote:
> The bpftool_maps_access and bpftool_metadata tests may fail on BPF CI
> with "command not found", depending on a workflow.
> This happens because detect_bpftool_path() only checks two hardcoded
> relative paths:
> - ./tools/sbin/bpftool
> - ../tools/sbin/bpftool
>
> Add support for a BPFTOOL environment variable that allows specifying
> the exact path to the bpftool binary.
>
> Also replace strncpy() with snprintf() for proper null-termination.
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
LGTM, thanks for the improvement.
For the record, another issue that this path harcoding is aiming to
solve is that we definitely want a full bpftool binary (as those bpftool
helpers are used to find the binary under test), and not a _bootstrap_
version, which only exposes a few subcommands instead of the whole set.
So I'd say that it is not an issue yet, but it may be worth in the
future to enrich the checks in detect_bpftool_path to make sure that any
bpftool binary path provided by BPFTOOL env var is not pointing to a
bootstrap version.
Alexis
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com