##// END OF EJS Templates
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho -
r4299:6b1e1b9d default
parent child Browse files
Show More
@@ -2,27 +2,28 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
5 cat <<EOF > dummyssh
6 #!/bin/sh
6 import sys
7 # this attempts to deal with relative pathnames
7 import os
8 cd `dirname $0`
9
8
10 # check for proper args
9 os.chdir(os.path.dirname(sys.argv[0]))
11 if [ $1 != "user@dummy" ] ; then
10 if sys.argv[1] != "user@dummy":
12 exit -1
11 sys.exit(-1)
13 fi
12
13 if not os.path.exists("dummyssh"):
14 sys.exit(-1)
14
15
15 # check that we're in the right directory
16 os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
16 if [ ! -x dummyssh ] ; then
17 exit -1
18 fi
19
17
20 SSH_CLIENT='127.0.0.1 1 2'
18 log = open("dummylog", "ab")
21 export SSH_CLIENT
19 log.write("Got arguments")
22 echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
20 for i, arg in enumerate(sys.argv[1:]):
23 $2
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))
24 EOF
26 EOF
25 chmod +x dummyssh
26
27
27 hg init remote
28 hg init remote
28 cd remote
29 cd remote
@@ -76,7 +77,7 b' cd ..'
76
77
77 echo "# clone remote via stream"
78 echo "# clone remote via stream"
78 for i in 0 1 2 3 4 5 6 7 8; do
79 for i in 0 1 2 3 4 5 6 7 8; do
79 hg clone -e ./dummyssh --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1
80 hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1
80 if cd test-"$i"; then
81 if cd test-"$i"; then
81 hg verify
82 hg verify
82 cd ..
83 cd ..
@@ -87,13 +88,13 b' hg pull ../test-7'
87 hg verify
88 hg verify
88 cd ..
89 cd ..
89 cd test-1
90 cd test-1
90 hg pull -e ../dummyssh -r 4 ssh://user@dummy/remote 2>&1
91 hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote 2>&1
91 hg verify
92 hg verify
92 hg pull -e ../dummyssh ssh://user@dummy/remote 2>&1
93 hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
93 cd ..
94 cd ..
94 cd test-2
95 cd test-2
95 hg pull -e ../dummyssh -r 5 ssh://user@dummy/remote 2>&1
96 hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote 2>&1
96 hg verify
97 hg verify
97 hg pull -e ../dummyssh ssh://user@dummy/remote 2>&1
98 hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
98 hg verify
99 hg verify
99 cd ..
100 cd ..
General Comments 0
You need to be logged in to leave comments. Login now