Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: use printf instead of echo -ne

Rather than trying to guess which implementation of "echo" to run with
support for "-ne" options, use "printf" instead of "echo -ne". It
handles escape characters as a standard feature and it is widespread
among modern shells.

Reported-by: "kernelci.org bot" <bot@kernelci.org>
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Fixes: 3297a4df805d ("kselftests: Enable the echo command to print newlines in Makefile")
Fixes: 79c16b1120fe ("selftests: find echo binary to use -ne options")
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Guillaume Tucker and committed by
Shuah Khan
9e34fad0 1e6b485c

+2 -3
+2 -3
tools/testing/selftests/Makefile
··· 234 234 @# While building kselftest-list.text skip also non-existent TARGET dirs: 235 235 @# they could be the result of a build failure and should NOT be 236 236 @# included in the generated runlist. 237 - ECHO=`which echo`; \ 238 237 for TARGET in $(TARGETS); do \ 239 238 BUILD_TARGET=$$BUILD/$$TARGET; \ 240 - [ ! -d $(INSTALL_PATH)/$$TARGET ] && $$ECHO "Skipping non-existent dir: $$TARGET" && continue; \ 241 - $$ECHO -ne "Emit Tests for $$TARGET\n"; \ 239 + [ ! -d $(INSTALL_PATH)/$$TARGET ] && printf "Skipping non-existent dir: $$TARGET\n" && continue; \ 240 + printf "Emit Tests for $$TARGET\n"; \ 242 241 $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \ 243 242 -C $$TARGET emit_tests >> $(TEST_LIST); \ 244 243 done;