1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
From ed3d76cd1c8f91f5e86424e899448d6221b0f76c Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@chromium.org>
Date: Wed, 6 May 2015 01:53:39 -0400
Subject: [PATCH] tests: convert `echo -n` to `printf`
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@chromium.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
|