Skip to content

Commit 4ebe333

Browse files
gctuckershuahkh
authored andcommitted
selftests: find echo binary to use -ne options
Find the actual echo binary using $(which echo) and use it for formatted output with -ne. On some systems, the default echo command doesn't handle the -e option and the output looks like this (arm64 build): -ne Emit Tests for alsa -ne Emit Tests for amd-pstate -ne Emit Tests for arm64 This is for example the case with the KernelCI Docker images e.g. kernelci/gcc-10:x86-kselftest-kernelci. With the actual echo binary (e.g. in /bin/echo), the output is formatted as expected (x86 build this time): Emit Tests for alsa Emit Tests for amd-pstate Skipping non-existent dir: arm64 Only the install target is using "echo -ne" so keep the $ECHO variable local to it. Reported-by: "kernelci.org bot" <[email protected]> Fixes: 3297a4d ("kselftests: Enable the echo command to print newlines in Makefile") Signed-off-by: Guillaume Tucker <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 4b225d4 commit 4ebe333

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/testing/selftests/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,11 @@ ifdef INSTALL_PATH
234234
@# While building kselftest-list.text skip also non-existent TARGET dirs:
235235
@# they could be the result of a build failure and should NOT be
236236
@# included in the generated runlist.
237+
ECHO=`which echo`; \
237238
for TARGET in $(TARGETS); do \
238239
BUILD_TARGET=$$BUILD/$$TARGET; \
239-
[ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
240-
echo -ne "Emit Tests for $$TARGET\n"; \
240+
[ ! -d $(INSTALL_PATH)/$$TARGET ] && $$ECHO "Skipping non-existent dir: $$TARGET" && continue; \
241+
$$ECHO -ne "Emit Tests for $$TARGET\n"; \
241242
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
242243
-C $$TARGET emit_tests >> $(TEST_LIST); \
243244
done;

0 commit comments

Comments
 (0)