tests/test-init
changeset 4297 27590c19ad30
parent 4166 c0271aba6abe
equal deleted inserted replaced
4296:c2c8491a30d6 4297:27590c19ad30
     1 #!/bin/sh
     1 #!/bin/sh
     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 {
    27     name=$1
    28     name=$1
    28 
    29 
    49 
    50 
    50 echo "#test failure"
    51 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
    69 
    70 
    70 echo "# comparing repositories"
    71 echo "# comparing repositories"