[tip: core/rseq] selftests/rseq: Select only implemented architecture variants
From: tip-bot2 for Sasha Levin
Date: Sun Nov 08 2026 - 07:43:44 EST
The following commit has been merged into the core/rseq branch of tip:
Commit-ID: 9ad0f2d93caf9b1b70c3f239e72b241313caa21f
Gitweb: https://git.kernel.org/tip/9ad0f2d93caf9b1b70c3f239e72b241313caa21f
Author: Sasha Levin <sashal@xxxxxxxxxx>
AuthorDate: Wed, 14 Oct 2026 16:01:57 -04:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Sun, 08 Nov 2026 13:41:53 +01:00
selftests/rseq: Select only implemented architecture variants
The rseq headers implement a limited set of targets, and only the
little-endian ARM, arm64 and RISC-V variants. Building the suite for
LoongArch or for the unsupported endian variants fails in the
architecture dispatch of rseq.h.
Ask the target compiler which architecture it builds for before
selecting the tests and scripts, so that unsupported targets build,
install and emit an empty runlist through the ordinary lib.mk rules.
Pass USERCFLAGS to the probe as well, since lib.mk expands the
generated program lists before it appends USERCFLAGS to CFLAGS, and
filter out only the linker options that the preprocessor would warn
about. If the compiler cannot be run, select the tests so that the
build fails instead of turning the problem into an empty suite.
This does not add LoongArch support and does not address the remaining
compiler-specific build failures on supported targets.
Fixes: ccba8b64452b ("rseq/selftests: Provide Makefile, scripts, gitignore")
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20261014200157.1365258-1-sashal@xxxxxxxxxx
---
tools/testing/selftests/rseq/Makefile | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/rseq/Makefile b/tools/testing/selftests/rseq/Makefile
index 977da55..ce8721e 100644
--- a/tools/testing/selftests/rseq/Makefile
+++ b/tools/testing/selftests/rseq/Makefile
@@ -18,10 +18,22 @@ LDLIBS += -lpthread -ldl
# still track changes to header files and depend on shared object.
OVERRIDE_TARGETS = 1
-TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \
+comma := ,
+RSEQ_ARCH_SUPPORTED = $(shell printf '\043if defined(__x86_64__) || defined(__i386__) || \
+ defined(__ARMEL__) || defined(__AARCH64EL__) || \
+ defined(__PPC__) || defined(__mips__) || defined(__s390__) || \
+ defined(__or1k__) || (defined(__riscv) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)\n1\n\043endif\n' | \
+ $(filter-out -fuse-ld=%,$(CC)) $(filter-out -L% -Wl$(comma)%,$(CFLAGS) $(USERCFLAGS)) \
+ -E -P -x c - || echo 1)
+
+TEST_GEN_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS))
+TEST_GEN_PROGS_EXTENDED = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS_EXTENDED))
+TEST_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_PROGS))
+
+RSEQ_TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \
param_test_benchmark param_test_mm_cid_benchmark
-TEST_GEN_PROGS_EXTENDED = librseq.so \
+RSEQ_TEST_GEN_PROGS_EXTENDED = librseq.so \
param_test \
param_test_compare_twice \
param_test_mm_cid \
@@ -31,7 +43,7 @@ TEST_GEN_PROGS_EXTENDED = librseq.so \
slice_test \
check_optimized
-TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh
+RSEQ_TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh
TEST_FILES := settings