Skip to content

Commit 58b33e7

Browse files
committed
selftests/powerpc: Fix emit_tests to work with run_kselftest.sh
In order to use run_kselftest.sh the list of tests must be emitted to populate kselftest-list.txt. The powerpc Makefile is written to use EMIT_TESTS. But support for EMIT_TESTS was dropped in commit d4e59a5 ("selftests: Use runner.sh for emit targets"). Although prior to that commit a548de0 ("selftests: lib.mk: add test execute bit check to EMIT_TESTS") had already broken run_kselftest.sh for powerpc due to the executable check using the wrong path. It can be fixed by replacing the EMIT_TESTS definitions with actual emit_tests rules in the powerpc Makefiles. This makes run_kselftest.sh able to run powerpc tests: $ cd linux $ export ARCH=powerpc $ export CROSS_COMPILE=powerpc64le-linux-gnu- $ make headers $ make -j -C tools/testing/selftests install $ grep -c "^powerpc" tools/testing/selftests/kselftest_install/kselftest-list.txt 182 Fixes: d4e59a5 ("selftests: Use runner.sh for emit targets") Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230921072623.828772-1-mpe@ellerman.id.au
1 parent c5cc3ca commit 58b33e7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tools/testing/selftests/powerpc/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ override define INSTALL_RULE
5959
done;
6060
endef
6161

62-
override define EMIT_TESTS
62+
emit_tests:
6363
+@for TARGET in $(SUB_DIRS); do \
6464
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
65-
$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
65+
$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\
6666
done;
67-
endef
6867

6968
override define CLEAN
7069
+@for TARGET in $(SUB_DIRS); do \
@@ -77,4 +76,4 @@ endef
7776
tags:
7877
find . -name '*.c' -o -name '*.h' | xargs ctags
7978

80-
.PHONY: tags $(SUB_DIRS)
79+
.PHONY: tags $(SUB_DIRS) emit_tests

tools/testing/selftests/powerpc/pmu/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ override define RUN_TESTS
3030
+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
3131
endef
3232

33-
DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
34-
override define EMIT_TESTS
35-
$(DEFAULT_EMIT_TESTS)
33+
emit_tests:
34+
for TEST in $(TEST_GEN_PROGS); do \
35+
BASENAME_TEST=`basename $$TEST`; \
36+
echo "$(COLLECTION):$$BASENAME_TEST"; \
37+
done
3638
+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3739
+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3840
+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
39-
endef
4041

4142
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
4243
override define INSTALL_RULE
@@ -64,4 +65,4 @@ sampling_tests:
6465
event_code_tests:
6566
TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
6667

67-
.PHONY: all run_tests ebb sampling_tests event_code_tests
68+
.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests

0 commit comments

Comments
 (0)