From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: "Ricardo B. Marlière (SUSE)" <ricardo@marliere.net>,
"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>
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] selftests/bpf: Route test_kmods build artifacts to OUTPUT
Date: Thu, 6 Aug 2026 13:35:36 -0700 [thread overview]
Message-ID: <de5afc86-fad5-4140-bdde-4da54e92915e@linux.dev> (raw)
In-Reply-To: <20260728-selftests-bpf_oot-v1-3-05feb15d94db@marliere.net>
On 7/28/26 5:06 PM, Ricardo B. Marlière (SUSE) wrote:
> [...]
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 7d42632f9d42..b150a66f3c25 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -135,6 +135,9 @@ TEST_PROGS_EXTENDED := \
> TEST_KMODS := bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
> bpf_test_modorder_y.ko bpf_test_rqspinlock.ko
> TEST_KMOD_TARGETS = $(addprefix $(OUTPUT)/,$(TEST_KMODS))
> +# Build directory for kernel modules: routed to $(OUTPUT)/test_kmods when
> +# OUTPUT is set so that kbuild intermediates stay out of the source tree.
> +TEST_KMODS_OUTDIR := $(if $(OUTPUT),$(OUTPUT)/test_kmods,test_kmods)
>
> # Compile but not part of 'make run_tests'
> TEST_GEN_PROGS_EXTENDED = \
> @@ -163,8 +166,8 @@ override define CLEAN
> $(Q)$(RM) -r $(TEST_GEN_FILES)
> $(Q)$(RM) -r $(TEST_KMODS)
> $(Q)$(RM) -r $(EXTRA_CLEAN)
> - $(Q)$(MAKE) -C test_kmods clean
> - $(Q)$(MAKE) -C libarena clean
> + $(Q)$(MAKE) -C test_kmods $(if $(OUTPUT),OUTPUT=$(OUTPUT)/test_kmods) clean
> + $(Q)$(MAKE) -C libarena $(if $(OUTPUT),OUTPUT=$(OUTPUT)/libarena) clean
This is broken. What happens if the caller set OUTPUT but not O= ?
If at linux root you do:
$ make defconfig && make -j$(nproc)
$ mkdir -p /tmp/kout
$ make -C tools/testing/selftests/bpf OUTPUT=/tmp/kout clean
it destroys the root Makefile:
$ git diff --stat -- Makefile
Makefile | 2364 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 file changed, 5 insertions(+), 2359 deletions(-)
$ cat Makefile
# Automatically generated by /home/isolodrai/sandbox/2026-08-06.review.out-of-tree-fixes/linux/Makefile: don't edit
export KBUILD_OUTPUT = /home/isolodrai/sandbox/2026-08-06.review.out-of-tree-fixes/linux
export KBUILD_EXTMOD = /home/isolodrai/sandbox/2026-08-06.review.out-of-tree-fixes/linux/tools/testing/selftests/bpf/test_kmods
export KBUILD_EXTMOD_OUTPUT = /tmp/kout/test_kmods
include /home/isolodrai/sandbox/2026-08-06.review.out-of-tree-fixes/linux/Makefile
pw-bot: cr
Also the selftests clean loop runs clean rules this way [1]:
clean:
@for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/Makefile?h=v7.2-rc6#n325
> $(Q)$(MAKE) docs-clean
> endef
>
> [...]
>
next prev parent reply other threads:[~2026-08-06 20:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 0:06 [PATCH 0/3] selftests/bpf: Fixes for out-of-tree builds Ricardo B. Marlière (SUSE)
2026-07-29 0:06 ` [PATCH 1/3] selftests/bpf: Route generated test headers to OUTPUT Ricardo B. Marlière (SUSE)
2026-08-06 20:32 ` Ihor Solodrai
2026-07-29 0:06 ` [PATCH 2/3] selftests/bpf: Route libarena build artifacts " Ricardo B. Marlière (SUSE)
2026-08-06 20:33 ` Ihor Solodrai
2026-07-29 0:06 ` [PATCH 3/3] selftests/bpf: Route test_kmods " Ricardo B. Marlière (SUSE)
2026-08-06 20:35 ` Ihor Solodrai [this message]
2026-08-06 20:29 ` [PATCH 0/3] selftests/bpf: Fixes for out-of-tree builds Ihor Solodrai
2026-08-06 20:47 ` Ricardo B. Marlière
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=de5afc86-fad5-4140-bdde-4da54e92915e@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--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=ricardo@marliere.net \
--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