##// 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 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 3 $ checknewrepo()
25 4 > {
26 5 > name=$1
@@ -80,7 +59,7 b' test failure'
80 59
81 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 63 $ hg incoming -R remote2 local
85 64 comparing with local
86 65 changeset: 0:08b9e9f63b32
@@ -90,7 +69,7 b' init+push to remote2'
90 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 73 pushing to ssh://user@dummy/remote2
95 74 searching for changes
96 75 remote: adding changesets
@@ -100,7 +79,7 b' init+push to remote2'
100 79
101 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 83 searching for changes
105 84 remote: adding changesets
106 85 remote: adding manifests
@@ -109,14 +88,14 b' clone to remote1'
109 88
110 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 92 abort: repository remote1 already exists!
114 93 abort: could not create remote repo!
115 94 [255]
116 95
117 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 99 abort: repository remote1 already exists!
121 100 abort: could not create remote repo!
122 101 [255]
@@ -205,7 +184,7 b' clone bookmarks'
205 184 $ hg -R local bookmark test
206 185 $ hg -R local bookmarks
207 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 188 searching for changes
210 189 remote: adding changesets
211 190 remote: adding manifests
@@ -1,29 +1,6 b''
1 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 > 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
3 creating 'remote' repo
27 4
28 5 $ hg init remote
29 6 $ cd remote
@@ -40,7 +17,7 b" creating 'remote"
40 17 clone remote via stream
41 18
42 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 21 > if cd test-"$i"; then
45 22 > hg verify
46 23 > cd ..
@@ -162,7 +139,7 b' clone remote via stream'
162 139 4 files, 9 changesets, 7 total revisions
163 140 $ cd ..
164 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 143 pulling from ssh://user@dummy/remote
167 144 searching for changes
168 145 adding changesets
@@ -176,7 +153,7 b' clone remote via stream'
176 153 crosschecking files in changesets and manifests
177 154 checking files
178 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 157 pulling from ssh://user@dummy/remote
181 158 searching for changes
182 159 adding changesets
@@ -186,7 +163,7 b' clone remote via stream'
186 163 (run 'hg update' to get a working copy)
187 164 $ cd ..
188 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 167 pulling from ssh://user@dummy/remote
191 168 searching for changes
192 169 adding changesets
@@ -200,7 +177,7 b' clone remote via stream'
200 177 crosschecking files in changesets and manifests
201 178 checking files
202 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 181 pulling from ssh://user@dummy/remote
205 182 searching for changes
206 183 adding changesets
@@ -2,33 +2,6 b''
2 2
3 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 5 creating 'remote' repo
33 6
34 7 $ hg init remote
@@ -47,21 +20,21 b" creating 'remote' repo"
47 20
48 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 24 remote: abort: There is no Mercurial repository here (.hg not found)!
52 25 abort: no suitable response from remote hg!
53 26 [255]
54 27
55 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 31 remote: abort: There is no Mercurial repository here (.hg not found)!
59 32 abort: no suitable response from remote hg!
60 33 [255]
61 34
62 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 38 streaming all changes
66 39 4 files to transfer, 392 bytes of data
67 40 transferred 392 bytes in * seconds (*/sec) (glob)
@@ -78,7 +51,7 b' clone remote via stream'
78 51
79 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 55 requesting all changes
83 56 adding changesets
84 57 adding manifests
@@ -103,7 +76,7 b' empty default pull'
103 76
104 77 $ hg paths
105 78 default = ssh://user@dummy/remote
106 $ hg pull -e "python ../dummyssh"
79 $ hg pull -e "python $TESTDIR/dummyssh"
107 80 pulling from ssh://user@dummy/remote
108 81 searching for changes
109 82 no changes found
@@ -117,7 +90,7 b' updating rc'
117 90
118 91 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
119 92 $ echo "[ui]" >> .hg/hgrc
120 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
93 $ echo "ssh = python $TESTDIR/dummyssh" >> .hg/hgrc
121 94
122 95 find outgoing
123 96
@@ -133,7 +106,7 b' find outgoing'
133 106
134 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 110 comparing with ssh://user@dummy/local
138 111 searching for changes
139 112 changeset: 1:a28a9d1a809c
@@ -145,7 +118,7 b' find incoming on the remote side'
145 118
146 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 122 comparing with ssh://user@dummy/$TESTTMP/local
150 123 searching for changes
151 124 changeset: 1:a28a9d1a809c
@@ -190,7 +163,7 b' check remote tip'
190 163 test pushkeys and bookmarks
191 164
192 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 167 bookmarks
195 168 namespaces
196 169 $ hg book foo -r 0
@@ -203,7 +176,7 b' test pushkeys and bookmarks'
203 176 searching for changes
204 177 no changes found
205 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 180 foo 1160648e36cec0054048a7edc4110c6f84fde594
208 181 $ hg book -f foo
209 182 $ hg push --traceback
@@ -231,8 +204,13 b' test pushkeys and bookmarks'
231 204
232 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 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 214 $ echo r > r
237 215 $ hg ci -A -m z r
238 216
@@ -267,7 +245,7 b' clone bookmarks'
267 245 $ hg -R ../remote bookmark test
268 246 $ hg -R ../remote bookmarks
269 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 249 requesting all changes
272 250 adding changesets
273 251 adding manifests
General Comments 0
You need to be logged in to leave comments. Login now