Currently the arm64 selftests don't support building with O=, this series fixes that, bringing them more into line with how the kselftest Makefiles want to work.
v3: - Rebase onto arm64/for-next/core. v2: - Rebase onto v5.18-rc3.
Mark Brown (4): selftests/arm64: Use TEST_GEN_PROGS_EXTENDED in the FP Makefile selftests/arm64: Define top_srcdir for the fp tests selftests/arm64: Clean the fp helper libraries selftests/arm64: Fix O= builds for the floating point tests
tools/testing/selftests/arm64/fp/Makefile | 49 ++++++++++++----------- 1 file changed, 26 insertions(+), 23 deletions(-)
base-commit: 5c346f94d2933ba320af8325cfe77fc58c6e537a
The kselftest lib.mk provides a default all target which builds additional programs from TEST_GEN_PROGS_EXTENDED, use that rather than using TEST_PROGS_EXTENDED which is for programs that don't need to be built like shell scripts. Leave fpsimd-stress and sve-stress there since they are scripts.
Signed-off-by: Mark Brown broonie@kernel.org --- tools/testing/selftests/arm64/fp/Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index 95e707e32247..a0b8cc59947e 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -2,14 +2,13 @@
CFLAGS += -I../../../../../usr/include/ TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg za-fork za-ptrace -TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \ +TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \ rdvl-sme rdvl-sve \ - sve-test sve-stress \ - ssve-test ssve-stress \ - za-test za-stress \ + sve-test \ + ssve-test \ + za-test \ vlset - -all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED) +TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress
# Build with nolibc to avoid effects due to libc's clone() support fp-pidbench: fp-pidbench.S asm-utils.o
Some of the rules in lib.mk use a top_srcdir variable to figure out where the top of the kselftest tree is, provide it.
Signed-off-by: Mark Brown broonie@kernel.org --- tools/testing/selftests/arm64/fp/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index a0b8cc59947e..ba758a6c6b9a 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -1,6 +1,10 @@ # SPDX-License-Identifier: GPL-2.0
-CFLAGS += -I../../../../../usr/include/ +# A proper top_srcdir is needed by KSFT(lib.mk) +top_srcdir = $(realpath ../../../../../) + +CFLAGS += -I$(top_srcdir)/usr/include/ + TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg za-fork za-ptrace TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \ rdvl-sme rdvl-sve \
We provide a couple of object files with helpers linked into several of the test programs, ensure they are cleaned.
Signed-off-by: Mark Brown broonie@kernel.org --- tools/testing/selftests/arm64/fp/Makefile | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index ba758a6c6b9a..7e5d48c4a59d 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -14,6 +14,8 @@ TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \ vlset TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress
+EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o + # Build with nolibc to avoid effects due to libc's clone() support fp-pidbench: fp-pidbench.S asm-utils.o $(CC) -nostdlib $^ -o $@
Currently the arm64 floating point tests don't support out of tree builds due to two quirks of the kselftest build system. One is that when building a program from multiple files we shouldn't separately compile the main program to an object file as that will result in the pattern rule not matching when adjusted for the output directory. The other is that we also need to include $(OUTPUT) in the names of the binaries when specifying the dependencies in order to ensure that they get picked up with O=.
Rewrite the dependencies for the executables to fix these issues. The kselftest build system will ensure OUTPUT is always defined.
Signed-off-by: Mark Brown broonie@kernel.org --- tools/testing/selftests/arm64/fp/Makefile | 32 +++++++++++------------ 1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index 7e5d48c4a59d..a7c2286bf65b 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -17,28 +17,26 @@ TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o
# Build with nolibc to avoid effects due to libc's clone() support -fp-pidbench: fp-pidbench.S asm-utils.o +$(OUTPUT)/fp-pidbench: fp-pidbench.S $(OUTPUT)/asm-utils.o $(CC) -nostdlib $^ -o $@ -fpsimd-test: fpsimd-test.o asm-utils.o +$(OUTPUT)/fpsimd-test: fpsimd-test.S $(OUTPUT)/asm-utils.o $(CC) -nostdlib $^ -o $@ -rdvl-sme: rdvl-sme.o rdvl.o -rdvl-sve: rdvl-sve.o rdvl.o -sve-ptrace: sve-ptrace.o -sve-probe-vls: sve-probe-vls.o rdvl.o -sve-test: sve-test.o asm-utils.o +$(OUTPUT)/rdvl-sve: rdvl-sve.c $(OUTPUT)/rdvl.o +$(OUTPUT)/rdvl-sme: rdvl-sme.c $(OUTPUT)/rdvl.o +$(OUTPUT)/sve-ptrace: sve-ptrace.c +$(OUTPUT)/sve-probe-vls: sve-probe-vls.c $(OUTPUT)/rdvl.o +$(OUTPUT)/sve-test: sve-test.S $(OUTPUT)/asm-utils.o $(CC) -nostdlib $^ -o $@ -ssve-test: sve-test.S asm-utils.o +$(OUTPUT)/ssve-test: sve-test.S $(OUTPUT)/asm-utils.o $(CC) -DSSVE -nostdlib $^ -o $@ -vec-syscfg: vec-syscfg.o rdvl.o -vlset: vlset.o -za-fork: za-fork.o za-fork-asm.o - $(CC) -nostdlib -static $^ -o $@ -lgcc -za-fork.o: za-fork.c - $(CC) -c -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \ +$(OUTPUT)/vec-syscfg: vec-syscfg.c $(OUTPUT)/rdvl.o +$(OUTPUT)/vlset: vlset.c +$(OUTPUT)/za-fork: za-fork.c $(OUTPUT)/za-fork-asm.o + $(CC) -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \ -include ../../../../include/nolibc/nolibc.h \ - -ffreestanding -Wall $^ -o $@ -za-test: za-test.o asm-utils.o + -static -ffreestanding -Wall $^ -o $@ +$(OUTPUT)/za-ptrace: za-ptrace.c +$(OUTPUT)/za-test: za-test.S $(OUTPUT)/asm-utils.o $(CC) -nostdlib $^ -o $@ -za-ptrace: za-ptrace.o
include ../../lib.mk
On Wed, 27 Apr 2022 19:19:50 +0100, Mark Brown wrote:
Currently the arm64 selftests don't support building with O=, this series fixes that, bringing them more into line with how the kselftest Makefiles want to work.
v3:
- Rebase onto arm64/for-next/core.
v2:
- Rebase onto v5.18-rc3.
[...]
Applied to arm64 (for-next/kselftest), thanks!
[1/4] selftests/arm64: Use TEST_GEN_PROGS_EXTENDED in the FP Makefile https://git.kernel.org/arm64/c/a59f7a7f7640 [2/4] selftests/arm64: Define top_srcdir for the fp tests https://git.kernel.org/arm64/c/3a23a42d1a48 [3/4] selftests/arm64: Clean the fp helper libraries https://git.kernel.org/arm64/c/399cf0a3e8a1 [4/4] selftests/arm64: Fix O= builds for the floating point tests https://git.kernel.org/arm64/c/aca43ad51661
linux-kselftest-mirror@lists.linaro.org