author | Matt Mackall <mpm@selenic.com> |
Sun, 26 Sep 2010 13:41:32 -0500 | |
changeset 12414 | 858fe1e74785 |
parent 12409 | tests/test-ssh@0eaf7d32a5d8 |
child 12489 | d039c4285092 |
permissions | -rw-r--r-- |
1110 | 1 |
|
12414 | 2 |
$ cp "$TESTDIR"/printenv.py . |
4291
35b2e02367a5
test-ssh: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
3 |
|
12414 | 4 |
This test tries to exercise the ssh functionality with a dummy script |
1110 | 5 |
|
12414 | 6 |
$ cat <<EOF > dummyssh |
7 |
> import sys |
|
8 |
> import os |
|
9 |
> os.chdir(os.path.dirname(sys.argv[0])) |
|
10 |
> if sys.argv[1] != "user@dummy": |
|
11 |
> sys.exit(-1) |
|
12 |
> if not os.path.exists("dummyssh"): |
|
13 |
> sys.exit(-1) |
|
14 |
> os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" |
|
15 |
> log = open("dummylog", "ab") |
|
16 |
> log.write("Got arguments") |
|
17 |
> for i, arg in enumerate(sys.argv[1:]): |
|
18 |
> log.write(" %d:%s" % (i+1, arg)) |
|
19 |
> log.write("\n") |
|
20 |
> log.close() |
|
21 |
> r = os.system(sys.argv[2]) |
|
22 |
> sys.exit(bool(r)) |
|
23 |
> EOF |
|
24 |
$ cat <<EOF > badhook |
|
25 |
> import sys |
|
26 |
> sys.stdout.write("KABOOM\n") |
|
27 |
> EOF |
|
1110 | 28 |
|
12414 | 29 |
creating 'remote' |
4298
58517f6eb1ad
test-ssh: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4291
diff
changeset
|
30 |
|
12414 | 31 |
$ hg init remote |
32 |
$ cd remote |
|
33 |
$ echo this > foo |
|
34 |
$ echo this > fooO |
|
35 |
$ hg ci -A -m "init" foo fooO |
|
36 |
$ echo '[server]' > .hg/hgrc |
|
37 |
$ echo 'uncompressed = True' >> .hg/hgrc |
|
38 |
$ echo '[hooks]' >> .hg/hgrc |
|
39 |
$ echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc |
|
40 |
$ cd .. |
|
1110 | 41 |
|
12414 | 42 |
repo not found error |
43 |
||
44 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local |
|
45 |
remote: abort: There is no Mercurial repository here (.hg not found)! |
|
46 |
abort: no suitable response from remote hg! |
|
47 |
[255] |
|
48 |
||
49 |
non-existent absolute path |
|
1110 | 50 |
|
12414 | 51 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy//$HGTMP/nonexistent local |
52 |
remote: abort: There is no Mercurial repository here (.hg not found)! |
|
53 |
abort: no suitable response from remote hg! |
|
54 |
[255] |
|
55 |
||
56 |
clone remote via stream |
|
1110 | 57 |
|
12414 | 58 |
$ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \ |
59 |
> sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/' |
|
60 |
streaming all changes |
|
61 |
XXX files to transfer, XXX bytes of data |
|
62 |
transferred XXX bytes in XXX seconds (XXX XB/sec) |
|
63 |
updating to branch default |
|
64 |
XXX files updated, XXX files merged, XXX files removed, XXX files unresolved |
|
65 |
$ cd local-stream |
|
66 |
$ hg verify |
|
67 |
checking changesets |
|
68 |
checking manifests |
|
69 |
crosschecking files in changesets and manifests |
|
70 |
checking files |
|
71 |
2 files, 1 changesets, 2 total revisions |
|
72 |
$ cd .. |
|
73 |
||
74 |
clone remote via pull |
|
5978
7939c71f3132
sshrepo: be more careful while reading data
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4298
diff
changeset
|
75 |
|
12414 | 76 |
$ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local |
77 |
requesting all changes |
|
78 |
adding changesets |
|
79 |
adding manifests |
|
80 |
adding file changes |
|
81 |
added 1 changesets with 2 changes to 2 files |
|
82 |
updating to branch default |
|
83 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 |
||
85 |
verify |
|
1110 | 86 |
|
12414 | 87 |
$ cd local |
88 |
$ hg verify |
|
89 |
checking changesets |
|
90 |
checking manifests |
|
91 |
crosschecking files in changesets and manifests |
|
92 |
checking files |
|
93 |
2 files, 1 changesets, 2 total revisions |
|
94 |
$ echo '[hooks]' >> .hg/hgrc |
|
95 |
$ echo 'changegroup = python ../printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc |
|
1110 | 96 |
|
12414 | 97 |
empty default pull |
3275
7ae37d99d47e
ssh: make the error message more clear, add a testcase
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3095
diff
changeset
|
98 |
|
12414 | 99 |
$ hg paths |
100 |
default = ssh://user@dummy/remote |
|
101 |
$ hg pull -e "python ../dummyssh" |
|
102 |
pulling from ssh://user@dummy/remote |
|
103 |
searching for changes |
|
104 |
no changes found |
|
105 |
||
106 |
local change |
|
12409
0eaf7d32a5d8
test-ssh: test absolute paths in SSH URLs
Brodie Rao <brodie@bitheap.org>
parents:
12156
diff
changeset
|
107 |
|
12414 | 108 |
$ echo bleah > foo |
109 |
$ hg ci -m "add" |
|
110 |
||
111 |
updating rc |
|
112 |
||
113 |
$ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc |
|
114 |
$ echo "[ui]" >> .hg/hgrc |
|
115 |
$ echo "ssh = python ../dummyssh" >> .hg/hgrc |
|
116 |
||
117 |
find outgoing |
|
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2439
diff
changeset
|
118 |
|
12414 | 119 |
$ hg out ssh://user@dummy/remote |
120 |
comparing with ssh://user@dummy/remote |
|
121 |
searching for changes |
|
122 |
changeset: 1:a28a9d1a809c |
|
123 |
tag: tip |
|
124 |
user: test |
|
125 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
126 |
summary: add |
|
127 |
||
1110 | 128 |
|
12414 | 129 |
find incoming on the remote side |
1110 | 130 |
|
12414 | 131 |
$ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local |
132 |
comparing with ssh://user@dummy/local |
|
133 |
searching for changes |
|
134 |
changeset: 1:a28a9d1a809c |
|
135 |
tag: tip |
|
136 |
user: test |
|
137 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
138 |
summary: add |
|
139 |
||
1110 | 140 |
|
12414 | 141 |
push |
1110 | 142 |
|
12414 | 143 |
$ hg push |
144 |
pushing to ssh://user@dummy/remote |
|
145 |
searching for changes |
|
146 |
remote: adding changesets |
|
147 |
remote: adding manifests |
|
148 |
remote: adding file changes |
|
149 |
remote: added 1 changesets with 1 changes to 1 files |
|
150 |
$ cd ../remote |
|
151 |
||
152 |
check remote tip |
|
1110 | 153 |
|
12414 | 154 |
$ hg tip |
155 |
changeset: 1:a28a9d1a809c |
|
156 |
tag: tip |
|
157 |
user: test |
|
158 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
159 |
summary: add |
|
160 |
||
161 |
$ hg verify |
|
162 |
checking changesets |
|
163 |
checking manifests |
|
164 |
crosschecking files in changesets and manifests |
|
165 |
checking files |
|
166 |
2 files, 2 changesets, 3 total revisions |
|
167 |
$ hg cat -r tip foo |
|
168 |
bleah |
|
169 |
$ echo z > z |
|
170 |
$ hg ci -A -m z z |
|
171 |
created new head |
|
1982
70ba0c86da8b
Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1933
diff
changeset
|
172 |
|
12414 | 173 |
a bad, evil hook that prints to stdout |
1110 | 174 |
|
12414 | 175 |
$ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc |
176 |
$ cd ../local |
|
177 |
$ echo r > r |
|
178 |
$ hg ci -A -m z r |
|
179 |
||
180 |
push should succeed even though it has an unexpected response |
|
1110 | 181 |
|
12414 | 182 |
$ hg push |
183 |
pushing to ssh://user@dummy/remote |
|
184 |
searching for changes |
|
185 |
note: unsynced remote changes! |
|
186 |
remote: adding changesets |
|
187 |
remote: adding manifests |
|
188 |
remote: adding file changes |
|
189 |
remote: added 1 changesets with 1 changes to 1 files |
|
190 |
remote: KABOOM |
|
191 |
$ hg -R ../remote heads |
|
192 |
changeset: 3:1383141674ec |
|
193 |
tag: tip |
|
194 |
parent: 1:a28a9d1a809c |
|
195 |
user: test |
|
196 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
197 |
summary: z |
|
198 |
||
199 |
changeset: 2:6c0482d977a3 |
|
200 |
parent: 0:1160648e36ce |
|
201 |
user: test |
|
202 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
203 |
summary: z |
|
204 |
||
205 |
$ cd .. |
|
206 |
$ cat dummylog |
|
207 |
Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
208 |
Got arguments 1:user@dummy 2:hg -R */nonexistent serve --stdio (glob) |
|
209 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
210 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
211 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
212 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
213 |
Got arguments 1:user@dummy 2:hg -R local serve --stdio |
|
214 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
215 |
changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |
|
216 |
Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
217 |
changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |