##// END OF EJS Templates
tests: share dummyssh
Mads Kiilerich -
r14186:8513bd2e default
parent child Browse files
Show More
@@ -0,0 +1,20 b''
1 #!/usr/bin/env python
2
3 import sys
4 import os
5
6 os.chdir(os.getenv('TESTTMP'))
7
8 if sys.argv[1] != "user@dummy":
9 sys.exit(-1)
10
11 os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
12
13 log = open("dummylog", "ab")
14 log.write("Got arguments")
15 for i, arg in enumerate(sys.argv[1:]):
16 log.write(" %d:%s" % (i+1, arg))
17 log.write("\n")
18 log.close()
19 r = os.system(sys.argv[2])
20 sys.exit(bool(r))
@@ -1,26 +1,5 b''
1 This test tries to exercise the ssh functionality with a dummy script
1 This test tries to exercise the ssh functionality with a dummy script
2
2
3 $ cat <<EOF > dummyssh
4 > import sys
5 > import os
6 >
7 > os.chdir(os.path.dirname(sys.argv[0]))
8 > if sys.argv[1] != "user@dummy":
9 > sys.exit(-1)
10 >
11 > if not os.path.exists("dummyssh"):
12 > sys.exit(-1)
13 >
14 > log = open("dummylog", "ab")
15 > log.write("Got arguments")
16 > for i, arg in enumerate(sys.argv[1:]):
17 > log.write(" %d:%s" % (i+1, arg))
18 > log.write("\n")
19 > log.close()
20 > r = os.system(sys.argv[2])
21 > sys.exit(bool(r))
22 > EOF
23
24 $ checknewrepo()
3 $ checknewrepo()
25 > {
4 > {
26 > name=$1
5 > name=$1
@@ -80,7 +59,7 b' test failure'
80
59
81 init+push to remote2
60 init+push to remote2
82
61
83 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote2
62 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
84 $ hg incoming -R remote2 local
63 $ hg incoming -R remote2 local
85 comparing with local
64 comparing with local
86 changeset: 0:08b9e9f63b32
65 changeset: 0:08b9e9f63b32
@@ -90,7 +69,7 b' init+push to remote2'
90 summary: init
69 summary: init
91
70
92
71
93 $ hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
72 $ hg push -R local -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
94 pushing to ssh://user@dummy/remote2
73 pushing to ssh://user@dummy/remote2
95 searching for changes
74 searching for changes
96 remote: adding changesets
75 remote: adding changesets
@@ -100,7 +79,7 b' init+push to remote2'
100
79
101 clone to remote1
80 clone to remote1
102
81
103 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
82 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
104 searching for changes
83 searching for changes
105 remote: adding changesets
84 remote: adding changesets
106 remote: adding manifests
85 remote: adding manifests
@@ -109,14 +88,14 b' clone to remote1'
109
88
110 init to existing repo
89 init to existing repo
111
90
112 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote1
91 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote1
113 abort: repository remote1 already exists!
92 abort: repository remote1 already exists!
114 abort: could not create remote repo!
93 abort: could not create remote repo!
115 [255]
94 [255]
116
95
117 clone to existing repo
96 clone to existing repo
118
97
119 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
98 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
120 abort: repository remote1 already exists!
99 abort: repository remote1 already exists!
121 abort: could not create remote repo!
100 abort: could not create remote repo!
122 [255]
101 [255]
@@ -205,7 +184,7 b' clone bookmarks'
205 $ hg -R local bookmark test
184 $ hg -R local bookmark test
206 $ hg -R local bookmarks
185 $ hg -R local bookmarks
207 * test 0:08b9e9f63b32
186 * test 0:08b9e9f63b32
208 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote-bookmarks
187 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote-bookmarks
209 searching for changes
188 searching for changes
210 remote: adding changesets
189 remote: adding changesets
211 remote: adding manifests
190 remote: adding manifests
@@ -1,29 +1,6 b''
1 This test tries to exercise the ssh functionality with a dummy script
1 This test tries to exercise the ssh functionality with a dummy script
2
2
3 $ cat <<EOF > dummyssh
3 creating 'remote' repo
4 > import sys
5 > import os
6 >
7 > os.chdir(os.path.dirname(sys.argv[0]))
8 > if sys.argv[1] != "user@dummy":
9 > sys.exit(-1)
10 >
11 > if not os.path.exists("dummyssh"):
12 > sys.exit(-1)
13 >
14 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
15 >
16 > log = open("dummylog", "ab")
17 > log.write("Got arguments")
18 > for i, arg in enumerate(sys.argv[1:]):
19 > log.write(" %d:%s" % (i+1, arg))
20 > log.write("\n")
21 > log.close()
22 > r = os.system(sys.argv[2])
23 > sys.exit(bool(r))
24 > EOF
25
26 creating 'remote
27
4
28 $ hg init remote
5 $ hg init remote
29 $ cd remote
6 $ cd remote
@@ -40,7 +17,7 b" creating 'remote"
40 clone remote via stream
17 clone remote via stream
41
18
42 $ for i in 0 1 2 3 4 5 6 7 8; do
19 $ for i in 0 1 2 3 4 5 6 7 8; do
43 > hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i"
20 > hg clone -e "python $TESTDIR/dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i"
44 > if cd test-"$i"; then
21 > if cd test-"$i"; then
45 > hg verify
22 > hg verify
46 > cd ..
23 > cd ..
@@ -162,7 +139,7 b' clone remote via stream'
162 4 files, 9 changesets, 7 total revisions
139 4 files, 9 changesets, 7 total revisions
163 $ cd ..
140 $ cd ..
164 $ cd test-1
141 $ cd test-1
165 $ hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote
142 $ hg pull -e "python $TESTDIR/dummyssh" -r 4 ssh://user@dummy/remote
166 pulling from ssh://user@dummy/remote
143 pulling from ssh://user@dummy/remote
167 searching for changes
144 searching for changes
168 adding changesets
145 adding changesets
@@ -176,7 +153,7 b' clone remote via stream'
176 crosschecking files in changesets and manifests
153 crosschecking files in changesets and manifests
177 checking files
154 checking files
178 1 files, 3 changesets, 2 total revisions
155 1 files, 3 changesets, 2 total revisions
179 $ hg pull -e "python ../dummyssh" ssh://user@dummy/remote
156 $ hg pull -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote
180 pulling from ssh://user@dummy/remote
157 pulling from ssh://user@dummy/remote
181 searching for changes
158 searching for changes
182 adding changesets
159 adding changesets
@@ -186,7 +163,7 b' clone remote via stream'
186 (run 'hg update' to get a working copy)
163 (run 'hg update' to get a working copy)
187 $ cd ..
164 $ cd ..
188 $ cd test-2
165 $ cd test-2
189 $ hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote
166 $ hg pull -e "python $TESTDIR/dummyssh" -r 5 ssh://user@dummy/remote
190 pulling from ssh://user@dummy/remote
167 pulling from ssh://user@dummy/remote
191 searching for changes
168 searching for changes
192 adding changesets
169 adding changesets
@@ -200,7 +177,7 b' clone remote via stream'
200 crosschecking files in changesets and manifests
177 crosschecking files in changesets and manifests
201 checking files
178 checking files
202 1 files, 5 changesets, 3 total revisions
179 1 files, 5 changesets, 3 total revisions
203 $ hg pull -e "python ../dummyssh" ssh://user@dummy/remote
180 $ hg pull -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote
204 pulling from ssh://user@dummy/remote
181 pulling from ssh://user@dummy/remote
205 searching for changes
182 searching for changes
206 adding changesets
183 adding changesets
@@ -2,33 +2,6 b''
2
2
3 This test tries to exercise the ssh functionality with a dummy script
3 This test tries to exercise the ssh functionality with a dummy script
4
4
5 $ cat <<EOF > dummyssh
6 > import sys
7 > import os
8 >
9 > os.chdir(os.path.dirname(sys.argv[0]))
10 > if sys.argv[1] != "user@dummy":
11 > sys.exit(-1)
12 >
13 > if not os.path.exists("dummyssh"):
14 > sys.exit(-1)
15 >
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
17 >
18 > log = open("dummylog", "ab")
19 > log.write("Got arguments")
20 > for i, arg in enumerate(sys.argv[1:]):
21 > log.write(" %d:%s" % (i+1, arg))
22 > log.write("\n")
23 > log.close()
24 > r = os.system(sys.argv[2])
25 > sys.exit(bool(r))
26 > EOF
27 $ cat <<EOF > badhook
28 > import sys
29 > sys.stdout.write("KABOOM\n")
30 > EOF
31
32 creating 'remote' repo
5 creating 'remote' repo
33
6
34 $ hg init remote
7 $ hg init remote
@@ -47,21 +20,21 b" creating 'remote' repo"
47
20
48 repo not found error
21 repo not found error
49
22
50 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
23 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/nonexistent local
51 remote: abort: There is no Mercurial repository here (.hg not found)!
24 remote: abort: There is no Mercurial repository here (.hg not found)!
52 abort: no suitable response from remote hg!
25 abort: no suitable response from remote hg!
53 [255]
26 [255]
54
27
55 non-existent absolute path
28 non-existent absolute path
56
29
57 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
30 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy//`pwd`/nonexistent local
58 remote: abort: There is no Mercurial repository here (.hg not found)!
31 remote: abort: There is no Mercurial repository here (.hg not found)!
59 abort: no suitable response from remote hg!
32 abort: no suitable response from remote hg!
60 [255]
33 [255]
61
34
62 clone remote via stream
35 clone remote via stream
63
36
64 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
37 $ hg clone -e "python $TESTDIR/dummyssh" --uncompressed ssh://user@dummy/remote local-stream
65 streaming all changes
38 streaming all changes
66 4 files to transfer, 392 bytes of data
39 4 files to transfer, 392 bytes of data
67 transferred 392 bytes in * seconds (*/sec) (glob)
40 transferred 392 bytes in * seconds (*/sec) (glob)
@@ -78,7 +51,7 b' clone remote via stream'
78
51
79 clone remote via pull
52 clone remote via pull
80
53
81 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
54 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local
82 requesting all changes
55 requesting all changes
83 adding changesets
56 adding changesets
84 adding manifests
57 adding manifests
@@ -103,7 +76,7 b' empty default pull'
103
76
104 $ hg paths
77 $ hg paths
105 default = ssh://user@dummy/remote
78 default = ssh://user@dummy/remote
106 $ hg pull -e "python ../dummyssh"
79 $ hg pull -e "python $TESTDIR/dummyssh"
107 pulling from ssh://user@dummy/remote
80 pulling from ssh://user@dummy/remote
108 searching for changes
81 searching for changes
109 no changes found
82 no changes found
@@ -117,7 +90,7 b' updating rc'
117
90
118 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
91 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
119 $ echo "[ui]" >> .hg/hgrc
92 $ echo "[ui]" >> .hg/hgrc
120 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
93 $ echo "ssh = python $TESTDIR/dummyssh" >> .hg/hgrc
121
94
122 find outgoing
95 find outgoing
123
96
@@ -133,7 +106,7 b' find outgoing'
133
106
134 find incoming on the remote side
107 find incoming on the remote side
135
108
136 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
109 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" ssh://user@dummy/local
137 comparing with ssh://user@dummy/local
110 comparing with ssh://user@dummy/local
138 searching for changes
111 searching for changes
139 changeset: 1:a28a9d1a809c
112 changeset: 1:a28a9d1a809c
@@ -145,7 +118,7 b' find incoming on the remote side'
145
118
146 find incoming on the remote side (using absolute path)
119 find incoming on the remote side (using absolute path)
147
120
148 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
121 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" "ssh://user@dummy/`pwd`"
149 comparing with ssh://user@dummy/$TESTTMP/local
122 comparing with ssh://user@dummy/$TESTTMP/local
150 searching for changes
123 searching for changes
151 changeset: 1:a28a9d1a809c
124 changeset: 1:a28a9d1a809c
@@ -190,7 +163,7 b' check remote tip'
190 test pushkeys and bookmarks
163 test pushkeys and bookmarks
191
164
192 $ cd ../local
165 $ cd ../local
193 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
166 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote namespaces
194 bookmarks
167 bookmarks
195 namespaces
168 namespaces
196 $ hg book foo -r 0
169 $ hg book foo -r 0
@@ -203,7 +176,7 b' test pushkeys and bookmarks'
203 searching for changes
176 searching for changes
204 no changes found
177 no changes found
205 exporting bookmark foo
178 exporting bookmark foo
206 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
179 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote bookmarks
207 foo 1160648e36cec0054048a7edc4110c6f84fde594
180 foo 1160648e36cec0054048a7edc4110c6f84fde594
208 $ hg book -f foo
181 $ hg book -f foo
209 $ hg push --traceback
182 $ hg push --traceback
@@ -231,8 +204,13 b' test pushkeys and bookmarks'
231
204
232 a bad, evil hook that prints to stdout
205 a bad, evil hook that prints to stdout
233
206
207 $ cat <<EOF > $TESTTMP/badhook
208 > import sys
209 > sys.stdout.write("KABOOM\n")
210 > EOF
211
234 $ echo '[hooks]' >> ../remote/.hg/hgrc
212 $ echo '[hooks]' >> ../remote/.hg/hgrc
235 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
213 $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
236 $ echo r > r
214 $ echo r > r
237 $ hg ci -A -m z r
215 $ hg ci -A -m z r
238
216
@@ -267,7 +245,7 b' clone bookmarks'
267 $ hg -R ../remote bookmark test
245 $ hg -R ../remote bookmark test
268 $ hg -R ../remote bookmarks
246 $ hg -R ../remote bookmarks
269 * test 2:6c0482d977a3
247 * test 2:6c0482d977a3
270 $ hg clone -e "python ../dummyssh" ssh://user@dummy/remote local-bookmarks
248 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local-bookmarks
271 requesting all changes
249 requesting all changes
272 adding changesets
250 adding changesets
273 adding manifests
251 adding manifests
General Comments 0
You need to be logged in to leave comments. Login now