Show More
@@ -1,140 +1,143 | |||||
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 | ECHO_N="echo -n" | |||
|
23 | [ -x /usr/ucb/echo ] && ECHO_N="/usr/ucb/echo -n" | |||
|
24 | ||||
22 | umask 022 |
|
25 | umask 022 | |
23 |
|
26 | |||
24 | tests=0 |
|
27 | tests=0 | |
25 | failed=0 |
|
28 | failed=0 | |
26 |
|
29 | |||
27 | HGTMP="" |
|
30 | HGTMP="" | |
28 | cleanup_exit() { |
|
31 | cleanup_exit() { | |
29 | rm -rf "$HGTMP" |
|
32 | rm -rf "$HGTMP" | |
30 | } |
|
33 | } | |
31 |
|
34 | |||
32 | # Remove temporary files even if we get interrupted |
|
35 | # Remove temporary files even if we get interrupted | |
33 | trap "cleanup_exit" 0 # normal exit |
|
36 | trap "cleanup_exit" 0 # normal exit | |
34 | trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM |
|
37 | trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM | |
35 |
|
38 | |||
36 | HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$" |
|
39 | HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$" | |
37 | (umask 077 && mkdir "$HGTMP") || { |
|
40 | (umask 077 && mkdir "$HGTMP") || { | |
38 | echo "Could not create temporary directory! Exiting." 1>&2 |
|
41 | echo "Could not create temporary directory! Exiting." 1>&2 | |
39 | exit 1 |
|
42 | exit 1 | |
40 | } |
|
43 | } | |
41 |
|
44 | |||
42 | TESTDIR="$PWD" |
|
45 | TESTDIR="$PWD" | |
43 | export TESTDIR |
|
46 | export TESTDIR | |
44 | INST="$HGTMP/install" |
|
47 | INST="$HGTMP/install" | |
45 | PYTHONDIR="$INST/lib/python" |
|
48 | PYTHONDIR="$INST/lib/python" | |
46 | cd .. |
|
49 | cd .. | |
47 | if ${PYTHON-python} setup.py install --home="$INST" \ |
|
50 | if ${PYTHON-python} setup.py install --home="$INST" \ | |
48 | --install-lib="$PYTHONDIR" > tests/install.err 2>&1 |
|
51 | --install-lib="$PYTHONDIR" > tests/install.err 2>&1 | |
49 | then |
|
52 | then | |
50 | rm tests/install.err |
|
53 | rm tests/install.err | |
51 | else |
|
54 | else | |
52 | cat tests/install.err |
|
55 | cat tests/install.err | |
53 | exit 1 |
|
56 | exit 1 | |
54 | fi |
|
57 | fi | |
55 | cd "$TESTDIR" |
|
58 | cd "$TESTDIR" | |
56 |
|
59 | |||
57 | PATH="$INST/bin:$PATH"; export PATH |
|
60 | PATH="$INST/bin:$PATH"; export PATH | |
58 | PYTHONPATH="$PYTHONDIR"; export PYTHONPATH |
|
61 | PYTHONPATH="$PYTHONDIR"; export PYTHONPATH | |
59 |
|
62 | |||
60 | run_one() { |
|
63 | run_one() { | |
61 | rm -f "$1.err" |
|
64 | rm -f "$1.err" | |
62 |
|
65 | |||
63 | mkdir "$HGTMP/$1" |
|
66 | mkdir "$HGTMP/$1" | |
64 | cd "$HGTMP/$1" |
|
67 | cd "$HGTMP/$1" | |
65 | fail=0 |
|
68 | fail=0 | |
66 | HOME="$HGTMP/$1"; export HOME |
|
69 | HOME="$HGTMP/$1"; export HOME | |
67 | OUT="$HGTMP/$1.out" |
|
70 | OUT="$HGTMP/$1.out" | |
68 | OUTOK="$TESTDIR/$1.out" |
|
71 | OUTOK="$TESTDIR/$1.out" | |
69 | ERR="$TESTDIR/$1.err" |
|
72 | ERR="$TESTDIR/$1.err" | |
70 |
|
73 | |||
71 | if "$TESTDIR/$1" > "$OUT" 2>&1; then |
|
74 | if "$TESTDIR/$1" > "$OUT" 2>&1; then | |
72 | : no error |
|
75 | : no error | |
73 | else |
|
76 | else | |
74 | echo "$1 failed with error code $?" |
|
77 | echo "$1 failed with error code $?" | |
75 | fail=1 |
|
78 | fail=1 | |
76 | fi |
|
79 | fi | |
77 |
|
80 | |||
78 | if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then |
|
81 | if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then | |
79 | cp "$OUT" "$ERR" |
|
82 | cp "$OUT" "$ERR" | |
80 | echo |
|
83 | echo | |
81 | echo "$1 generated unexpected output:" |
|
84 | echo "$1 generated unexpected output:" | |
82 | cat "$ERR" |
|
85 | cat "$ERR" | |
83 | fail=1 |
|
86 | fail=1 | |
84 | elif [ -r "$OUTOK" ]; then |
|
87 | elif [ -r "$OUTOK" ]; then | |
85 | if diff -u "$OUTOK" "$OUT" > /dev/null; then |
|
88 | if diff -u "$OUTOK" "$OUT" > /dev/null; then | |
86 | : no differences |
|
89 | : no differences | |
87 | else |
|
90 | else | |
88 | cp "$OUT" "$ERR" |
|
91 | cp "$OUT" "$ERR" | |
89 | echo |
|
92 | echo | |
90 | echo "$1 output changed:" |
|
93 | echo "$1 output changed:" | |
91 | diff -u "$OUTOK" "$ERR" || true |
|
94 | diff -u "$OUTOK" "$ERR" || true | |
92 | fail=1 |
|
95 | fail=1 | |
93 | fi |
|
96 | fi | |
94 | fi |
|
97 | fi | |
95 |
|
98 | |||
96 | cd "$TESTDIR" |
|
99 | cd "$TESTDIR" | |
97 | rm -f "$HGTMP/$1.out" |
|
100 | rm -f "$HGTMP/$1.out" | |
98 | rm -rf "$HGTMP/$1" |
|
101 | rm -rf "$HGTMP/$1" | |
99 | return $fail |
|
102 | return $fail | |
100 | } |
|
103 | } | |
101 |
|
104 | |||
102 | # list of prerequisite programs |
|
105 | # list of prerequisite programs | |
103 | # stuff from coreutils (cat, rm, etc) are not tested |
|
106 | # stuff from coreutils (cat, rm, etc) are not tested | |
104 | prereqs="python merge diff grep unzip gunzip sed" |
|
107 | prereqs="python merge diff grep unzip gunzip sed" | |
105 | missing='' |
|
108 | missing='' | |
106 | for pre in $prereqs ; do |
|
109 | for pre in $prereqs ; do | |
107 | if type $pre > /dev/null 2>&1 ; then |
|
110 | if type $pre > /dev/null 2>&1 ; then | |
108 | : prereq exists |
|
111 | : prereq exists | |
109 | else |
|
112 | else | |
110 | missing="$pre $missing" |
|
113 | missing="$pre $missing" | |
111 | fi |
|
114 | fi | |
112 | done |
|
115 | done | |
113 |
|
116 | |||
114 | if [ "$missing" != '' ] ; then |
|
117 | if [ "$missing" != '' ] ; then | |
115 | echo "ERROR: the test suite needs some programs to execute correctly." |
|
118 | echo "ERROR: the test suite needs some programs to execute correctly." | |
116 | echo "The following programs are missing: " |
|
119 | echo "The following programs are missing: " | |
117 | for pre in $missing; do |
|
120 | for pre in $missing; do | |
118 | echo " $pre" |
|
121 | echo " $pre" | |
119 | done |
|
122 | done | |
120 | exit 1 |
|
123 | exit 1 | |
121 | fi |
|
124 | fi | |
122 |
|
125 | |||
123 | TESTS="$*" |
|
126 | TESTS="$*" | |
124 | if [ -z "$TESTS" ] ; then |
|
127 | if [ -z "$TESTS" ] ; then | |
125 | TESTS=`ls test-* | grep -v "[.~]"` |
|
128 | TESTS=`ls test-* | grep -v "[.~]"` | |
126 | fi |
|
129 | fi | |
127 |
|
130 | |||
128 | for f in $TESTS ; do |
|
131 | for f in $TESTS ; do | |
129 | echo -n "." |
|
132 | $ECHO_N "." | |
130 | run_one $f || failed=`expr $failed + 1` |
|
133 | run_one $f || failed=`expr $failed + 1` | |
131 | tests=`expr $tests + 1` |
|
134 | tests=`expr $tests + 1` | |
132 | done |
|
135 | done | |
133 |
|
136 | |||
134 | echo |
|
137 | echo | |
135 | echo "Ran $tests tests, $failed failed." |
|
138 | echo "Ran $tests tests, $failed failed." | |
136 |
|
139 | |||
137 | if [ $failed -gt 0 ] ; then |
|
140 | if [ $failed -gt 0 ] ; then | |
138 | exit 1 |
|
141 | exit 1 | |
139 | fi |
|
142 | fi | |
140 | exit 0 |
|
143 | exit 0 |
@@ -1,39 +1,39 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | mkdir test |
|
3 | mkdir test | |
4 | cd test |
|
4 | cd test | |
5 | hg init |
|
5 | hg init | |
6 | echo foo>foo |
|
6 | echo foo>foo | |
7 | hg addremove |
|
7 | hg addremove | |
8 | hg commit -m 1 |
|
8 | hg commit -m 1 | |
9 | echo bar>bar |
|
9 | echo bar>bar | |
10 | hg addremove |
|
10 | hg addremove | |
11 | hg commit -m 2 |
|
11 | hg commit -m 2 | |
12 | mkdir baz |
|
12 | mkdir baz | |
13 | echo bletch>baz/bletch |
|
13 | echo bletch>baz/bletch | |
14 | hg addremove |
|
14 | hg addremove | |
15 | hg commit -m 3 |
|
15 | hg commit -m 3 | |
16 | echo "[web]" >> .hg/hgrc |
|
16 | echo "[web]" >> .hg/hgrc | |
17 | echo "name = test-archive" >> .hg/hgrc |
|
17 | echo "name = test-archive" >> .hg/hgrc | |
18 | echo "allowzip = true" >> .hg/hgrc |
|
18 | echo "allowzip = true" >> .hg/hgrc | |
19 | echo "allowgz = true" >> .hg/hgrc |
|
19 | echo "allowgz = true" >> .hg/hgrc | |
20 | echo "allowbz2 = true" >> .hg/hgrc |
|
20 | echo "allowbz2 = true" >> .hg/hgrc | |
21 | hg serve -p 20059 > /dev/null & |
|
21 | hg serve -p 20059 > /dev/null & | |
22 | sleep 1 # wait for server to be started |
|
22 | sleep 1 # wait for server to be started | |
23 |
|
23 | |||
24 | TIP=`hg id -v | cut -f1 -d' '` |
|
24 | TIP=`hg id -v | cut -f1 -d' '` | |
25 | QTIP=`hg id -q` |
|
25 | QTIP=`hg id -q` | |
26 | cat > getarchive.py <<EOF |
|
26 | cat > getarchive.py <<EOF | |
27 | import sys, urllib2 |
|
27 | import sys, urllib2 | |
28 | node, archive = sys.argv[1:] |
|
28 | node, archive = sys.argv[1:] | |
29 | f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' |
|
29 | f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' | |
30 | % (node, archive)) |
|
30 | % (node, archive)) | |
31 | sys.stdout.write(f.read()) |
|
31 | sys.stdout.write(f.read()) | |
32 | EOF |
|
32 | EOF | |
33 |
http_proxy= python getarchive.py "$TIP" gz | tar t |
|
33 | http_proxy= python getarchive.py "$TIP" gz | gunzip -dc - | tar tf - | sed "s/$QTIP/TIP/" | |
34 |
http_proxy= python getarchive.py "$TIP" bz2 | tar t |
|
34 | http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 -dc - | tar tf - | sed "s/$QTIP/TIP/" | |
35 | http_proxy= python getarchive.py "$TIP" zip > archive.zip |
|
35 | http_proxy= python getarchive.py "$TIP" zip > archive.zip | |
36 | unzip -t archive.zip | sed "s/$QTIP/TIP/" |
|
36 | unzip -t archive.zip | sed "s/$QTIP/TIP/" | |
37 |
|
37 | |||
38 | kill $! |
|
38 | kill $! | |
39 | sleep 1 # wait for server to scream and die |
|
39 | sleep 1 # wait for server to scream and die |
@@ -1,16 +1,16 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | hg init |
|
3 | hg init | |
4 | echo "nothing" > a |
|
4 | echo "nothing" > a | |
5 | hg add a |
|
5 | hg add a | |
6 | hg commit -m ancestor -d "0 0" |
|
6 | hg commit -m ancestor -d "0 0" | |
7 | echo "something" > a |
|
7 | echo "something" > a | |
8 | hg commit -m branch1 -d "0 0" |
|
8 | hg commit -m branch1 -d "0 0" | |
9 | hg co 0 |
|
9 | hg co 0 | |
10 | echo "something else" > a |
|
10 | echo "something else" > a | |
11 | hg commit -m branch2 -d "0 0" |
|
11 | hg commit -m branch2 -d "0 0" | |
12 | HGMERGE=merge; export HGMERGE |
|
12 | HGMERGE=merge; export HGMERGE | |
13 | hg up -m 1 |
|
13 | hg up -m 1 | |
14 | hg id |
|
14 | hg id | |
15 |
grep - |
|
15 | egrep -v ">>>|<<<" a | |
16 | hg status |
|
16 | hg status |
General Comments 0
You need to be logged in to leave comments.
Login now