Show More
@@ -1,78 +1,77 b'' | |||||
1 | #!/bin/bash |
|
1 | #!/bin/bash | |
2 |
|
2 | |||
3 | set -e |
|
3 | set -e | |
4 |
|
4 | |||
5 | tests=0 |
|
5 | tests=0 | |
6 | failed=0 |
|
6 | failed=0 | |
7 | H=$PWD |
|
7 | H=$PWD | |
8 |
|
8 | |||
9 | TESTPATH=$PWD/install/bin |
|
9 | TESTPATH=$PWD/install/bin | |
10 | export PATH=$TESTPATH:$PATH |
|
10 | export PATH=$TESTPATH:$PATH | |
11 | export PYTHONPATH=$PWD/install/lib/python |
|
11 | export PYTHONPATH=$PWD/install/lib/python | |
12 |
|
12 | |||
13 | rm -rf install |
|
13 | rm -rf install | |
14 | cd .. |
|
14 | cd .. | |
15 | ${PYTHON:-python} setup.py install --home=tests/install > tests/install.err |
|
15 | ${PYTHON:-python} setup.py install --home=tests/install > tests/install.err | |
16 | if [ $? != 0 ] ; then |
|
16 | if [ $? != 0 ] ; then | |
17 | cat tests/install.err |
|
17 | cat tests/install.err | |
18 | fi |
|
18 | fi | |
19 | cd $H |
|
19 | cd $H | |
20 | rm install.err |
|
20 | rm install.err | |
21 |
|
21 | |||
22 | function run_one |
|
22 | function run_one | |
23 | { |
|
23 | { | |
|
24 | rm -f $1.err | |||
24 | export TZ=GMT |
|
25 | export TZ=GMT | |
25 | D=`mktemp -d` |
|
26 | D=`mktemp -d` | |
26 | if [ "$D" == "" ] ; then |
|
27 | if [ "$D" == "" ] ; then | |
27 | echo mktemp failed! |
|
28 | echo mktemp failed! | |
28 | fi |
|
29 | fi | |
29 |
|
30 | |||
30 | cd $D |
|
31 | cd $D | |
31 | fail=0 |
|
32 | fail=0 | |
32 |
|
33 | |||
33 |
if ! $H/$ |
|
34 | if ! $H/$1 > .out 2>&1 ; then | |
34 |
echo $ |
|
35 | echo $1 failed with error code $? | |
35 | fail=1 |
|
36 | fail=1 | |
36 | fi |
|
37 | fi | |
37 |
|
38 | |||
38 |
if [ -s .out -a ! -r $H/$ |
|
39 | if [ -s .out -a ! -r $H/$1.out ] ; then | |
39 |
echo $ |
|
40 | echo $1 generated unexpected output: | |
40 | cat .out |
|
41 | cat .out | |
41 |
cp .out $H/$ |
|
42 | cp .out $H/$1.err | |
42 | fail=1 |
|
43 | fail=1 | |
43 |
elif [ -r $H/$ |
|
44 | elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then | |
44 |
echo $ |
|
45 | echo $1 output changed: | |
45 |
diff -u $H/$ |
|
46 | diff -u $H/$1.out .out && true | |
46 |
cp .out $H/$ |
|
47 | cp .out $H/$1.err | |
47 | fail=1 |
|
48 | fail=1 | |
48 | fi |
|
49 | fi | |
49 |
|
50 | |||
50 | cd $H |
|
51 | cd $H | |
51 | rm -r $D |
|
52 | rm -r $D | |
52 | return $fail |
|
53 | return $fail | |
53 | } |
|
54 | } | |
54 |
|
55 | |||
55 | TESTS=$@ |
|
56 | TESTS=$@ | |
56 | if [ "$TESTS" == "" ] ; then |
|
57 | if [ "$TESTS" == "" ] ; then | |
57 | TESTS=`ls test-* | grep -Ev "\.|~"` |
|
58 | TESTS=`ls test-* | grep -Ev "\.|~"` | |
58 | fi |
|
59 | fi | |
59 |
|
60 | |||
60 | rm -f test-*.err |
|
|||
61 |
|
||||
62 | for f in $TESTS ; do |
|
61 | for f in $TESTS ; do | |
63 | echo -n "." |
|
62 | echo -n "." | |
64 | if ! run_one $f ; then |
|
63 | if ! run_one $f ; then | |
65 | failed=$[$failed + 1] |
|
64 | failed=$[$failed + 1] | |
66 | fi |
|
65 | fi | |
67 | tests=$[$tests + 1] |
|
66 | tests=$[$tests + 1] | |
68 | done |
|
67 | done | |
69 |
|
68 | |||
70 | rm -rf install |
|
69 | rm -rf install | |
71 |
|
70 | |||
72 | echo |
|
71 | echo | |
73 | echo Ran $tests tests, $failed failed |
|
72 | echo Ran $tests tests, $failed failed | |
74 |
|
73 | |||
75 | if [ $failed -gt 0 ] ; then |
|
74 | if [ $failed -gt 0 ] ; then | |
76 | exit 1 |
|
75 | exit 1 | |
77 | fi |
|
76 | fi | |
78 |
|
77 |
General Comments 0
You need to be logged in to leave comments.
Login now