author | mpm@selenic.com |
Thu, 16 Jun 2005 08:37:15 -0800 | |
changeset 382 | 37249c522770 |
parent 362 | 410373162036 |
child 397 | e5683db23ec4 |
child 429 | 688d03d6997a |
permissions | -rwxr-xr-x |
331 | 1 |
#!/bin/bash |
2 |
||
3 |
set -e |
|
4 |
||
5 |
tests=0 |
|
6 |
failed=0 |
|
7 |
H=$PWD |
|
8 |
||
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
9 |
function run_one |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
10 |
{ |
382
37249c522770
test suite: fix timezone problems and port collision problem
mpm@selenic.com
parents:
362
diff
changeset
|
11 |
export TZ=GMT |
331 | 12 |
D=`mktemp -d` |
13 |
if [ "$D" == "" ] ; then |
|
14 |
echo mktemp failed! |
|
15 |
fi |
|
16 |
||
17 |
cd $D |
|
18 |
fail=0 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
19 |
|
331 | 20 |
if ! $H/$f > .out 2>&1 ; then |
21 |
echo $f failed with error code $? |
|
22 |
fail=1 |
|
23 |
fi |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
24 |
|
331 | 25 |
if [ -s .out -a ! -r $H/$f.out ] ; then |
26 |
echo $f generated unexpected output: |
|
27 |
cat .out |
|
28 |
cp .out $H/$f.err |
|
29 |
fail=1 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
30 |
elif [ -r $H/$f.out ] && ! diff -u $H/$f.out .out > /dev/null ; then |
331 | 31 |
echo $f output changed: |
32 |
diff -u $H/$f.out .out && true |
|
33 |
cp .out $H/$f.err |
|
341
c0deea64ce64
run-tests: actually mark changed output as failure
mpm@selenic.com
parents:
331
diff
changeset
|
34 |
fail=1 |
331 | 35 |
fi |
36 |
||
37 |
cd $H |
|
38 |
rm -r $D |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
39 |
return $fail |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
40 |
} |
331 | 41 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
42 |
TESTS=$@ |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
43 |
if [ "$TESTS" == "" ] ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
44 |
TESTS=`ls test-* | grep -Ev "\.|~"` |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
45 |
fi |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
46 |
|
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
47 |
for f in $TESTS ; do |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
48 |
echo -n "." |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
49 |
if ! run_one $f ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
50 |
failed=$[$failed + 1] |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
51 |
fi |
331 | 52 |
tests=$[$tests + 1] |
53 |
done |
|
54 |
||
55 |
echo |
|
56 |
echo Ran $tests tests, $failed failed |
|
57 |
||
58 |
if [ $failed -gt 0 ] ; then |
|
59 |
exit 1 |
|
60 |
fi |
|
61 |