tests/test-ssh-clone-r
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Wed, 20 Aug 2008 10:30:53 +0200
changeset 6915 ef14c773b3d6
parent 4299 6b1e1b9da853
permissions -rwxr-xr-x
mq: fix docs for qrefresh -D (issue1234)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     1
#!/bin/sh
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     3
# This test tries to exercise the ssh functionality with a dummy script
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     4
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
     5
cat <<EOF > dummyssh
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
     6
import sys
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
     7
import os
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     8
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
     9
os.chdir(os.path.dirname(sys.argv[0]))
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    10
if sys.argv[1] != "user@dummy":
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    11
    sys.exit(-1)
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    12
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    13
if not os.path.exists("dummyssh"):
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    14
    sys.exit(-1)
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    15
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    16
os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    17
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    18
log = open("dummylog", "ab")
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    19
log.write("Got arguments")
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    20
for i, arg in enumerate(sys.argv[1:]):
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    21
    log.write(" %d:%s" % (i+1, arg))
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    22
log.write("\n")
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    23
log.close()
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    24
r = os.system(sys.argv[2])
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    25
sys.exit(bool(r))
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    26
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    27
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    28
hg init remote
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    29
cd remote
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    30
echo "# creating 'remote'"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    31
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    32
0
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    33
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    34
hg add afile
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    35
hg commit -m "0.0"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    36
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    37
1
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    38
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    39
hg commit -m "0.1"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    40
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    41
2
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    42
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    43
hg commit -m "0.2"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    44
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    45
3
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    46
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    47
hg commit -m "0.3"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    48
hg update -C 0
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    49
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    50
1
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    51
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    52
hg commit -m "1.1"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    53
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    54
2
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    55
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    56
hg commit -m "1.2"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    57
cat >fred <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    58
a line
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    59
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    60
cat >>afile <<EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    61
3
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    62
EOF
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    63
hg add fred
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    64
hg commit -m "1.3"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    65
hg mv afile adifferentfile
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    66
hg commit -m "1.3m"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    67
hg update -C 3
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    68
hg mv afile anotherfile
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    69
hg commit -m "0.3m"
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3449
diff changeset
    70
hg debugindex .hg/store/data/afile.i
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3449
diff changeset
    71
hg debugindex .hg/store/data/adifferentfile.i
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3449
diff changeset
    72
hg debugindex .hg/store/data/anotherfile.i
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3449
diff changeset
    73
hg debugindex .hg/store/data/fred.i
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3449
diff changeset
    74
hg debugindex .hg/store/00manifest.i
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    75
hg verify
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    76
cd ..
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    77
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    78
echo "# clone remote via stream"
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    79
for i in 0 1 2 3 4 5 6 7 8; do
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    80
   hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    81
   if cd test-"$i"; then
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    82
      hg verify
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    83
      cd ..
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    84
   fi
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    85
done
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    86
cd test-8
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    87
hg pull ../test-7
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    88
hg verify
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    89
cd ..
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    90
cd test-1
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    91
hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote 2>&1
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    92
hg verify
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    93
hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    94
cd ..
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    95
cd test-2
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    96
hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote 2>&1
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    97
hg verify
4299
6b1e1b9da853 test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3853
diff changeset
    98
hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
3449
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    99
hg verify
c8686e3f0291 Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   100
cd ..