Show More
@@ -1,28 +1,51 b'' | |||
|
1 | 1 | #!/bin/sh -e |
|
2 | 2 | |
|
3 |
export LANG |
|
|
4 |
export LC_CTYPE |
|
|
5 |
export LC_NUMERIC |
|
|
6 |
export LC_TIME |
|
|
7 |
export LC_COLLATE |
|
|
8 |
export LC_MONETARY |
|
|
9 |
export LC_MESSAGES |
|
|
10 |
export LC_PAPER |
|
|
11 |
export LC_NAME |
|
|
12 |
export LC_ADDRESS |
|
|
13 |
export LC_TELEPHONE |
|
|
14 |
export LC_MEASUREMENT |
|
|
15 |
export LC_IDENTIFICATION |
|
|
16 |
export LC_ALL |
|
|
17 | export HGEDITOR=true | |
|
18 | export HGMERGE=true | |
|
19 | export HGUSER=test | |
|
3 | LANG="C"; export LANG | |
|
4 | LC_CTYPE="C"; export LC_CTYPE | |
|
5 | LC_NUMERIC="C"; export LC_NUMERIC | |
|
6 | LC_TIME="C"; export LC_TIME | |
|
7 | LC_COLLATE="C"; export LC_COLLATE | |
|
8 | LC_MONETARY="C"; export LC_MONETARY | |
|
9 | LC_MESSAGES="C"; export LC_MESSAGES | |
|
10 | LC_PAPER="C"; export LC_PAPER | |
|
11 | LC_NAME="C"; export LC_NAME | |
|
12 | LC_ADDRESS="C"; export LC_ADDRESS | |
|
13 | LC_TELEPHONE="C"; export LC_TELEPHONE | |
|
14 | LC_MEASUREMENT="C"; export LC_MEASUREMENT | |
|
15 | LC_IDENTIFICATION="C"; export LC_IDENTIFICATION | |
|
16 | LC_ALL=""; export LC_ALL | |
|
17 | TZ=GMT; export TZ | |
|
18 | HGEDITOR=true; export HGEDITOR | |
|
19 | HGMERGE=true; export HGMERGE | |
|
20 | HGUSER="test"; export HGUSER | |
|
20 | 21 | |
|
21 | 22 | umask 022 |
|
22 | 23 | |
|
24 | if [ "$[1+1]" = "2" ]; then | |
|
25 | use_arithmetic=true | |
|
26 | else | |
|
27 | use_arithmetic=false | |
|
28 | fi | |
|
29 | ||
|
23 | 30 | tests=0 |
|
24 | 31 | failed=0 |
|
25 | H=$PWD | |
|
32 | ||
|
33 | HGTMP="" | |
|
34 | cleanup_exit() { | |
|
35 | rm -rf "$HGTMP" | |
|
36 | exit $1 | |
|
37 | } | |
|
38 | ||
|
39 | # Remove temporary files even if we get interrupted | |
|
40 | trap "cleanup_exit 255" TERM KILL INT QUIT ABRT | |
|
41 | ||
|
42 | HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$" | |
|
43 | (umask 077 && mkdir "$HGTMP") || { | |
|
44 | echo "Could not create temporary directory! Exiting." 1>&2 | |
|
45 | exit 1 | |
|
46 | } | |
|
47 | ||
|
48 | TESTDIR="$PWD" | |
|
26 | 49 | |
|
27 | 50 | if [ -d /usr/lib64 ]; then |
|
28 | 51 | lib=lib64 |
@@ -30,73 +53,99 b' else' | |||
|
30 | 53 | lib=lib |
|
31 | 54 | fi |
|
32 | 55 | |
|
33 | TESTPATH=$PWD/install/bin | |
|
34 | export PATH=$TESTPATH:$PATH | |
|
35 | export PYTHONPATH=$PWD/install/$lib/python | |
|
36 | ||
|
37 | rm -rf install | |
|
56 | INST="$HGTMP/install" | |
|
38 | 57 | cd .. |
|
39 |
${PYTHON:-python} setup.py install --home= |
|
|
40 | if [ $? != 0 ] ; then | |
|
58 | if ${PYTHON:-python} setup.py install --home="$INST" > tests/install.err 2>&1 | |
|
59 | then | |
|
60 | rm tests/install.err | |
|
61 | mv "$INST/bin/hg" "$INST/bin/hg.real" | |
|
62 | ( | |
|
63 | echo '#!/bin/sh' | |
|
64 | echo 'echo "+ hg $@"' | |
|
65 | echo 'exec hg.real "$@"' | |
|
66 | ) > "$INST/bin/hg" | |
|
67 | chmod 755 "$INST/bin/hg" | |
|
68 | else | |
|
41 | 69 | cat tests/install.err |
|
70 | cleanup_exit 1 | |
|
42 | 71 | fi |
|
43 | cd $H | |
|
44 | rm install.err | |
|
72 | cd "$TESTDIR" | |
|
45 | 73 | |
|
46 | function run_one | |
|
47 | { | |
|
48 | rm -f $1.err | |
|
49 | export TZ=GMT | |
|
50 | D=`mktemp -d ${TMP-/tmp}/tmp.XXXXXX` | |
|
51 | if [ "$D" = "" ] ; then | |
|
52 | echo mktemp failed! | |
|
53 | fi | |
|
74 | PATH="$INST/bin:$PATH"; export PATH | |
|
75 | PYTHONPATH="$INST/$lib/python"; export PYTHONPATH | |
|
76 | ||
|
77 | ||
|
78 | run_one() { | |
|
79 | rm -f "$1.err" | |
|
54 | 80 | |
|
55 | cd $D | |
|
81 | mkdir "$HGTMP/$1" | |
|
82 | cd "$HGTMP/$1" | |
|
56 | 83 | fail=0 |
|
57 | export HOME=$D | |
|
84 | HOME="$HGTMP/$1"; export HOME | |
|
85 | OUT="$HGTMP/$1.out" | |
|
86 | OUTOK="$TESTDIR/$1.out" | |
|
87 | ERR="$TESTDIR/$1.err" | |
|
58 | 88 | |
|
59 |
if |
|
|
60 | echo $1 failed with error code $? | |
|
89 | if "$TESTDIR/$1" > "$OUT" 2>&1; then | |
|
90 | : no error | |
|
91 | else | |
|
92 | echo "$1 failed with error code $?" | |
|
61 | 93 | fail=1 |
|
62 | 94 | fi |
|
63 | 95 | |
|
64 |
if [ -s |
|
|
65 | echo $1 generated unexpected output: | |
|
66 | cat .out | |
|
67 | cp .out $H/$1.err | |
|
96 | if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then | |
|
97 | cp "$OUT" "$ERR" | |
|
98 | echo | |
|
99 | echo "$1 generated unexpected output:" | |
|
100 | cat "$ERR" | |
|
68 | 101 | fail=1 |
|
69 | elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then | |
|
70 | echo $1 output changed: | |
|
71 | diff -u $H/$1.out .out && true | |
|
72 | cp .out $H/$1.err | |
|
73 | fail=1 | |
|
102 | elif [ -r "$OUTOK" ]; then | |
|
103 | if diff -u "$OUTOK" "$OUT" > /dev/null; then | |
|
104 | : no differences | |
|
105 | else | |
|
106 | cp "$OUT" "$ERR" | |
|
107 | echo | |
|
108 | echo "$1 output changed:" | |
|
109 | diff -u "$OUTOK" "$ERR" || true | |
|
110 | fail=1 | |
|
111 | fi | |
|
74 | 112 | fi |
|
75 | 113 | |
|
76 |
cd |
|
|
77 | rm -r $D | |
|
114 | cd "$TESTDIR" | |
|
115 | rm -f "$HGTMP/$1.out" | |
|
116 | rm -rf "$HGTMP/$1" | |
|
78 | 117 | return $fail |
|
79 | 118 | } |
|
80 | 119 | |
|
81 | TESTS=$@ | |
|
82 |
if [ "$TESTS |
|
|
120 | TESTS="$@" | |
|
121 | if [ -z "$TESTS" ] ; then | |
|
83 | 122 | TESTS=`ls test-* | grep -Ev "\.|~"` |
|
84 | 123 | fi |
|
85 | 124 | |
|
86 | 125 | for f in $TESTS ; do |
|
87 | 126 | echo -n "." |
|
88 | if ! run_one $f ; then | |
|
89 | failed=$[$failed + 1] | |
|
127 | if $use_arithmetic; then | |
|
128 | run_one $f || failed=$[$failed + 1] | |
|
129 | tests=$[$tests + 1] | |
|
130 | else | |
|
131 | run_one $f || failed=1 | |
|
90 | 132 | fi |
|
91 | tests=$[$tests + 1] | |
|
92 | 133 | done |
|
93 | 134 | |
|
94 | rm -rf install | |
|
95 | ||
|
96 | echo | |
|
97 | echo Ran $tests tests, $failed failed | |
|
135 | if $use_arithmetic; then | |
|
136 | echo | |
|
137 | echo "Ran $tests tests, $failed failed." | |
|
98 | 138 | |
|
99 | if [ $failed -gt 0 ] ; then | |
|
100 | exit 1 | |
|
139 | if [ $failed -gt 0 ] ; then | |
|
140 | cleanup_exit 1 | |
|
141 | fi | |
|
142 | else | |
|
143 | echo | |
|
144 | if [ "$failed" = "1" ] ; then | |
|
145 | echo "Ran tests, at least one failed." | |
|
146 | cleanup_exit 1 | |
|
147 | else | |
|
148 | echo "Ran tests, none failed." | |
|
149 | fi | |
|
101 | 150 | fi |
|
102 | ||
|
151 | cleanup_exit 0 |
General Comments 0
You need to be logged in to leave comments.
Login now