All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests: convert `echo -n` to `printf`
@ 2015-05-06  5:55 Mike Frysinger
       [not found] ` <1430891746-30267-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2015-05-06  5:55 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

From: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

The -n option is not standard in POSIX, so convert to printf which should
work the same in every shell.

Signed-off-by: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 tests/run_tests.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index c870432..0dda54a 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -42,20 +42,20 @@ base_run_test() {
 
 shorten_echo () {
     limit=32
-    echo -n "$1"
+    printf "$1"
     shift
     for x; do
 	if [ ${#x} -le $limit ]; then
-	    echo -n " $x"
+	    printf " $x"
 	else
 	    short=$(echo "$x" | head -c$limit)
-	    echo -n " \"$short\"...<${#x} bytes>"
+	    printf " \"$short\"...<${#x} bytes>"
 	fi
     done
 }
 
 run_test () {
-    echo -n "$@:	"
+    printf "$@:	"
     if [ -n "$VALGRIND" -a -f $1.supp ]; then
 	VGSUPP="--suppressions=$1.supp"
     fi
@@ -63,7 +63,7 @@ run_test () {
 }
 
 run_sh_test () {
-    echo -n "$@:	"
+    printf "$@:	"
     base_run_test sh "$@"
 }
 
@@ -106,12 +106,12 @@ wrap_error () {
 
 run_wrap_error_test () {
     shorten_echo "$@"
-    echo -n " {!= 0}:	"
+    printf " {!= 0}:	"
     base_run_test wrap_error "$@"
 }
 
 run_dtc_test () {
-    echo -n "dtc $@:	"
+    printf "dtc $@:	"
     base_run_test wrap_test $VALGRIND $DTC "$@"
 }
 
@@ -126,7 +126,7 @@ asm_to_so_test () {
 run_fdtget_test () {
     expect="$1"
     shift
-    echo -n "fdtget-runtest.sh "$expect" $@:	"
+    printf "fdtget-runtest.sh "$expect" $@:	"
     base_run_test sh fdtget-runtest.sh "$expect" "$@"
 }
 
@@ -134,14 +134,14 @@ run_fdtput_test () {
     expect="$1"
     shift
     shorten_echo fdtput-runtest.sh "$expect" "$@"
-    echo -n ":	"
+    printf ":	"
     base_run_test sh fdtput-runtest.sh "$expect" "$@"
 }
 
 run_fdtdump_test() {
     file="$1"
     shorten_echo fdtdump-runtest.sh "$file"
-    echo -n ":	"
+    printf ":	"
     base_run_test sh fdtdump-runtest.sh "$file"
 }
 
-- 
2.4.0

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

* Re: [PATCH] tests: convert `echo -n` to `printf`
       [not found] ` <1430891746-30267-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
@ 2015-05-25  1:14   ` David Gibson
       [not found]     ` <20150525011429.GF6255-1s0os16eZneny3qCrzbmXA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2015-05-25  1:14 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On Wed, May 06, 2015 at 01:55:46AM -0400, Mike Frysinger wrote:
> From: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> 
> The -n option is not standard in POSIX, so convert to printf which should
> work the same in every shell.
> 
> Signed-off-by: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Sorry it's taken so long for me to look at this.

I'm not sure exactly why, but applying this causes the output from
"make check" to be garbled in a lot of places:

[...]
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtbs_equal_unorderedPASS
dtc -IPASS
dtbs_equal_unorderedPASS
dtc -IPASS
dtbs_equal_unorderedPASS
dtbs_equal_orderedPASS
dtc -OPASS
fdtget-runtest.sh MyBoardName label01.dts.fdtget.test.dtbPASS
fdtget-runtest.sh MyBoardNamePASS
fdtget-runtest.sh 77PASS
fdtget-runtest.sh MyBoardNamePASS
fdtget-runtest.sh 32768 label01.dts.fdtget.test.dtbPASS
fdtget-runtest.sh 8000 -txPASS
fdtget-runtest.sh 61PASS
fdtget-runtest.sh aPASS
[...]

