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