All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests: use printf instead of echo -ne
@ 2023-02-04 13:56 Guillaume Tucker
  2023-02-04 15:18 ` Guenter Roeck
  2023-02-07  8:36 ` Guillaume Tucker
  0 siblings, 2 replies; 4+ messages in thread
From: Guillaume Tucker @ 2023-02-04 13:56 UTC (permalink / raw)
  To: Shuah Khan, Gautam, David Laight
  Cc: Guillaume Tucker, kernel, linux-kselftest, linux-kernel, kernelci

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.  To avoid this issue, use
printf which handles escape characters as a standard feature and is
more widespread among modern shells.

The output is now formatted as expected (x86 build this time):

Emit Tests for alsa
Emit Tests for amd-pstate
Skipping non-existent dir: arm64

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")
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---

Notes:
    v2: use printf insead of $(which echo)

 tools/testing/selftests/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 41b649452560..06578963f4f1 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -236,8 +236,8 @@ ifdef INSTALL_PATH
 	@# included in the generated runlist.
 	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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests: use printf instead of echo -ne
  2023-02-04 13:56 [PATCH v2] selftests: use printf instead of echo -ne Guillaume Tucker
@ 2023-02-04 15:18 ` Guenter Roeck
  2023-02-07  8:36 ` Guillaume Tucker
  1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2023-02-04 15:18 UTC (permalink / raw)
  To: Guillaume Tucker
  Cc: Shuah Khan, Gautam, David Laight, kernel, linux-kselftest,
	linux-kernel, kernelci

On Sat, Feb 4, 2023 at 5:56 AM Guillaume Tucker
<guillaume.tucker@collabora.com> wrote:
>
> 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.  To avoid this issue, use
> printf which handles escape characters as a standard feature and is
> more widespread among modern shells.
>
> The output is now formatted as expected (x86 build this time):
>
> Emit Tests for alsa
> Emit Tests for amd-pstate
> Skipping non-existent dir: arm64
>
> 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")
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>
> Notes:
>     v2: use printf insead of $(which echo)
>
>  tools/testing/selftests/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 41b649452560..06578963f4f1 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -236,8 +236,8 @@ ifdef INSTALL_PATH
>         @# included in the generated runlist.
>         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;
> --
> 2.30.2
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests: use printf instead of echo -ne
  2023-02-04 13:56 [PATCH v2] selftests: use printf instead of echo -ne Guillaume Tucker
  2023-02-04 15:18 ` Guenter Roeck
@ 2023-02-07  8:36 ` Guillaume Tucker
  2023-02-07 21:54   ` Shuah Khan
  1 sibling, 1 reply; 4+ messages in thread
From: Guillaume Tucker @ 2023-02-07  8:36 UTC (permalink / raw)
  To: Shuah Khan, Gautam, David Laight
  Cc: kernel, linux-kselftest, linux-kernel, kernelci

On 04/02/2023 14:56, Guillaume Tucker wrote:
> 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.  To avoid this issue, use
> printf which handles escape characters as a standard feature and is
> more widespread among modern shells.
> 
> The output is now formatted as expected (x86 build this time):
> 
> Emit Tests for alsa
> Emit Tests for amd-pstate
> Skipping non-existent dir: arm64
> 
> 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")
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
> 
> Notes:
>     v2: use printf insead of $(which echo)

Oh I see you've already applied the v1 on kselftest/next branch:

  79c16b1120fe selftests: find echo binary to use -ne options

Do you want me to send this printf fix rebased on top?

Thanks,
Guillaume


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests: use printf instead of echo -ne
  2023-02-07  8:36 ` Guillaume Tucker
@ 2023-02-07 21:54   ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2023-02-07 21:54 UTC (permalink / raw)
  To: Guillaume Tucker, Shuah Khan, Gautam, David Laight
  Cc: kernel, linux-kselftest, linux-kernel, kernelci, Shuah Khan

On 2/7/23 01:36, Guillaume Tucker wrote:
> On 04/02/2023 14:56, Guillaume Tucker wrote:
>> 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.  To avoid this issue, use
>> printf which handles escape characters as a standard feature and is
>> more widespread among modern shells.
>>
>> The output is now formatted as expected (x86 build this time):
>>
>> Emit Tests for alsa
>> Emit Tests for amd-pstate
>> Skipping non-existent dir: arm64
>>
>> 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")
>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
>>
>> Notes:
>>      v2: use printf insead of $(which echo)
> 
> Oh I see you've already applied the v1 on kselftest/next branch:
> 
>    79c16b1120fe selftests: find echo binary to use -ne options
> 
> Do you want me to send this printf fix rebased on top?
> 

Yes please. Thank you.

thanks,
--- Shuah


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-07 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 13:56 [PATCH v2] selftests: use printf instead of echo -ne Guillaume Tucker
2023-02-04 15:18 ` Guenter Roeck
2023-02-07  8:36 ` Guillaume Tucker
2023-02-07 21:54   ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.