Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: fix ARCH normalization to handle command-line argument

Several selftests Makefiles (e.g. prctl, breakpoints, etc) attempt to
normalize the ARCH variable by converting x86_64 and i.86 to x86.
However, it uses the conditional assignment operator '?='.

When ARCH is passed as a command-line argument (e.g., during an rpmbuild
process), the '?=' operator ignores the shell command and the sed
transformation. This leads to an incorrect ARCH value being used, which
causes build failures

# make -C tools/testing/selftests TARGETS=prctl ARCH=x86_64
make: Entering directory '/build/tools/testing/selftests'
make[1]: Entering directory '/build/tools/testing/selftests/prctl'
make[1]: *** No targets. Stop.
make[1]: Leaving directory '/build/tools/testing/selftests/prctl'
make: *** [Makefile:197: all] Error 2

Change the assignment to use 'override' and ':=' to ensure the
normalization logic is applied regardless of how the ARCH variable was
initially defined.

Link: https://lkml.kernel.org/r/20260309205145.572778-1-aleksey.oladko@virtuozzo.com
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
Cc: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Aleksei Oladko and committed by
Andrew Morton
5a129213 8cdf3081

+14 -14
+2 -2
tools/testing/selftests/breakpoints/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Taken from perf makefile 3 - uname_M := $(shell uname -m 2>/dev/null || echo not) 4 - ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 3 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 4 + override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 5 5 6 6 TEST_GEN_PROGS := step_after_suspend_test 7 7
+4 -4
tools/testing/selftests/ipc/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - uname_M := $(shell uname -m 2>/dev/null || echo not) 3 - ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) 2 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 3 + override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/) 4 4 ifeq ($(ARCH),i386) 5 - ARCH := x86 5 + override ARCH := x86 6 6 CFLAGS := -DCONFIG_X86_32 -D__i386__ 7 7 endif 8 8 ifeq ($(ARCH),x86_64) 9 - ARCH := x86 9 + override ARCH := x86 10 10 CFLAGS := -DCONFIG_X86_64 -D__x86_64__ 11 11 endif 12 12
+2 -2
tools/testing/selftests/prctl/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 ifndef CROSS_COMPILE 3 - uname_M := $(shell uname -m 2>/dev/null || echo not) 4 - ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 3 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 4 + override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 5 5 6 6 ifeq ($(ARCH),x86) 7 7 TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
+2 -2
tools/testing/selftests/sparc64/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - uname_M := $(shell uname -m 2>/dev/null || echo not) 3 - ARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/) 2 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 3 + override ARCH := $(shell echo $(ARCH) | sed -e s/x86_64/x86/) 4 4 5 5 ifneq ($(ARCH),sparc64) 6 6 nothing:
+2 -2
tools/testing/selftests/thermal/intel/power_floor/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 ifndef CROSS_COMPILE 3 - uname_M := $(shell uname -m 2>/dev/null || echo not) 4 - ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 3 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 4 + override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 5 5 6 6 ifeq ($(ARCH),x86) 7 7 TEST_GEN_PROGS := power_floor_test
+2 -2
tools/testing/selftests/thermal/intel/workload_hint/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 ifndef CROSS_COMPILE 3 - uname_M := $(shell uname -m 2>/dev/null || echo not) 4 - ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 3 + ARCH ?= $(shell uname -m 2>/dev/null || echo not) 4 + override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/) 5 5 6 6 ifeq ($(ARCH),x86) 7 7 TEST_GEN_PROGS := workload_hint_test