stop using bash'isms ('function')
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 25 Feb 2007 00:40:37 +0000 (00:40 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 25 Feb 2007 00:40:37 +0000 (00:40 -0000)
runtest: do not depend on busybox.links

scripts/trylink
testsuite/runtest

index dfe282db56b094210bab8d7371418e67b3e71d36..3ac249c73e09c0957beabe5d01a82755d8fcaabc 100755 (executable)
@@ -2,7 +2,7 @@
 
 debug=false
 
-function try {
+try() {
     added="$1"
     shift
     $debug && echo "Trying: $* $added"
index 84cd6a7f3f879afef9798dd66ae474a0c174bd05..279f51fbd17b1a81f4239f4eb9c130f72699c21d 100755 (executable)
@@ -6,7 +6,7 @@ PATH=$bindir:$PATH
 
 # Run old-style test.
 
-function run_applet_testcase
+run_applet_testcase()
 {
        local applet=$1
        local testcase=$2
@@ -55,7 +55,7 @@ function run_applet_testcase
        return $status
 }
 
-run_applet_tests ()
+run_applet_tests()
 {
        local applet=$1
 
@@ -94,10 +94,20 @@ fi
 
 # Populate a directory with links to all busybox applets
 
-LINKSDIR="${bindir}/runtest-tempdir-links"
+LINKSDIR="$bindir/runtest-tempdir-links"
+implemented=$($bindir/busybox 2>&1 |
+       while read line
+       do
+               if test x"$line" = x"Currently defined functions:"
+               then
+                       xargs | sed 's/,//g'
+                       break
+               fi
+       done
+       )
 rm -rf "$LINKSDIR" 2>/dev/null
 mkdir "$LINKSDIR"
-for i in $(sed 's@/[a-z0-9/\[]*/@@' $bindir/busybox.links 2>/dev/null)
+for i in $implemented
 do
        ln -s $bindir/busybox "$LINKSDIR"/$i
 done
@@ -127,11 +137,11 @@ for applet in $applets; do
                        continue
                fi
                if PATH="$LINKSDIR":$srcdir:$bindir:$PATH \
-                       "${srcdir:-.}/$applet".tests
+                               "${srcdir:-.}/$applet".tests
                then
-                 :
+                       :
                else
-                 status=1
+                       status=1
                fi
        fi