tests/test-ssh
author Thomas Arendsen Hein <thomas@intevation.de>
Sat, 16 Dec 2006 23:33:24 +0100
changeset 3919 5f0e00224cde
parent 3853 c0b449154a90
child 4291 35b2e02367a5
permissions -rwxr-xr-x
Adjust test-help output for the change in 3c82ab166eea.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     1
#!/bin/sh
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     2
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     3
# This test tries to exercise the ssh functionality with a dummy script
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     4
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     5
cat <<'EOF' > dummyssh
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     6
#!/bin/sh
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     7
# this attempts to deal with relative pathnames
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     8
cd `dirname $0`
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
     9
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    10
# check for proper args
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    11
if [ $1 != "user@dummy" ] ; then
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    12
	exit -1
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    13
fi
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    14
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    15
# check that we're in the right directory
1168
235e0effa672 Fixed two tests to run with bourne shell.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1110
diff changeset
    16
if [ ! -x dummyssh ] ; then
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    17
	exit -1
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    18
fi
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    19
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    20
SSH_CLIENT='127.0.0.1 1 2'
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    21
export SSH_CLIENT
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    22
echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    23
$2
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    24
EOF
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    25
chmod +x dummyssh
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    26
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    27
echo "# creating 'remote'"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    28
hg init remote
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    29
cd remote
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    30
echo this > foo
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3684
diff changeset
    31
echo this > fooO
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3684
diff changeset
    32
hg ci -A -m "init" -d "1000000 0" foo fooO
2621
5a5852a417b1 clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2613
diff changeset
    33
echo '[server]' > .hg/hgrc
2622
064aef9162cc rename stream hgrc option to compressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2621
diff changeset
    34
echo 'uncompressed = True' >> .hg/hgrc
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    35
echo '[hooks]' >> .hg/hgrc
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    36
echo 'changegroup = echo changegroup in remote: u=$HG_URL >> ../dummylog' >> .hg/hgrc
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    37
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    38
cd ..
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    39
3275
7ae37d99d47e ssh: make the error message more clear, add a testcase
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3095
diff changeset
    40
echo "# repo not found error"
7ae37d99d47e ssh: make the error message more clear, add a testcase
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3095
diff changeset
    41
hg clone -e ./dummyssh ssh://user@dummy/nonexistent local
7ae37d99d47e ssh: make the error message more clear, add a testcase
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3095
diff changeset
    42
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    43
echo "# clone remote via stream"
2621
5a5852a417b1 clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2613
diff changeset
    44
hg clone -e ./dummyssh --uncompressed ssh://user@dummy/remote local-stream 2>&1 | \
3015
fa4229c60dd7 Allow for MB/sec transfer rates in test-http-proxy and test-ssh.
Lee Cantey <lcantey@gmail.com>
parents: 2673
diff changeset
    45
  sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    46
cd local-stream
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    47
hg verify
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    48
cd ..
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    49
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2439
diff changeset
    50
echo "# clone remote via pull"
2613
479e26afa10f clone: do not make streaming default. add --stream option instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2612
diff changeset
    51
hg clone -e ./dummyssh ssh://user@dummy/remote local
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    52
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    53
echo "# verify"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    54
cd local
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    55
hg verify
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    56
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    57
echo '[hooks]' >> .hg/hgrc
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    58
echo 'changegroup = echo changegroup in local: u=$HG_URL >> ../dummylog' >> .hg/hgrc
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    59
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    60
echo "# empty default pull"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    61
hg paths
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    62
hg pull -e ../dummyssh
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    63
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    64
echo "# local change"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    65
echo bleah > foo
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1168
diff changeset
    66
hg ci -m "add" -d "1000000 0"
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    67
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    68
echo "# updating rc"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    69
echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    70
echo "[ui]" >> .hg/hgrc
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    71
echo "ssh = ../dummyssh" >> .hg/hgrc
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    72
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    73
echo "# find outgoing"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    74
hg out ssh://user@dummy/remote
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    75
1982
70ba0c86da8b Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    76
echo "# find incoming on the remote side"
70ba0c86da8b Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    77
hg incoming -R ../remote -e ../dummyssh ssh://user@dummy/local
70ba0c86da8b Added test for incoming via ssh.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    78
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    79
echo "# push"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    80
hg push
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    81
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    82
cd ../remote
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    83
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    84
echo "# check remote tip"
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    85
hg tip
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    86
hg verify
3095
25857e00af8e cat: default to working dir parent instead of tip
Brendan Cully <brendan@kublai.com>
parents: 3015
diff changeset
    87
hg cat -r tip foo
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    88
2439
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    89
echo z > z
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    90
hg ci -A -m z -d '1000001 0' z
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    91
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    92
cd ../local
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    93
echo r > r
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    94
hg ci -A -m z -d '1000002 0' r
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    95
3684
975c2469c316 correct remote heads test in prepush
Matt Mackall <mpm@selenic.com>
parents: 3275
diff changeset
    96
echo "# push should succeed"
2439
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    97
hg push
e8c4f3d3df8c extend network protocol to stop clients from locking servers
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1982
diff changeset
    98
1110
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
    99
cd ..
1032a505488c Add a simple dummy ssh test
mpm@selenic.com
parents:
diff changeset
   100
cat dummylog