aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorGravatar Mike Frysinger <vapier@gentoo.org>2005-09-24 00:52:58 +0000
committerGravatar Mike Frysinger <vapier@gentoo.org>2005-09-24 00:52:58 +0000
commit3f91d7a9f6f74714f27537fee694bad6966beea5 (patch)
treee5467a0b78cb5e07a784dba7236cf1a74ad8d14a /testsuite
parent30b17863bd9b6bd370dc7fc60932469468f462a3 (diff)
downloadbusybox-3f91d7a9f6f74714f27537fee694bad6966beea5.tar.gz
busybox-3f91d7a9f6f74714f27537fee694bad6966beea5.tar.bz2
cleanup option parsing
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/testing.sh39
1 files changed, 30 insertions, 9 deletions
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index 420cfa1ef..b7c85c227 100755
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -19,11 +19,25 @@
# The environment variable "FAILCOUNT" contains a cumulative total of the
#
-# The command line parsing is ugly and should be improved.
+verbose=0
+debug=0
+force=0
+for x in "$@" ; do
+ case "$x" in
+ -v|--verbose) verbose=1; shift;;
+ -d|--debug) debug=1; shift;;
+ -f|--force) force=1; shift;;
+ --) break;;
+ -*) echo "Unknown option '$x'"; exit 1;;
+ *) break;;
+ esac
+done
-if [ "$1" == "-v" ]
-then
- verbose=1
+if [ -n "$VERBOSE" ] ; then
+ verbose=1
+fi
+if [ -n "$DEBUG" ] ; then
+ debug=1
fi
export FAILCOUNT=0
@@ -48,16 +62,19 @@ testing()
exit
fi
- if [ ${force_tests:-0} -ne 1 -a -n "$_BB_CONFIG_DEP" ]
+ if [ "$debug" = "1" ] ; then
+ set -x
+ fi
+
+ if [ -n "$_BB_CONFIG_DEP" ] && [ "${force}" = "0" ]
then
if ! config_is_set "$_BB_CONFIG_DEP"
then
- echo "UNTESTED: $1"
+ echo "SKIPPED: $1"
return 0
fi
fi
- f=$FAILCOUNT
echo -ne "$3" > expected
echo -ne "$4" > input
echo -n -e "$5" | eval "$COMMAND $2" > actual
@@ -66,9 +83,9 @@ testing()
cmp expected actual > /dev/null
if [ $? -ne 0 ]
then
- FAILCOUNT=$[$FAILCOUNT+1]
+ ((FAILCOUNT++))
echo "FAIL: $1"
- if [ $verbose ]
+ if [ "$verbose" = "1" ]
then
diff -u expected actual
fi
@@ -77,5 +94,9 @@ testing()
fi
rm -f input expected actual
+ if [ "$debug" = "1" ] ; then
+ set +x
+ fi
+
return $RETVAL
}