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