aboutsummaryrefslogtreecommitdiff
path: root/testsuite/testing.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/testing.sh')
-rwxr-xr-xtestsuite/testing.sh19
1 files changed, 9 insertions, 10 deletions
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}