author | mpm@selenic.com |
Wed, 29 Jun 2005 10:46:41 -0800 | |
changeset 517 | 9b884be92af2 |
parent 495 | e94cebc60d96 |
child 544 | 3d4d5f2aba9a |
child 547 | 4fc63e22b1fe |
permissions | -rwxr-xr-x |
331 | 1 |
#!/bin/bash |
2 |
||
3 |
set -e |
|
4 |
||
488
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
5 |
export LANG=C |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
6 |
export LC_CTYPE="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
7 |
export LC_NUMERIC="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
8 |
export LC_TIME="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
9 |
export LC_COLLATE="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
10 |
export LC_MONETARY="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
11 |
export LC_MESSAGES="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
12 |
export LC_PAPER="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
13 |
export LC_NAME="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
14 |
export LC_ADDRESS="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
15 |
export LC_TELEPHONE="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
16 |
export LC_MEASUREMENT="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
17 |
export LC_IDENTIFICATION="C" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
18 |
export LC_ALL="" |
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
19 |
|
489 | 20 |
umask 022 |
21 |
||
331 | 22 |
tests=0 |
23 |
failed=0 |
|
24 |
H=$PWD |
|
25 |
||
473
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
26 |
if [ -d /usr/lib64 ]; then |
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
27 |
lib=lib64 |
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
28 |
else |
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
29 |
lib=lib |
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
30 |
fi |
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
31 |
|
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
32 |
TESTPATH=$PWD/install/bin |
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
33 |
export PATH=$TESTPATH:$PATH |
473
5914e27dc717
[PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents:
429
diff
changeset
|
34 |
export PYTHONPATH=$PWD/install/$lib/python |
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
35 |
|
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
36 |
rm -rf install |
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
37 |
cd .. |
398 | 38 |
${PYTHON:-python} setup.py install --home=tests/install > tests/install.err |
39 |
if [ $? != 0 ] ; then |
|
40 |
cat tests/install.err |
|
41 |
fi |
|
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
42 |
cd $H |
398 | 43 |
rm install.err |
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
44 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
45 |
function run_one |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
46 |
{ |
399 | 47 |
rm -f $1.err |
382
37249c522770
test suite: fix timezone problems and port collision problem
mpm@selenic.com
parents:
362
diff
changeset
|
48 |
export TZ=GMT |
331 | 49 |
D=`mktemp -d` |
50 |
if [ "$D" == "" ] ; then |
|
51 |
echo mktemp failed! |
|
52 |
fi |
|
53 |
||
54 |
cd $D |
|
55 |
fail=0 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
56 |
|
399 | 57 |
if ! $H/$1 > .out 2>&1 ; then |
58 |
echo $1 failed with error code $? |
|
331 | 59 |
fail=1 |
60 |
fi |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
61 |
|
399 | 62 |
if [ -s .out -a ! -r $H/$1.out ] ; then |
63 |
echo $1 generated unexpected output: |
|
331 | 64 |
cat .out |
399 | 65 |
cp .out $H/$1.err |
331 | 66 |
fail=1 |
399 | 67 |
elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then |
68 |
echo $1 output changed: |
|
69 |
diff -u $H/$1.out .out && true |
|
70 |
cp .out $H/$1.err |
|
341
c0deea64ce64
run-tests: actually mark changed output as failure
mpm@selenic.com
parents:
331
diff
changeset
|
71 |
fail=1 |
331 | 72 |
fi |
73 |
||
74 |
cd $H |
|
75 |
rm -r $D |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
76 |
return $fail |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
77 |
} |
331 | 78 |
|
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
79 |
TESTS=$@ |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
80 |
if [ "$TESTS" == "" ] ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
81 |
TESTS=`ls test-* | grep -Ev "\.|~"` |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
82 |
fi |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
83 |
|
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
84 |
for f in $TESTS ; do |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
85 |
echo -n "." |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
86 |
if ! run_one $f ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
87 |
failed=$[$failed + 1] |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
88 |
fi |
331 | 89 |
tests=$[$tests + 1] |
90 |
done |
|
91 |
||
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
92 |
rm -rf install |
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
93 |
|
331 | 94 |
echo |
95 |
echo Ran $tests tests, $failed failed |
|
96 |
||
97 |
if [ $failed -gt 0 ] ; then |
|
98 |
exit 1 |
|
99 |
fi |
|
100 |