comparison tests/run-tests @ 804:19388dcbac49

Incorporated most of Aron Griffis suggestions for sh compatibility.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 29 Jul 2005 21:50:05 +0100
parents 3d47e7fc33a3
children 8f5637f0a0c0
comparison
equal deleted inserted replaced
803:3d47e7fc33a3 804:19388dcbac49
18 HGEDITOR=true; export HGEDITOR 18 HGEDITOR=true; export HGEDITOR
19 HGMERGE=true; export HGMERGE 19 HGMERGE=true; export HGMERGE
20 HGUSER="test"; export HGUSER 20 HGUSER="test"; export HGUSER
21 21
22 umask 022 22 umask 022
23
24 if [ "$[1+1]" = "2" ]; then
25 use_arithmetic=true
26 else
27 use_arithmetic=false
28 fi
29 23
30 tests=0 24 tests=0
31 failed=0 25 failed=0
32 26
33 HGTMP="" 27 HGTMP=""
53 lib=lib 47 lib=lib
54 fi 48 fi
55 49
56 INST="$HGTMP/install" 50 INST="$HGTMP/install"
57 cd .. 51 cd ..
58 if ${PYTHON:-python} setup.py install --home="$INST" > tests/install.err 2>&1 52 if ${PYTHON-python} setup.py install --home="$INST" > tests/install.err 2>&1
59 then 53 then
60 rm tests/install.err 54 rm tests/install.err
61 mv "$INST/bin/hg" "$INST/bin/hg.real" 55 mv "$INST/bin/hg" "$INST/bin/hg.real"
62 ( 56 (
63 echo '#!/bin/sh' 57 echo '#!/bin/sh'
121 rm -f "$HGTMP/$1.out" 115 rm -f "$HGTMP/$1.out"
122 rm -rf "$HGTMP/$1" 116 rm -rf "$HGTMP/$1"
123 return $fail 117 return $fail
124 } 118 }
125 119
126 TESTS="$@" 120 TESTS="$*"
127 if [ -z "$TESTS" ] ; then 121 if [ -z "$TESTS" ] ; then
128 TESTS=`ls test-* | grep -Ev "\.|~"` 122 TESTS=`ls test-* | grep -v "[.~]"`
129 fi 123 fi
130 124
131 for f in $TESTS ; do 125 for f in $TESTS ; do
132 echo -n "." 126 echo -n "."
133 if $use_arithmetic; then 127 run_one $f || failed=`expr $failed + 1`
134 run_one $f || failed=$[$failed + 1] 128 tests=`expr $tests + 1`
135 tests=$[$tests + 1]
136 else
137 run_one $f || failed=1
138 fi
139 done 129 done
140 130
141 if $use_arithmetic; then 131 echo
142 echo 132 echo "Ran $tests tests, $failed failed."
143 echo "Ran $tests tests, $failed failed."
144 133
145 if [ $failed -gt 0 ] ; then 134 if [ $failed -gt 0 ] ; then
146 cleanup_exit 1 135 cleanup_exit 1
147 fi
148 else
149 echo
150 if [ "$failed" = "1" ] ; then
151 echo "Ran tests, at least one failed."
152 cleanup_exit 1
153 else
154 echo "Ran tests, none failed."
155 fi
156 fi 136 fi
157 cleanup_exit 0 137 cleanup_exit 0