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