From: Sasha Levin <sashal@kernel.org>
To: Shuah Khan <shuah@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] selftests/prctl: build generated tests for the target architecture
Date: Wed, 14 Oct 2026 16:01:23 -0400 [thread overview]
Message-ID: <20261014200127.1363472-2-sashal@kernel.org> (raw)
In-Reply-To: <20261014200127.1363472-1-sashal@kernel.org>
The prctl Makefile builds nothing when CROSS_COMPILE is set, even when
the target is x86, and it lists its compiled programs in TEST_PROGS,
which lib.mk treats as source-tree scripts. The binaries are therefore
built into the source directory rather than OUTPUT. The architecture
check also restricts set-anon-vma-name-test and set-process-name to x86
although neither depends on the architecture.
Build the programs as TEST_GEN_PROGS, build the two generic tests on
every architecture, and keep only the TSC tests x86 specific. Select
them from the target ARCH when it is given and from the host's SUBARCH
otherwise, using a private ARCH_PROCESSED instead of overriding ARCH.
The override added by commit 5a1292137e89 ("selftests: fix ARCH
normalization to handle command-line argument") changed the value that
lib.mk uses to choose the clang target: leaving ARCH unset again lets
lib.mk use the compiler's native triple. A command-line ARCH such as
x86_64 is still normalized for the TSC test selection, while an ARCH
spelling that lib.mk does not know, such as i686 with LLVM=1, is
rejected in the same way as for the other selftests.
Fixes: f59514b6a8c5 ("Documentation/prctl: don't build tsc tests when cross compiling")
Fixes: 5290586186d2 ("selftests: prctl: Add new prctl test for PR_SET_VMA action")
Fixes: e0606daeaab4 ("selftests: prctl: Add new prctl test for PR_SET_NAME")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/prctl/Makefile | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/prctl/Makefile b/tools/testing/selftests/prctl/Makefile
index e770e86fad9ac..123f884e9dfa5 100644
--- a/tools/testing/selftests/prctl/Makefile
+++ b/tools/testing/selftests/prctl/Makefile
@@ -1,14 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef CROSS_COMPILE
-ARCH ?= $(shell uname -m 2>/dev/null || echo not)
-override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+top_srcdir = ../../../..
+include $(top_srcdir)/scripts/subarch.include
+ARCH_PROCESSED := $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
-ifeq ($(ARCH),x86)
-TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
- disable-tsc-test set-anon-vma-name-test set-process-name
-all: $(TEST_PROGS)
+TEST_GEN_PROGS := set-anon-vma-name-test set-process-name
+ifeq ($(ARCH_PROCESSED),x86)
+TEST_GEN_PROGS += disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
+ disable-tsc-test
+endif
include ../lib.mk
-
-endif
-endif
--
2.53.0
next prev parent reply other threads:[~2026-10-14 20:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 20:01 [PATCH 0/5] selftests: target selection fixes for cross and LLVM builds Sasha Levin
2026-10-14 20:01 ` Sasha Levin [this message]
2026-10-14 20:01 ` [PATCH 2/5] selftests/prctl: skip the anonymous VMA naming test when unsupported Sasha Levin
2026-10-14 20:01 ` [PATCH 3/5] selftests/thermal: allow cross builds of the Intel tests Sasha Levin
2026-10-14 20:01 ` [PATCH 4/5] selftests/kexec: select tests using the target compiler Sasha Levin
2026-10-14 20:01 ` [PATCH 5/5] selftests/size: use nolibc startup and syscall wrappers Sasha Levin
2026-10-14 20:51 ` Thomas Weißschuh
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=20261014200127.1363472-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@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