10.11.2013 19:25, Michael Tokarev wrpte:
Another question/issue with the testsuite.
'
The testsuite uses ${var/search/replace} construct
heavily.  It is implemented in bash and in busybox
ash, but not, for example, in dash, and it is not
in POSIX either.

So when the system /bin/sh does not implement this
construct, los of tests fails like this:

Actually there are just 2 places which are trivial to fix,
and the following patch does just that.

Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

Thanks,

/mjt
From: Michael Tokarev <m...@tls.msk.ru>
Subject: fix bashisms in testsuite/testing.sh and testsuite/hostid/hostid-works

These places use ${var/search/replace} construct which is non-standard.
Replace it with equivalent constructs.

Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

diff --git a/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works
index bcfd717..8c20bdf 100644
--- a/testsuite/hostid/hostid-works
+++ b/testsuite/hostid/hostid-works
@@ -1,8 +1,6 @@
 h=x$(busybox hostid)
 # Is $h a sequence of hex numbers?
-x="${h//[0123456789abcdef]/x}"
-x="${x//xxx/x}"
-x="${x//xxx/x}"
-x="${x//xxx/x}"
-x="${x//xx/x}"
-test x"$x" = x"x"
+case "$h" in
+ x*[!0-9a-f]*) false;;
+ *) true;;
+esac
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index e7e64e5..84e00d1 100644
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -56,10 +56,9 @@ optional()
 {
 	SKIP=
 	while test "$1"; do
-		if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then
-			SKIP=1
-			return
-		fi
+		case "${OPTIONFLAGS}" in
+			*:$1:*) SKIP=1; return;;
+		esac
 		shift
 	done
 }
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to