Skip to contentSkip to conversation

selftests/powerpc: override EMIT_TESTS instead of the emit_tests rule

PATCH Applied Sasha Levin 3 participants 3 messages Nov 3 – Nov 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/powerpc: override EMIT_TESTS instead of the emit_tests rule

The powerpc Makefiles include lib.mk and then define their own emit_tests rule, so every selftests build that includes powerpc warns, on any architecture:

Makefile:60: warning: overriding recipe for target 'emit_tests' ../lib.mk:183: warning: ignoring old recipe for target 'emit_tests'

lib.mk used to keep the recipe in an EMIT_TESTS variable that Makefiles could override, as they still do with RUN_TESTS, INSTALL_RULE and CLEAN. Commit d4e59a536f50 ("selftests: Use runner.sh for emit targets") dropped the variable, and commit 58b33e78a317 ("selftests/powerpc: Fix emit_tests to work with run_kselftest.sh") then replaced the powerpc EMIT_TESTS definitions with rules.

Bring EMIT_TESTS back in lib.mk and override it in the powerpc Makefiles again. Mark the lib.mk recipe with '+', so that the powerpc sub-makes still get the jobserver, as they did when $(MAKE) was in the rule itself. The emitted test lists don't change.

Fixes 58b33e78a317 ("selftests/powerpc: Fix emit_tests to work with run_kselftest.sh")

---
Checked with "make ARCH=powerpc emit_tests" in tools/testing/selftests/powerpc, which lists the same 186 tests as before, and with an x86_64 selftests install, whose kselftest-list.txt doesn't change. make -j2 --jobserver-style=pipe doesn't warn about the jobserver.

 tools/testing/selftests/lib.mk               | 6 +++++-
 tools/testing/selftests/powerpc/Makefile     | 3 ++-
 tools/testing/selftests/powerpc/pmu/Makefile | 3 ++-
 3 files changed, 9 insertions(+), 3 deletions(-)
tools/testing/selftests/lib.mk +5 -1
index 881f13ee2c8ac..506cb26510e4d 100644
@@ -179,11 +179,15 @@ else
 	$(error Error: set INSTALL_PATH to use install)
 endif
 
-emit_tests:
+define EMIT_TESTS
 	for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
 		BASENAME_TEST=`basename $$TEST`;	\
 		echo "$(COLLECTION):$$BASENAME_TEST";	\
 	done
+endef
+
+emit_tests:
+	+$(EMIT_TESTS)
 
 # define if isn't already. It is undefined in make O= case.
 ifeq ($(RM),)
tools/testing/selftests/powerpc/Makefile +2 -1
index b175e94e1901d..aeab9366d09bf 100644
@@ -56,11 +56,12 @@ override define INSTALL_RULE
 	done;
 endef
 
-emit_tests:
+override define EMIT_TESTS
 	+@for TARGET in $(SUB_DIRS); do \
 		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
 		$(MAKE) OUTPUT=$$BUILD_TARGET COLLECTION=$(COLLECTION)/$$TARGET -s -C $$TARGET $@;\
 	done;
+endef
 
 override define CLEAN
 	+@for TARGET in $(SUB_DIRS); do \
tools/testing/selftests/powerpc/pmu/Makefile +2 -1
index 7e9dbf3d0d092..3aca10223f0ff 100644
@@ -37,7 +37,7 @@ override define RUN_TESTS
 	done;
 endef
 
-emit_tests:
+override define EMIT_TESTS
 	for TEST in $(TEST_GEN_PROGS); do \
 		BASENAME_TEST=`basename $$TEST`;	\
 		echo "$(COLLECTION):$$BASENAME_TEST";	\
@@ -46,6 +46,7 @@ emit_tests:
 		BUILD_TARGET=$(OUTPUT)/$$TARGET; \
 		$(MAKE) OUTPUT=$$BUILD_TARGET COLLECTION=$(COLLECTION)/$$TARGET -s -C $$TARGET emit_tests; \
 	done;
+endef
 
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 28 lines · Sasha Levin

The powerpc Makefiles include lib.mk and then define their own emit_tests rule, so every selftests build that includes powerpc warns, on any architecture:

Makefile:60: warning: overriding recipe for target 'emit_tests' ../lib.mk:183: warning: ignoring old recipe for target 'emit_tests'

lib.mk used to keep the recipe in an EMIT_TESTS variable that Makefiles could override, as they still do with RUN_TESTS, INSTALL_RULE and CLEAN. Commit d4e59a536f50 ("selftests: Use runner.sh for emit targets") dropped the variable, and commit 58b33e78a317 ("selftests/powerpc: Fix emit_tests to work with run_kselftest.sh") then replaced the powerpc EMIT_TESTS definitions with rules.

Bring EMIT_TESTS back in lib.mk and override it in the powerpc Makefiles again. Mark the lib.mk recipe with '+', so that the powerpc sub-makes still get the jobserver, as they did when $(MAKE) was in the rule itself. The emitted test lists don't change.

Fixes 58b33e78a317 ("selftests/powerpc: Fix emit_tests to work with run_kselftest.sh")

---
Checked with "make ARCH=powerpc emit_tests" in tools/testing/selftests/powerpc, which lists the same 186 tests as before, and with an x86_64 selftests install, whose kselftest-list.txt doesn't change. make -j2 --jobserver-style=pipe doesn't warn about the jobserver.

Quoted 4 lines
  tools/testing/selftests/lib.mk               | 6 +++++-
  tools/testing/selftests/powerpc/Makefile     | 3 ++-
  tools/testing/selftests/powerpc/pmu/Makefile | 3 ++-
  3 files changed, 9 insertions(+), 3 deletions(-)

Thanks, this is the right fix. I should have done this in 58b33e78a317 but just wanted to get it fixed without touching lib.mk, which was lazy.

cheers

maintainer Applied
#2 lore raw
In reply to Sasha Levin
Quoted 8 lines · Sasha Levin

The powerpc Makefiles include lib.mk and then define their own emit_tests rule, so every selftests build that includes powerpc warns, on any architecture:

Makefile:60: warning: overriding recipe for target 'emit_tests' ../lib.mk:183: warning: ignoring old recipe for target 'emit_tests'

[...]

Applied to powerpc/fixes.

[1/1] selftests/powerpc: override EMIT_TESTS instead of the emit_tests rule

      https://git.kernel.org/powerpc/c/6648db997a0b8223fefbee3b4d5391c0d90d0422

cheers