summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-09-24 00:52:58 +0000
committerMike Frysinger <vapier@gentoo.org>2005-09-24 00:52:58 +0000
commit3f91d7a9f6f74714f27537fee694bad6966beea5 (patch)
treee5467a0b78cb5e07a784dba7236cf1a74ad8d14a /testsuite
parent30b17863bd9b6bd370dc7fc60932469468f462a3 (diff)
downloadbusybox-w32-3f91d7a9f6f74714f27537fee694bad6966beea5.tar.gz
busybox-w32-3f91d7a9f6f74714f27537fee694bad6966beea5.tar.bz2
busybox-w32-3f91d7a9f6f74714f27537fee694bad6966beea5.zip
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 @@
19# The environment variable "FAILCOUNT" contains a cumulative total of the 19# The environment variable "FAILCOUNT" contains a cumulative total of the
20# 20#
21 21
22# The command line parsing is ugly and should be improved. 22verbose=0
23debug=0
24force=0
25for x in "$@" ; do
26 case "$x" in
27 -v|--verbose) verbose=1; shift;;
28 -d|--debug) debug=1; shift;;
29 -f|--force) force=1; shift;;
30 --) break;;
31 -*) echo "Unknown option '$x'"; exit 1;;
32 *) break;;
33 esac
34done
23 35
24if [ "$1" == "-v" ] 36if [ -n "$VERBOSE" ] ; then
25then 37 verbose=1
26 verbose=1 38fi
39if [ -n "$DEBUG" ] ; then
40 debug=1
27fi 41fi
28 42
29export FAILCOUNT=0 43export FAILCOUNT=0
@@ -48,16 +62,19 @@ testing()
48 exit 62 exit
49 fi 63 fi
50 64
51 if [ ${force_tests:-0} -ne 1 -a -n "$_BB_CONFIG_DEP" ] 65 if [ "$debug" = "1" ] ; then
66 set -x
67 fi
68
69 if [ -n "$_BB_CONFIG_DEP" ] && [ "${force}" = "0" ]
52 then 70 then
53 if ! config_is_set "$_BB_CONFIG_DEP" 71 if ! config_is_set "$_BB_CONFIG_DEP"
54 then 72 then
55 echo "UNTESTED: $1" 73 echo "SKIPPED: $1"
56 return 0 74 return 0
57 fi 75 fi
58 fi 76 fi
59 77
60 f=$FAILCOUNT
61 echo -ne "$3" > expected 78 echo -ne "$3" > expected
62 echo -ne "$4" > input 79 echo -ne "$4" > input
63 echo -n -e "$5" | eval "$COMMAND $2" > actual 80 echo -n -e "$5" | eval "$COMMAND $2" > actual
@@ -66,9 +83,9 @@ testing()
66 cmp expected actual > /dev/null 83 cmp expected actual > /dev/null
67 if [ $? -ne 0 ] 84 if [ $? -ne 0 ]
68 then 85 then
69 FAILCOUNT=$[$FAILCOUNT+1] 86 ((FAILCOUNT++))
70 echo "FAIL: $1" 87 echo "FAIL: $1"
71 if [ $verbose ] 88 if [ "$verbose" = "1" ]
72 then 89 then
73 diff -u expected actual 90 diff -u expected actual
74 fi 91 fi
@@ -77,5 +94,9 @@ testing()
77 fi 94 fi
78 rm -f input expected actual 95 rm -f input expected actual
79 96
97 if [ "$debug" = "1" ] ; then
98 set +x
99 fi
100
80 return $RETVAL 101 return $RETVAL
81} 102}