##// END OF EJS Templates
test-init: avoid a shell script
Alexis S. L. Carvalho -
r4297:27590c19 default
parent child Browse files
Show More
@@ -2,25 +2,26 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
14
12
15 # check that we're in the right directory
13 if not os.path.exists("dummyssh"):
16 if [ ! -x dummyssh ] ; then
14 sys.exit(-1)
17 exit -1
18 fi
19
15
20 echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
16 log = open("dummylog", "ab")
21 $2
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))
22 EOF
24 EOF
23 chmod +x dummyssh
24
25
25 checknewrepo()
26 checknewrepo()
26 {
27 {
@@ -51,18 +52,18 b' echo "#test failure"'
51 hg init local
52 hg init local
52
53
53 echo "# init+push to remote2"
54 echo "# init+push to remote2"
54 hg init -e ./dummyssh ssh://user@dummy/remote2
55 hg init -e "python ./dummyssh" ssh://user@dummy/remote2
55 hg incoming -R remote2 local
56 hg incoming -R remote2 local
56 hg push -R local -e ./dummyssh ssh://user@dummy/remote2
57 hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
57
58
58 echo "# clone to remote1"
59 echo "# clone to remote1"
59 hg clone -e ./dummyssh local ssh://user@dummy/remote1
60 hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
60
61
61 echo "# init to existing repo"
62 echo "# init to existing repo"
62 hg init -e ./dummyssh ssh://user@dummy/remote1
63 hg init -e "python ./dummyssh" ssh://user@dummy/remote1
63
64
64 echo "# clone to existing repo"
65 echo "# clone to existing repo"
65 hg clone -e ./dummyssh local ssh://user@dummy/remote1
66 hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
66
67
67 echo "# output of dummyssh"
68 echo "# output of dummyssh"
68 cat dummylog
69 cat dummylog
@@ -35,13 +35,13 b' abort: could not create remote repo!'
35 abort: repository remote1 already exists!
35 abort: repository remote1 already exists!
36 abort: could not create remote repo!
36 abort: could not create remote repo!
37 # output of dummyssh
37 # output of dummyssh
38 Got arguments 1:user@dummy 2:hg init remote2 3: 4: 5:
38 Got arguments 1:user@dummy 2:hg init remote2
39 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5:
39 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
40 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5:
40 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
41 Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5:
41 Got arguments 1:user@dummy 2:hg init remote1
42 Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5:
42 Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
43 Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5:
43 Got arguments 1:user@dummy 2:hg init remote1
44 Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5:
44 Got arguments 1:user@dummy 2:hg init remote1
45 # comparing repositories
45 # comparing repositories
46 0:c4e059d443be
46 0:c4e059d443be
47 0:c4e059d443be
47 0:c4e059d443be
General Comments 0
You need to be logged in to leave comments. Login now