BPF List
 help / color / mirror / Atom feed
From: "Ricardo B. Marlière" <rbm@suse.com>
To: "Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>,
	"Ricardo B. Marlière" <rbm@suse.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Shuah Khan" <shuah@kernel.org>,
	"Christian Brauner" <brauner@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] selftests/bpf: Install bpftool where test_progs expects to find it
Date: Fri, 17 Jul 2026 14:03:16 -0300	[thread overview]
Message-ID: <DK10BPLJ94CD.153PFYJP3M2Z8@suse.com> (raw)
In-Reply-To: <f3a5c7dc-6731-4a3e-b8bd-909c0fff4520@linux.dev>

On Thu Jul 16, 2026 at 6:09 PM -03, Ihor Solodrai wrote:
> On 7/13/26 8:32 AM, Alexis Lothoré wrote:
>> Hi,
>> 
>> On Sat Jul 11, 2026 at 12:09 AM CEST, Ricardo B. Marlière wrote:
>>> bpftool_helpers.c looks for bpftool at "tools/sbin/bpftool" or
>>> "../tools/sbin/bpftool" relative to the running test_progs binary, matching
>>> the build directory layout where bpftool sits at
>>> $(OUTPUT)/tools/sbin/bpftool.
>>>
>>> INSTALL_RULE installs bpftool through the generic TEST_GEN_PROGS_EXTENDED
>>> mechanism, which flattens it straight into $(INSTALL_PATH) and loses the
>>> tools/sbin/ prefix. After "make install", every flavor of test_progs,
>>> including the default one, fails to locate bpftool, and bpftool_maps_access
>>> and bpftool_metadata error out with "Failed to detect bpftool path", even
>>> though bpftool itself built and installed fine.
>>>
>>> Explicitly install bpftool under tools/sbin/ in the installed tree
>>> so its relative location matches what detect_bpftool_path() already
>>> expects, restoring the pre-install layout instead of introducing a
>>> new one.
>>>
>>> Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
>>> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
>> 
>> I did not face the issue because I am running the selftests in-tree, and
>> the CI seems to do the same, but for users using selftests after running
>> `make install`, I guess the change makes sense.
>> 
>> That's not the first fix aiming to improve bpftool
>> detection/installation (eg the BPFTOOL env variable, see [1]), so it
>> makes me wonder if we shouldn't just make bpftool part of
>> TRUNNER_EXTRA_FILES for all flavours of test_progs, similarly to other
>> binaries needed during tests (eg: urandom_read), instead of just adding
>> some bpftool-specific details in this generic install rule, and just
>> make the test runners assume that the needed binary is in the same
>> directory.
>
> Alexis, using TRUNNER_EXTRA_FILES is a bit worse because that would
> copy bpftool into every flavor subdir. I think just doing a single
> rsync on install is fine.
>
>> 
>> Alexis
>> 
>> [1] https://lore.kernel.org/all/20260223191118.655185-2-ihor.solodrai@linux.dev/
>> 
>>> ---
>>>  tools/testing/selftests/bpf/Makefile | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>>> index b642ee489ea6..47911c9b4977 100644
>>> --- a/tools/testing/selftests/bpf/Makefile
>>> +++ b/tools/testing/selftests/bpf/Makefile
>>> @@ -1055,6 +1055,8 @@ endif
>>>  DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
>>>  override define INSTALL_RULE
>>>  	$(DEFAULT_INSTALL_RULE)
>>> +	@mkdir -p $(INSTALL_PATH)/tools/sbin
>>> +	@rsync -a $(if $(PERMISSIVE),--ignore-missing-args) $(TRUNNER_BPFTOOL) $(INSTALL_PATH)/tools/sbin/
>
>
> It looks like we still have a redundant copy of bpftool because of:
>
> selftests/bpf/Makefile:327
>
>         TEST_GEN_PROGS_EXTENDED += $(TRUNNER_BPFTOOL)
>
> selftets/lib.mk:153
>
>         $(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE)
>
> Ricardo, does it makes sense to remove it with your fix?

I'll check and send v2 accordingly

>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 7260d672acf7..c776913bc32f 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -324,8 +324,6 @@ TRUNNER_BPFTOOL := $(DEFAULT_BPFTOOL)
>  USE_BOOTSTRAP := "bootstrap/"
>  endif
>  
> -TEST_GEN_PROGS_EXTENDED += $(TRUNNER_BPFTOOL)
> -
>  $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
>  
>  TESTING_HELPERS        := $(OUTPUT)/testing_helpers.o
>
>>>  	@for DIR in $(TEST_INST_SUBDIRS); do				  \
>>>  		mkdir -p $(INSTALL_PATH)/$$DIR;				  \
>>>  		rsync -a $(if $(PERMISSIVE),--ignore-missing-args)	  \
>> 
>> 
>> 
>> 



  reply	other threads:[~2026-07-17 17:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 22:09 [PATCH 0/4] selftests/bpf: A few edge case fixes Ricardo B. Marlière
2026-07-10 22:09 ` [PATCH 1/4] selftests/bpf: Install bpftool where test_progs expects to find it Ricardo B. Marlière
2026-07-13 15:32   ` Alexis Lothoré
2026-07-15 21:40     ` Ricardo B. Marlière
2026-07-16 21:09     ` Ihor Solodrai
2026-07-17 17:03       ` Ricardo B. Marlière [this message]
2026-07-10 22:09 ` [PATCH 2/4] selftests/bpf: Install resolve_btfids.test.o.BTF where the test expects it Ricardo B. Marlière
2026-07-16 21:10   ` Ihor Solodrai
2026-07-17 17:02     ` Ricardo B. Marlière
2026-07-10 22:09 ` [PATCH 3/4] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch Ricardo B. Marlière
2026-07-16 21:11   ` Ihor Solodrai
2026-07-17 17:02     ` Ricardo B. Marlière
2026-07-10 22:09 ` [PATCH 4/4] libbpf: Search /lib64 and /lib in resolve_full_path() Ricardo B. Marlière
2026-07-10 22:58   ` bot+bpf-ci
2026-07-16 21:12   ` Ihor Solodrai
2026-07-16 21:07 ` [PATCH 0/4] selftests/bpf: A few edge case fixes Ihor Solodrai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DK10BPLJ94CD.153PFYJP3M2Z8@suse.com \
    --to=rbm@suse.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox