From: Shuah Khan <skhan@linuxfoundation.org>
To: Jiayuan Chen <mrpre@163.com>,
linux-kselftest@vger.kernel.org, Mark Brown <broonie@kernel.org>
Cc: song@kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
martin.lau@linux.dev, andrii@kernel.org, ast@kernel.org,
kpsingh@kernel.org, jolsa@kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH kselftest] fix single bpf test
Date: Fri, 22 Nov 2024 08:14:58 -0700 [thread overview]
Message-ID: <93d96c99-4712-4054-a36f-3c65c80ab3f8@linuxfoundation.org> (raw)
In-Reply-To: <20241118140608.53524-1-mrpre@163.com>
On 11/18/24 07:06, Jiayuan Chen wrote:
> Currently, when testing a certain target in selftests, executing the
> command 'make TARGETS=XX -C tools/testing/selftests' succeeds for non-BPF,
> but a similar command fails for BPF:
> '''
> make TARGETS=bpf -C tools/testing/selftests
>
> make: Entering directory '/linux-kselftest/tools/testing/selftests'
> make: *** [Makefile:197: all] Error 1
> make: Leaving directory '/linux-kselftest/tools/testing/selftests'
> '''
>
> The reason is that the previous commit:
> commit 7a6eb7c34a78 ("selftests: Skip BPF seftests by default")
> led to the default filtering of bpf in TARGETS which make TARGETS empty.
> That commit also mentioned that building BPF tests requires external
> commands to run. This caused target like 'bpf' or 'sched_ext' defined
> in SKIP_TARGETS to need an additional specification of SKIP_TARGETS as
> empty to avoid skipping it, for example:
> '''
> make TARGETS=bpf SKIP_TARGETS="" -C tools/testing/selftests
> '''
>
> If special steps are required to execute certain test, it is extremely
> unfair. We need a fairer way to treat different test targets.
>
Note: Adding Mark, author for commit 7a6eb7c34a78 to the thread
The reason we did this was bpf test depends on newer versions
of LLVM tool chain.
A better solution would be to check for compile time dependencies in
bpf Makefile and check run-time dependencies from bpf test or a wrapper
script invoked from run_tests to the skip the test if test can't run.
I would like to see us go that route over addressing this problem
with SKIP_TARGETS solution.
The commit 7a6eb7c34a78 went in 4 years ago? DO we have a better
story for the LLVM tool chain to get rid of skipping bpf and sched_ext?
Running make -C tools/testing/selftests/bpf/ gave me the following error.
Does this mean we still can't include bpf in default run?
make -C tools/testing/selftests/bpf/
make: Entering directory '/linux/linux_6.12/tools/testing/selftests/bpf'
Auto-detecting system features:
... llvm: [ OFF ]
GEN /linux/linux_6.12/tools/testing/selftests/bpf/tools/build/bpftool/vmlinux.h
libbpf: failed to find '.BTF' ELF section in /linux/linux_6.12/vmlinux
Error: failed to load BTF from /linux/linux_6.12/vmlinux: No data available
make[1]: *** [Makefile:209: /linux/linux_6.12/tools/testing/selftests/bpf/tools/build/bpftool/vmlinux.h] Error 195
make[1]: *** Deleting file '/linux/linux_6.12/tools/testing/selftests/bpf/tools/build/bpftool/vmlinux.h'
make: *** [Makefile:369: /linux/linux_6.12/tools/testing/selftests/bpf/tools/sbin/bpftool] Error 2
make: Leaving directory '/linux/linux_6.12/tools/testing/selftests/bpf'
> This commit provider a way: If a user has specified a single TARGETS,
> it indicates an expectation to run the specified target, and thus the
> object should not be skipped.
>
> Another way is to change TARGETS to DEFAULT_TARGETS in the Makefile and
> then check if the user specified TARGETS and decide whether filter or not,
> though this approach requires too many modifications.
> Signed-off-by: Jiayuan Chen <mrpre@163.com>
> ---
> tools/testing/selftests/Makefile | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 363d031a16f7..d76c1781ec09 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -116,7 +116,7 @@ TARGETS += vDSO
> TARGETS += mm
> TARGETS += x86
> TARGETS += zram
> -#Please keep the TARGETS list alphabetically sorted
> +# Please keep the TARGETS list alphabetically sorted
> # Run "make quicktest=1 run_tests" or
> # "make quicktest=1 kselftest" from top level Makefile
>
> @@ -132,12 +132,15 @@ endif
>
> # User can optionally provide a TARGETS skiplist. By default we skip
> # targets using BPF since it has cutting edge build time dependencies
> -# which require more effort to install.
> +# If user provide custom TARGETS, we just ignore SKIP_TARGETS so that
> +# user can easy to test single target which defined in SKIP_TARGETS
> SKIP_TARGETS ?= bpf sched_ext
> ifneq ($(SKIP_TARGETS),)
> +ifneq ($(words $(TARGETS)), 1)
> TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))
> override TARGETS := $(TMP)
> endif
> +endif
>
> # User can set FORCE_TARGETS to 1 to require all targets to be successfully
> # built; make will fail if any of the targets cannot be built. If
>
> base-commit: 67b6d342fb6d5abfbeb71e0f23141b9b96cf7bb1
thanks,
-- Shuah
next prev parent reply other threads:[~2024-11-22 15:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 14:06 [PATCH kselftest] fix single bpf test Jiayuan Chen
2024-11-22 15:14 ` Shuah Khan [this message]
2024-11-25 13:11 ` Mark Brown
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=93d96c99-4712-4054-a36f-3c65c80ab3f8@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=broonie@kernel.org \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mrpre@163.com \
--cc=netdev@vger.kernel.org \
--cc=song@kernel.org \
/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