tests: convert `echo -n` to `printf`
PATCH 1/1 tests: convert `echo -n` to `printf`
From: Mike Frysinger <[email protected]>
The -n option is not standard in POSIX, so convert to printf which should work the same in every shell.
--- tests/run_tests.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tests/run_tests.sh +10 -10
@@ -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" }
Signature · 1 line
2.4.0
A message that is not in the archive (sent off-list or not yet received): 1430891746-30267-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org
Quoted 6 lines · Mike Frysinger
From: Mike Frysinger <[email protected]>
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 <[email protected]>
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_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASSdtbs_equal_unorderedPASS
dtc -IPASSdtbs_equal_unorderedPASS
dtc -IPASSdtbs_equal_unorderedPASSdtbs_equal_orderedPASS
dtc -OPASSfdtget-runtest.sh MyBoardName label01.dts.fdtget.test.dtbPASS fdtget-runtest.sh MyBoardNamePASSfdtget-runtest.sh 77PASSfdtget-runtest.sh MyBoardNamePASSfdtget-runtest.sh 32768 label01.dts.fdtget.test.dtbPASS fdtget-runtest.sh 8000 -txPASSfdtget-runtest.sh 61PASSfdtget-runtest.sh aPASS
[...]
So, NACK for now, I'm afraid.
Signature · 4 lines
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 tests: convert `echo -n` to `printf`
From: Mike Frysinger <[email protected]>
The -n option is not standard in POSIX, so convert to printf which should work the same in every shell.
---
v2
- output should match before & after now
tests/run_tests.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tests/run_tests.sh +10 -10
@@ -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" }
Signature · 1 line
2.4.1
A message that is not in the archive (sent off-list or not yet received): 1432519052-3777-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org
David Gibson
AppliedQuoted 9 lines · Mike Frysinger
From: Mike Frysinger <[email protected]>
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 <[email protected]>---
v2
- output should match before & after now
Much better, thanks.
Applied.
Signature · 4 lines
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