kselftest/arm64: signal: copy each test binary only once
PATCH 1/1 kselftest/arm64: signal: copy each test binary only once
The signal tests are built in testcases/ and then copied to the output directory. The copy rule lists every generated program as a target and copies all of them in each recipe:
$(TEST_GEN_PROGS): $(PROGS)
cp $(PROGS) $(OUTPUT)/In a parallel build make runs that recipe once for each program, so several cp processes write the same destination files at the same time. cp then fails with "cannot create regular file ...: File exists", which fails the arm64 build even though every test compiled. A cross build of the arm64 signal tests at -j8 hit this in all of 8 runs.
Use a static pattern rule so that each output depends on, and copies, only its own binary.
--- tools/testing/selftests/arm64/signal/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/arm64/signal/Makefile +2 -2
@@ -17,8 +17,8 @@ TEST_GEN_PROGS := $(notdir $(PROGS)) # the toplevel makefile include ../../lib.mk -$(TEST_GEN_PROGS): $(PROGS) - cp $(PROGS) $(OUTPUT)/ +$(TEST_GEN_PROGS): $(OUTPUT)/%: testcases/% + cp $< $@ # Common test-unit targets to build common-layout test-cases executables # Needs secondary expansion to properly include the testcase c-file in pre-reqs
base-commit: 4eb2586bd40db27d77cc5b724ca9386ed0c71d53
Signature · 1 line
2.53.0
Catalin Marinas
maintainerQuoted 8 lines · Sasha Levin
The signal tests are built in testcases/ and then copied to the output directory. The copy rule lists every generated program as a target and copies all of them in each recipe:
$(TEST_GEN_PROGS): $(PROGS) cp $(PROGS) $(OUTPUT)/[...]
Applied to arm64 (for-next/kselftest), thanks!
[1/1] kselftest/arm64: signal: copy each test binary only once
https://git.kernel.org/arm64/c/7b3b147c4104
Quoted 3 lines · Sasha Levin
The signal tests are built in testcases/ and then copied to the output directory. The copy rule lists every generated program as a target and copies all of them in each recipe:
The build stuff for the signal testcases is a menance, it's being far too cute.
tools/testing/selftests/arm64/signal/Makefile TEST_GEN_PROGS := $(notdir $(PROGS)) · line 21
Quoted 4 lines
-$(TEST_GEN_PROGS): $(PROGS)
tools/testing/selftests/arm64/signal/Makefile +2
-1- cp $(PROGS) $(OUTPUT)/ +$(TEST_GEN_PROGS): $(OUTPUT)/%: testcases/% + cp $< $@
You'd have thought that'd be clearer with two separate rules but the obvious doesn't work and we're already being so clever I think this is fine: