tests/test-static-http
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Tue, 14 Oct 2008 20:13:53 +0200
changeset 7104 9514cbb6e4f6
parent 7005 7739b61897df
child 7211 25c0dee16ee0
permissions -rwxr-xr-x
bdiff: normalize the diff (issue1295) When the common part of a diff can be moved forward, move it forward. Otherwise we don't get deterministic results (it would depends on the way we split for the recursion). That way we get identical hunks when doing the same change, it helps to solve issue1295 (inconsistent diffs on different side during a merge).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     1
#!/bin/sh
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     2
4290
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3469
diff changeset
     3
cp "$TESTDIR"/printenv.py .
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3469
diff changeset
     4
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
     5
http_proxy= hg clone static-http://localhost:$HGPORT/ copy
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     6
echo $?
3469
33b6c8193652 Don't use test -e in tests - sh doesn't like it on Solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3428
diff changeset
     7
test -d copy || echo copy: No such file or directory
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     8
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     9
# This server doesn't do range requests so it's basically only good for
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    10
# one pull
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    11
cat > dumb.py <<EOF
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    12
import BaseHTTPServer, SimpleHTTPServer, os, signal
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    13
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    14
def run(server_class=BaseHTTPServer.HTTPServer,
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    15
        handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    16
    server_address = ('localhost', int(os.environ['HGPORT']))
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    17
    httpd = server_class(server_address, handler_class)
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    18
    httpd.serve_forever()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    19
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    20
signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    21
run()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    22
EOF
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    23
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    24
python dumb.py 2>/dev/null &
2572
d22d730c96ed tests: record few more daemon pids to be safe
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2431
diff changeset
    25
echo $! >> $DAEMON_PIDS
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    26
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    27
mkdir remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    28
cd remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    29
hg init
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    30
echo foo > bar
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    31
hg add bar
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1923
diff changeset
    32
hg commit -m"test" -d "1000000 0"
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    33
hg tip
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    34
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    35
cd ..
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    36
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    37
http_proxy= hg clone static-http://localhost:$HGPORT/remote local | sed -e 's,:[0-9][0-9]*/,/,'
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    38
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    39
cd local
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    40
hg verify
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    41
cat bar
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    42
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    43
cd ../remote
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    44
echo baz > quux
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    45
hg commit -A -mtest2 -d '100000000 0'
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    46
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    47
cd ../local
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2572
diff changeset
    48
echo '[hooks]' >> .hg/hgrc
4290
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3469
diff changeset
    49
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    50
http_proxy= hg pull | sed -e 's,:[0-9][0-9]*/,/,'
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    51
7005
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    52
echo '% trying to push'
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    53
hg update
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    54
echo more foo >> bar
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    55
hg commit -m"test" -d "100000000 0"
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    56
http_proxy= hg push | sed -e 's,:[0-9][0-9]*/,/,'
7739b61897df do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents: 6028
diff changeset
    57
5316
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    58
echo '% test with "/" URI (issue 747)'
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    59
cd ..
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    60
hg init
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    61
echo a > a
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    62
hg add a
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    63
hg ci -ma
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    64
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    65
http_proxy= hg clone static-http://localhost:$HGPORT/ local2 | sed -e 's,:[0-9][0-9]*/,/,'
5316
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    66
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    67
cd local2
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    68
hg verify
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    69
cat a
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5316
diff changeset
    70
hg paths | sed -e 's,:[0-9][0-9]*/,/,'
5316
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    71
6028
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    72
echo '% test with empty repo (issue965)'
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    73
cd ..
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    74
hg init remotempty
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    75
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    76
http_proxy= hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,'
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    77
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    78
cd local3
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    79
hg verify
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    80
hg paths | sed -e 's,:[0-9][0-9]*/,/,'
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    81
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    82
echo '% test with non-repo'
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    83
cd ..
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    84
mkdir notarepo
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    85
http_proxy= hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
6605a03cbf87 make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    86
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    87
kill $!