tests/test-ssh.t
changeset 12489 d039c4285092
parent 12414 858fe1e74785
child 12504 f7dd8bffe18c
equal deleted inserted replaced
12488:73ad7274ccfa 12489:d039c4285092
     4 This test tries to exercise the ssh functionality with a dummy script
     4 This test tries to exercise the ssh functionality with a dummy script
     5 
     5 
     6   $ cat <<EOF > dummyssh
     6   $ cat <<EOF > dummyssh
     7   > import sys
     7   > import sys
     8   > import os
     8   > import os
       
     9   > 
     9   > os.chdir(os.path.dirname(sys.argv[0]))
    10   > os.chdir(os.path.dirname(sys.argv[0]))
    10   > if sys.argv[1] != "user@dummy":
    11   > if sys.argv[1] != "user@dummy":
    11   >     sys.exit(-1)
    12   >     sys.exit(-1)
       
    13   > 
    12   > if not os.path.exists("dummyssh"):
    14   > if not os.path.exists("dummyssh"):
    13   >     sys.exit(-1)
    15   >     sys.exit(-1)
       
    16   > 
    14   > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
    17   > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
       
    18   > 
    15   > log = open("dummylog", "ab")
    19   > log = open("dummylog", "ab")
    16   > log.write("Got arguments")
    20   > log.write("Got arguments")
    17   > for i, arg in enumerate(sys.argv[1:]):
    21   > for i, arg in enumerate(sys.argv[1:]):
    18   >     log.write(" %d:%s" % (i+1, arg))
    22   >     log.write(" %d:%s" % (i+1, arg))
    19   > log.write("\n")
    23   > log.write("\n")
    24   $ cat <<EOF > badhook
    28   $ cat <<EOF > badhook
    25   > import sys
    29   > import sys
    26   > sys.stdout.write("KABOOM\n")
    30   > sys.stdout.write("KABOOM\n")
    27   > EOF
    31   > EOF
    28 
    32 
    29 creating 'remote'
    33 creating 'remote
    30 
    34 
    31   $ hg init remote
    35   $ hg init remote
    32   $ cd remote
    36   $ cd remote
    33   $ echo this > foo
    37   $ echo this > foo
    34   $ echo this > fooO
    38   $ echo this > fooO
    53   abort: no suitable response from remote hg!
    57   abort: no suitable response from remote hg!
    54   [255]
    58   [255]
    55 
    59 
    56 clone remote via stream
    60 clone remote via stream
    57 
    61 
    58   $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \
    62   $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
    59   >   sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
       
    60   streaming all changes
    63   streaming all changes
    61   XXX files to transfer, XXX bytes of data
    64   4 files to transfer, 392 bytes of data
    62   transferred XXX bytes in XXX seconds (XXX XB/sec)
    65   transferred 392 bytes in * seconds (*B/sec) (glob)
    63   updating to branch default
    66   updating to branch default
    64   XXX files updated, XXX files merged, XXX files removed, XXX files unresolved
    67   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    65   $ cd local-stream
    68   $ cd local-stream
    66   $ hg verify
    69   $ hg verify
    67   checking changesets
    70   checking changesets
    68   checking manifests
    71   checking manifests
    69   crosschecking files in changesets and manifests
    72   crosschecking files in changesets and manifests