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