dtc-1.4.1-echo-n.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From ed3d76cd1c8f91f5e86424e899448d6221b0f76c Mon Sep 17 00:00:00 2001
  2. From: Mike Frysinger <vapier@chromium.org>
  3. Date: Wed, 6 May 2015 01:53:39 -0400
  4. Subject: [PATCH] tests: convert `echo -n` to `printf`
  5. The -n option is not standard in POSIX, so convert to printf which should
  6. work the same in every shell.
  7. Signed-off-by: Mike Frysinger <vapier@chromium.org>
  8. ---
  9. tests/run_tests.sh | 20 ++++++++++----------
  10. 1 file changed, 10 insertions(+), 10 deletions(-)
  11. diff --git a/tests/run_tests.sh b/tests/run_tests.sh
  12. index c870432..0dda54a 100755
  13. --- a/tests/run_tests.sh
  14. +++ b/tests/run_tests.sh
  15. @@ -42,20 +42,20 @@ base_run_test() {
  16. shorten_echo () {
  17. limit=32
  18. - echo -n "$1"
  19. + printf "$1"
  20. shift
  21. for x; do
  22. if [ ${#x} -le $limit ]; then
  23. - echo -n " $x"
  24. + printf " $x"
  25. else
  26. short=$(echo "$x" | head -c$limit)
  27. - echo -n " \"$short\"...<${#x} bytes>"
  28. + printf " \"$short\"...<${#x} bytes>"
  29. fi
  30. done
  31. }
  32. run_test () {
  33. - echo -n "$@: "
  34. + printf "$@: "
  35. if [ -n "$VALGRIND" -a -f $1.supp ]; then
  36. VGSUPP="--suppressions=$1.supp"
  37. fi
  38. @@ -63,7 +63,7 @@ run_test () {
  39. }
  40. run_sh_test () {
  41. - echo -n "$@: "
  42. + printf "$@: "
  43. base_run_test sh "$@"
  44. }
  45. @@ -106,12 +106,12 @@ wrap_error () {
  46. run_wrap_error_test () {
  47. shorten_echo "$@"
  48. - echo -n " {!= 0}: "
  49. + printf " {!= 0}: "
  50. base_run_test wrap_error "$@"
  51. }
  52. run_dtc_test () {
  53. - echo -n "dtc $@: "
  54. + printf "dtc $@: "
  55. base_run_test wrap_test $VALGRIND $DTC "$@"
  56. }
  57. @@ -126,7 +126,7 @@ asm_to_so_test () {
  58. run_fdtget_test () {
  59. expect="$1"
  60. shift
  61. - echo -n "fdtget-runtest.sh "$expect" $@: "
  62. + printf "fdtget-runtest.sh "$expect" $@: "
  63. base_run_test sh fdtget-runtest.sh "$expect" "$@"
  64. }
  65. @@ -134,14 +134,14 @@ run_fdtput_test () {
  66. expect="$1"
  67. shift
  68. shorten_echo fdtput-runtest.sh "$expect" "$@"
  69. - echo -n ": "
  70. + printf ": "
  71. base_run_test sh fdtput-runtest.sh "$expect" "$@"
  72. }
  73. run_fdtdump_test() {
  74. file="$1"
  75. shorten_echo fdtdump-runtest.sh "$file"
  76. - echo -n ": "
  77. + printf ": "
  78. base_run_test sh fdtdump-runtest.sh "$file"
  79. }
  80. --
  81. 2.4.0