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