tests/test-static-http
author Thomas Arendsen Hein <thomas@intevation.de>
Mon, 13 Mar 2006 13:05:41 +0100
changeset 1933 7544700fd931
parent 1923 7d83a351a936
child 1935 d32c442571f2
permissions -rwxr-xr-x
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero. Some systems show "Thu Jan 01" instead of "Thu Jan 1", which breaks tests. Using "1000000" yields "Mon Jan 12 13:46:40 1970", which looks the same on all systems.
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
1923
7d83a351a936 fix testsuite for freebsd and one timingissue
Peter van Dijk <peter@dataloss.nl>
parents: 1502
diff changeset
     3
http_proxy= hg clone old-http://localhost:20059/ copy > clonefail.out 2>&1
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     4
echo $?
1923
7d83a351a936 fix testsuite for freebsd and one timingissue
Peter van Dijk <peter@dataloss.nl>
parents: 1502
diff changeset
     5
sed 's/[0-9]//g' < clonefail.out
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     6
ls copy
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     7
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     8
# 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
     9
# one pull
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    10
cat > dumb.py <<EOF
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    11
import BaseHTTPServer, SimpleHTTPServer, signal
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    12
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    13
def run(server_class=BaseHTTPServer.HTTPServer,
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    14
        handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    15
    server_address = ('localhost', 20059)
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    16
    httpd = server_class(server_address, handler_class)
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    17
    httpd.serve_forever()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    18
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    19
signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    20
run()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    21
EOF
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    22
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    23
python dumb.py 2>/dev/null &
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    24
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    25
mkdir remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    26
cd remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    27
hg init
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    28
echo foo > bar
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    29
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
    30
hg commit -m"test" -d "1000000 0"
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    31
hg tip
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    32
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    33
cd ..
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    34
1128
8bf19f96b97a Fixed test-static-http with http_proxy variable set.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1111
diff changeset
    35
http_proxy= hg clone old-http://localhost:20059/remote local
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    36
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    37
cd local
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    38
hg verify
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    39
cat bar
1502
1170fef58071 Fixed test-static-http with http_proxy variable set again.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1128
diff changeset
    40
http_proxy= hg pull
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    41
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    42
kill $!