##// END OF EJS Templates
test-ssh: avoid a shell script
Alexis S. L. Carvalho -
r4298:58517f6e default
parent child Browse files
Show More
@@ -4,27 +4,28 b' cp "$TESTDIR"/printenv.py .'
4 4
5 5 # This test tries to exercise the ssh functionality with a dummy script
6 6
7 cat <<'EOF' > dummyssh
8 #!/bin/sh
9 # this attempts to deal with relative pathnames
10 cd `dirname $0`
7 cat <<EOF > dummyssh
8 import sys
9 import os
11 10
12 # check for proper args
13 if [ $1 != "user@dummy" ] ; then
14 exit -1
15 fi
11 os.chdir(os.path.dirname(sys.argv[0]))
12 if sys.argv[1] != "user@dummy":
13 sys.exit(-1)
14
15 if not os.path.exists("dummyssh"):
16 sys.exit(-1)
16 17
17 # check that we're in the right directory
18 if [ ! -x dummyssh ] ; then
19 exit -1
20 fi
18 os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
21 19
22 SSH_CLIENT='127.0.0.1 1 2'
23 export SSH_CLIENT
24 echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
25 $2
20 log = open("dummylog", "ab")
21 log.write("Got arguments")
22 for i, arg in enumerate(sys.argv[1:]):
23 log.write(" %d:%s" % (i+1, arg))
24 log.write("\n")
25 log.close()
26 r = os.system(sys.argv[2])
27 sys.exit(bool(r))
26 28 EOF
27 chmod +x dummyssh
28 29
29 30 echo "# creating 'remote'"
30 31 hg init remote
@@ -40,17 +41,17 b" echo 'changegroup = python ../printenv.p"
40 41 cd ..
41 42
42 43 echo "# repo not found error"
43 hg clone -e ./dummyssh ssh://user@dummy/nonexistent local
44 hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
44 45
45 46 echo "# clone remote via stream"
46 hg clone -e ./dummyssh --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \
47 hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \
47 48 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
48 49 cd local-stream
49 50 hg verify
50 51 cd ..
51 52
52 53 echo "# clone remote via pull"
53 hg clone -e ./dummyssh ssh://user@dummy/remote local
54 hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
54 55
55 56 echo "# verify"
56 57 cd local
@@ -61,7 +62,7 b" echo 'changegroup = python ../printenv.p"
61 62
62 63 echo "# empty default pull"
63 64 hg paths
64 hg pull -e ../dummyssh
65 hg pull -e "python ../dummyssh"
65 66
66 67 echo "# local change"
67 68 echo bleah > foo
@@ -70,13 +71,13 b' hg ci -m "add" -d "1000000 0"'
70 71 echo "# updating rc"
71 72 echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
72 73 echo "[ui]" >> .hg/hgrc
73 echo "ssh = ../dummyssh" >> .hg/hgrc
74 echo "ssh = python ../dummyssh" >> .hg/hgrc
74 75
75 76 echo "# find outgoing"
76 77 hg out ssh://user@dummy/remote
77 78
78 79 echo "# find incoming on the remote side"
79 hg incoming -R ../remote -e ../dummyssh ssh://user@dummy/local
80 hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
80 81
81 82 echo "# push"
82 83 hg push
@@ -78,13 +78,13 b' remote: adding changesets'
78 78 remote: adding manifests
79 79 remote: adding file changes
80 80 remote: added 1 changesets with 1 changes to 1 files
81 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio 3: 4: 5:
82 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
83 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
84 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
85 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
86 Got arguments 1:user@dummy 2:hg -R local serve --stdio 3: 4: 5:
87 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
81 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
82 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
83 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
84 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
85 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
86 Got arguments 1:user@dummy 2:hg -R local serve --stdio
87 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
88 88 changegroup-in-remote hook: HG_NODE=572896fe480d7581849806ee402175c49cb20037 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
89 Got arguments 1:user@dummy 2:hg -R remote serve --stdio 3: 4: 5:
89 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
90 90 changegroup-in-remote hook: HG_NODE=ac7448082955a0b2ff5cb4512c1e061c779bbc79 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
General Comments 0
You need to be logged in to leave comments. Login now