So, NACK for now, I'm afraid.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH v2] tests: convert `echo -n` to `printf`
       [not found]     ` <20150525011429.GF6255-1s0os16eZneny3qCrzbmXA@public.gmane.org>
@ 2015-05-25  1:57       ` Mike Frysinger
       [not found]         ` <1432519052-3777-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2015-05-25  1:57 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Mike Frysinger

From: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

The -n option is not standard in POSIX, so convert to printf which should
work the same in every shell.

Signed-off-by: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
v2
	- output should match before & after now

 tests/run_tests.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index c870432..dc214fd 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -42,20 +42,20 @@ base_run_test() {
 
 shorten_echo () {
     limit=32
-    echo -n "$1"
+    printf "$1"
     shift
     for x; do
 	if [ ${#x} -le $limit ]; then
-	    echo -n " $x"
+	    printf " $x"
 	else
 	    short=$(echo "$x" | head -c$limit)
-	    echo -n " \"$short\"...<${#x} bytes>"
+	    printf " \"$short\"...<${#x} bytes>"
 	fi
     done
 }
 
 run_test () {
-    echo -n "$@:	"
+    printf "$*:	"
     if [ -n "$VALGRIND" -a -f $1.supp ]; then
 	VGSUPP="--suppressions=$1.supp"
     fi
@@ -63,7 +63,7 @@ run_test () {
 }
 
 run_sh_test () {
-    echo -n "$@:	"
+    printf "$*:	"
     base_run_test sh "$@"
 }
 
@@ -106,12 +106,12 @@ wrap_error () {
 
 run_wrap_error_test () {
     shorten_echo "$@"
-    echo -n " {!= 0}:	"
+    printf " {!= 0}:	"
     base_run_test wrap_error "$@"
 }
 
 run_dtc_test () {
-    echo -n "dtc $@:	"
+    printf "dtc $*:	"
     base_run_test wrap_test $VALGRIND $DTC "$@"
 }
 
@@ -126,7 +126,7 @@ asm_to_so_test () {
 run_fdtget_test () {
     expect="$1"
     shift
-    echo -n "fdtget-runtest.sh "$expect" $@:	"
+    printf "fdtget-runtest.sh %s $*:	" "$(echo $expect)"
     base_run_test sh fdtget-runtest.sh "$expect" "$@"
 }
 
@@ -134,14 +134,14 @@ run_fdtput_test () {
     expect="$1"
     shift
     shorten_echo fdtput-runtest.sh "$expect" "$@"
-    echo -n ":	"
+    printf ":	"
     base_run_test sh fdtput-runtest.sh "$expect" "$@"
 }
 
 run_fdtdump_test() {
     file="$1"
     shorten_echo fdtdump-runtest.sh "$file"
-    echo -n ":	"
+    printf ":	"
     base_run_test sh fdtdump-runtest.sh "$file"
 }
 
-- 
2.4.1

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

* Re: [PATCH v2] tests: convert `echo -n` to `printf`
       [not found]         ` <1432519052-3777-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
@ 2015-05-25  3:33           ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2015-05-25  3:33 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Mike Frysinger

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

On Sun, May 24, 2015 at 09:57:32PM -0400, Mike Frysinger wrote:
> From: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> 
> The -n option is not standard in POSIX, so convert to printf which should
> work the same in every shell.
> 
> Signed-off-by: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
> v2
> 	- output should match before & after now

Much better, thanks.

Applied.


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-05-25  3:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06  5:55 [PATCH] tests: convert `echo -n` to `printf` Mike Frysinger
     [not found] ` <1430891746-30267-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2015-05-25  1:14   ` David Gibson
     [not found]     ` <20150525011429.GF6255-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2015-05-25  1:57       ` [PATCH v2] " Mike Frysinger
     [not found]         ` <1432519052-3777-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2015-05-25  3:33           ` David Gibson

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.