[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241118140608.53524-1-mrpre@163.com>
Date: Mon, 18 Nov 2024 22:06:08 +0800
From: Jiayuan Chen <mrpre@....com>
To: skhan@...uxfoundation.org,
linux-kselftest@...r.kernel.org
Cc: song@...nel.org,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
martin.lau@...ux.dev,
andrii@...nel.org,
ast@...nel.org,
kpsingh@...nel.org,
jolsa@...nel.org,
Jiayuan Chen <mrpre@....com>
Subject: [PATCH kselftest] fix single bpf test
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.
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@....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
--
2.43.5
Powered by blists - more mailing lists