From: Guillaume Tucker Date: Fri, 3 Feb 2023 15:26:03 +0000 (+0100) Subject: selftests: find echo binary to use -ne options X-Git-Tag: v6.1.21~1043 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96acb09a34aced980534bba7de2f57c87c3ede50;p=platform%2Fkernel%2Flinux-starfive.git selftests: find echo binary to use -ne options [ Upstream commit 4ebe33398c40c1118b4d8546978036c0e0032d1b ] 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" Fixes: 3297a4df805d ("kselftests: Enable the echo command to print newlines in Makefile") Signed-off-by: Guillaume Tucker Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index f07aef7..253596a 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -231,10 +231,11 @@ ifdef INSTALL_PATH @# While building kselftest-list.text skip also non-existent TARGET dirs: @# they could be the result of a build failure and should NOT be @# included in the generated runlist. + ECHO=`which echo`; \ for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ - [ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \ - echo -ne "Emit Tests for $$TARGET\n"; \ + [ ! -d $(INSTALL_PATH)/$$TARGET ] && $$ECHO "Skipping non-existent dir: $$TARGET" && continue; \ + $$ECHO -ne "Emit Tests for $$TARGET\n"; \ $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \ -C $$TARGET emit_tests >> $(TEST_LIST); \ done;