I'll comment the patch here, but see attached for a clean version.
This has more academic than practical importance ;-)

* neither $lcwd nor ${lcwd%/*} need to be quote protected

 lcwd=$(pwd)
-[ "$tsdir" ] || tsdir="$lcwd"
-[ "$bindir" ] || bindir="${lcwd%/*}" # one directory up from $lcwd
+[ "$tsdir" ] || tsdir=$lcwd
+[ "$bindir" ] || bindir=${lcwd%/*} # one directory up from $lcwd


* "links" does not need to be quote protected
* the general style in the script is _not_ to write simple if-blocks
  on a single line

-       if [ "$applet" = "links" ]; then continue; fi
+       if [ "$applet" = links ]; then
+               continue
+       fi

* a one liner would look like this:

        [ "$applet" != links ] || continue


* applet does not need to be protected

-       if [ -f "${applet}.tests" ]; then
+       if [ -f "$applet.tests" ]; then

-#              echo "Running test ${tsdir:-.}/${applet}.tests"
-               PATH="$LINKSDIR:$tsdir:$bindir:$PATH" 
"${tsdir:-.}/${applet}.tests"
+#              echo "Running test ${tsdir:-.}/$applet.tests"
+               PATH="$LINKSDIR:$tsdir:$bindir:$PATH" 
"${tsdir:-.}/$applet.tests"
                test $? -eq 0 || status=1


Cheers,

-- 
Cristian
Index: testsuite/runtest
===================================================================
--- testsuite/runtest	(revision 21874)
+++ testsuite/runtest	(working copy)
@@ -82,8 +82,8 @@
 
 
 lcwd=$(pwd)
-[ "$tsdir" ] || tsdir="$lcwd"
-[ "$bindir" ] || bindir="${lcwd%/*}" # one directory up from $lcwd
+[ "$tsdir" ] || tsdir=$lcwd
+[ "$bindir" ] || bindir=${lcwd%/*} # one directory up from $lcwd
 PATH="$bindir:$PATH"
 
 if [ x"$VERBOSE" = x ]; then
@@ -124,7 +124,9 @@
 
 status=0
 for applet in $applets; do
-	if [ "$applet" = "links" ]; then continue; fi
+	if [ "$applet" = links ]; then
+		continue
+	fi
 
 	# Any old-style tests for this applet?
 	if [ "$applet" != "CVS" -a -d "$tsdir/$applet" ]; then
@@ -133,7 +135,7 @@
 	fi
 
 	# Is this a new-style test?
-	if [ -f "${applet}.tests" ]; then
+	if [ -f "$applet.tests" ]; then
 		if [ ! -h "$LINKSDIR/$applet" ]; then
 			# (avoiding bash'ism "${applet:0:4}")
 			if ! echo "$applet" | grep "^all_" >/dev/null; then
@@ -141,8 +143,8 @@
 				continue
 			fi
 		fi
-#		echo "Running test ${tsdir:-.}/${applet}.tests"
-		PATH="$LINKSDIR:$tsdir:$bindir:$PATH" "${tsdir:-.}/${applet}.tests"
+#		echo "Running test ${tsdir:-.}/$applet.tests"
+		PATH="$LINKSDIR:$tsdir:$bindir:$PATH" "${tsdir:-.}/$applet.tests"
 		test $? -eq 0 || status=1
 	fi
 done
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to