aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-15 22:43:48 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-15 22:43:48 +0000
commit81e97a13801eb0cc3887d1696208629e5dda77b5 (patch)
treef3537a330e23179f90e85aabbbb027f0144f25a1
parente251337a4d605e22715ed28b0a168b7fe18c4c9f (diff)
downloadbusybox-w32-81e97a13801eb0cc3887d1696208629e5dda77b5.tar.gz
busybox-w32-81e97a13801eb0cc3887d1696208629e5dda77b5.tar.bz2
busybox-w32-81e97a13801eb0cc3887d1696208629e5dda77b5.zip
testsuite instrumentation fixes by Christian
-rwxr-xr-xtestsuite/runtest16
-rwxr-xr-xtestsuite/testing.sh19
2 files changed, 16 insertions, 19 deletions
diff --git a/testsuite/runtest b/testsuite/runtest
index d9de8799f..624de8fde 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -12,7 +12,7 @@ run_applet_testcase()
12 local applet="$1" 12 local applet="$1"
13 local testcase="$2" 13 local testcase="$2"
14 14
15 local status 15 local status=0
16 local uc_applet=$(echo "$applet" | tr a-z A-Z) 16 local uc_applet=$(echo "$applet" | tr a-z A-Z)
17 local testname="$testcase" 17 local testname="$testcase"
18 18
@@ -36,8 +36,8 @@ run_applet_testcase()
36 cd ".tmpdir.$applet" || return 1 36 cd ".tmpdir.$applet" || return 1
37 37
38# echo "Running testcase $testcase" 38# echo "Running testcase $testcase"
39 d="$tsdir" sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 39 d="$tsdir" \
40 status=$? 40 sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 || status=$?
41 if [ $status -ne 0 ]; then 41 if [ $status -ne 0 ]; then
42 echo "FAIL: $testname" 42 echo "FAIL: $testname"
43 if [ x"$VERBOSE" != x ]; then 43 if [ x"$VERBOSE" != x ]; then
@@ -69,8 +69,7 @@ run_oldstyle_applet_tests()
69 *.mine) continue ;; # svn-produced junk 69 *.mine) continue ;; # svn-produced junk
70 *.r[0-9]*) continue ;; # svn-produced junk 70 *.r[0-9]*) continue ;; # svn-produced junk
71 esac 71 esac
72 run_applet_testcase "$applet" "$testcase" 72 run_applet_testcase "$applet" "$testcase" || status=1
73 test $? -eq 0 || status=1
74 done 73 done
75 return $status 74 return $status
76} 75}
@@ -125,8 +124,7 @@ status=0
125for applet in $applets; do 124for applet in $applets; do
126 # Any old-style tests for this applet? 125 # Any old-style tests for this applet?
127 if [ -d "$tsdir/$applet" ]; then 126 if [ -d "$tsdir/$applet" ]; then
128 run_oldstyle_applet_tests "$applet" 127 run_oldstyle_applet_tests "$applet" || status=1
129 test $? -eq 0 || status=1
130 fi 128 fi
131 129
132 # Is this a new-style test? 130 # Is this a new-style test?
@@ -139,8 +137,8 @@ for applet in $applets; do
139 fi 137 fi
140 fi 138 fi
141# echo "Running test $tsdir/$applet.tests" 139# echo "Running test $tsdir/$applet.tests"
142 PATH="$LINKSDIR:$tsdir:$bindir:$PATH" "$tsdir/$applet.tests" 140 PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
143 test $? -eq 0 || status=1 141 "$tsdir/$applet.tests" || status=1
144 fi 142 fi
145done 143done
146 144
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index 028d09a28..ea59f317a 100755
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -37,7 +37,7 @@ export FAILCOUNT=0
37export SKIP= 37export SKIP=
38 38
39# Helper for helpers. Oh my... 39# Helper for helpers. Oh my...
40test x"$ECHO" = x"" && { 40test x"$ECHO" != x"" || {
41 ECHO="echo" 41 ECHO="echo"
42 test x"`echo -ne`" = x"" || { 42 test x"`echo -ne`" = x"" || {
43 # Compile and use a replacement 'echo' which understands -e -n 43 # Compile and use a replacement 'echo' which understands -e -n
@@ -68,15 +68,15 @@ optional()
68testing() 68testing()
69{ 69{
70 NAME="$1" 70 NAME="$1"
71 [ -z "$1" ] && NAME="$2" 71 [ -n "$1" ] || NAME="$2"
72 72
73 if [ $# -ne 5 ] 73 if [ $# -ne 5 ]
74 then 74 then
75 echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2 75 echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2
76 exit 76 exit 1
77 fi 77 fi
78 78
79 [ -n "$DEBUG" ] && set -x 79 [ -z "$DEBUG" ] || set -x
80 80
81 if [ -n "$SKIP" ] 81 if [ -n "$SKIP" ]
82 then 82 then
@@ -90,18 +90,17 @@ testing()
90 $ECHO -ne "$5" | eval "$2" > actual 90 $ECHO -ne "$5" | eval "$2" > actual
91 RETVAL=$? 91 RETVAL=$?
92 92
93 cmp expected actual >/dev/null 2>/dev/null 93 if cmp expected actual >/dev/null 2>/dev/null
94 if [ $? -ne 0 ]
95 then 94 then
95 echo "PASS: $NAME"
96 else
96 FAILCOUNT=$(($FAILCOUNT + 1)) 97 FAILCOUNT=$(($FAILCOUNT + 1))
97 echo "FAIL: $NAME" 98 echo "FAIL: $NAME"
98 [ -n "$VERBOSE" ] && diff -u expected actual 99 [ -z "$VERBOSE" ] || diff -u expected actual
99 else
100 echo "PASS: $NAME"
101 fi 100 fi
102 rm -f input expected actual 101 rm -f input expected actual
103 102
104 [ -n "$DEBUG" ] && set +x 103 [ -z "$DEBUG" ] || set +x
105 104
106 return $RETVAL 105 return $RETVAL
107} 106}