diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2013-11-10 22:01:38 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2013-11-10 22:06:06 +0100 |
commit | afa63b2dcdc9b9d0183ffd84599ea5d4ad94d639 (patch) | |
tree | af1b15bd42d42ee5be891983d86532e6e41c7ab8 | |
parent | 5e63776212f8fab4fba08ab2b99dd5241f0c3880 (diff) | |
download | busybox-w32-afa63b2dcdc9b9d0183ffd84599ea5d4ad94d639.tar.gz busybox-w32-afa63b2dcdc9b9d0183ffd84599ea5d4ad94d639.tar.bz2 busybox-w32-afa63b2dcdc9b9d0183ffd84599ea5d4ad94d639.zip |
fix bashisms in testsuite/
These places use ${var/search/replace}, $((n++) and
`type -p' constructs which are not-so-standard.
Replace with equivalent constructs.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | testsuite/hostid/hostid-works | 10 | ||||
-rwxr-xr-x | testsuite/md5sum.tests | 6 | ||||
-rw-r--r-- | testsuite/testing.sh | 8 | ||||
-rw-r--r-- | testsuite/which/which-uses-default-path | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works index bcfd717af..8c20bdfcc 100644 --- a/testsuite/hostid/hostid-works +++ b/testsuite/hostid/hostid-works | |||
@@ -1,8 +1,6 @@ | |||
1 | h=x$(busybox hostid) | 1 | h=x$(busybox hostid) |
2 | # Is $h a sequence of hex numbers? | 2 | # Is $h a sequence of hex numbers? |
3 | x="${h//[0123456789abcdef]/x}" | 3 | case "$h" in |
4 | x="${x//xxx/x}" | 4 | x*[!0-9a-f]*) false;; |
5 | x="${x//xxx/x}" | 5 | *) true;; |
6 | x="${x//xxx/x}" | 6 | esac |
7 | x="${x//xx/x}" | ||
8 | test x"$x" = x"x" | ||
diff --git a/testsuite/md5sum.tests b/testsuite/md5sum.tests index 1068b083f..6c75b6d1c 100755 --- a/testsuite/md5sum.tests +++ b/testsuite/md5sum.tests | |||
@@ -30,13 +30,13 @@ result=`( | |||
30 | n=0 | 30 | n=0 |
31 | while test $n -le 999; do | 31 | while test $n -le 999; do |
32 | echo "$text" | head -c $n | "$sum" | 32 | echo "$text" | head -c $n | "$sum" |
33 | : $((n++)) | 33 | n=$(($n+1)) |
34 | done | "$sum" | 34 | done | "$sum" |
35 | )` | 35 | )` |
36 | 36 | ||
37 | if test x"$result" = x"$expected -"; then | 37 | if test x"$result" = x"$expected -"; then |
38 | echo "PASS: $sum" | 38 | echo "PASS: $sum" |
39 | exit 0 | 39 | exit 0 |
40 | fi | 40 | fi |
41 | 41 | ||
42 | echo "FAIL: $sum (r:$result exp:$expected)" | 42 | echo "FAIL: $sum (r:$result exp:$expected)" |
diff --git a/testsuite/testing.sh b/testsuite/testing.sh index e7e64e58b..f5b756947 100644 --- a/testsuite/testing.sh +++ b/testsuite/testing.sh | |||
@@ -56,10 +56,10 @@ optional() | |||
56 | { | 56 | { |
57 | SKIP= | 57 | SKIP= |
58 | while test "$1"; do | 58 | while test "$1"; do |
59 | if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then | 59 | case "${OPTIONFLAGS}" in |
60 | SKIP=1 | 60 | *:$1:*) ;; |
61 | return | 61 | *) SKIP=1; return ;; |
62 | fi | 62 | esac |
63 | shift | 63 | shift |
64 | done | 64 | done |
65 | } | 65 | } |
diff --git a/testsuite/which/which-uses-default-path b/testsuite/which/which-uses-default-path index 63ceb9f8f..349583dcc 100644 --- a/testsuite/which/which-uses-default-path +++ b/testsuite/which/which-uses-default-path | |||
@@ -1,4 +1,4 @@ | |||
1 | BUSYBOX=$(type -p busybox) | 1 | BUSYBOX=$(command -pv busybox) |
2 | SAVED_PATH=$PATH | 2 | SAVED_PATH=$PATH |
3 | unset PATH | 3 | unset PATH |
4 | $BUSYBOX which ls | 4 | $BUSYBOX which ls |