Skip to content

Commit

Permalink
selftests: use printf instead of echo -ne
Browse files Browse the repository at this point in the history
[ Upstream commit 9e34fad ]

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" <[email protected]>
Suggested-by: David Laight <[email protected]>
Fixes: 3297a4d ("kselftests: Enable the echo command to print newlines in Makefile")
Fixes: 79c16b1 ("selftests: find echo binary to use -ne options")
Signed-off-by: Guillaume Tucker <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
gctucker authored and gregkh committed Mar 10, 2023
1 parent 947de28 commit 718eaef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,10 @@ 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 ] && printf "Skipping non-existent dir: $$TARGET\n" && continue; \
printf "Emit Tests for $$TARGET\n"; \
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
-C $$TARGET emit_tests >> $(TEST_LIST); \
done;
Expand Down

0 comments on commit 718eaef

Please sign in to comment.