tests/test-bad-pull.t
author Martin Geisler <mg@lazybytes.net>
Tue, 17 Aug 2010 16:53:03 +0200
changeset 11916 d1ea16ca6520
parent 11859 f48178034569
child 12316 4134686b83e1
permissions -rw-r--r--
tests: unify test-subrepo-svn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     1
  $ hg clone http://localhost:$HGPORT/ copy
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     2
  abort: error: Connection refused
395
fbe8834923c5 commands: report http exceptions nicely
mpm@selenic.com
parents:
diff changeset
     3
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     4
  $ echo $?
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     5
  0
395
fbe8834923c5 commands: report http exceptions nicely
mpm@selenic.com
parents:
diff changeset
     6
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     7
  $ test -d copy || echo copy: No such file or directory
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
     8
  copy: No such file or directory
395
fbe8834923c5 commands: report http exceptions nicely
mpm@selenic.com
parents:
diff changeset
     9
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    10
  $ cat > dumb.py <<EOF
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    11
  > import BaseHTTPServer, SimpleHTTPServer, os, signal
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    12
  > def run(server_class=BaseHTTPServer.HTTPServer,
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    13
  >         handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    14
  >     server_address = ('localhost', int(os.environ['HGPORT']))
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    15
  >     httpd = server_class(server_address, handler_class)
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    16
  >     httpd.serve_forever()
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    17
  > signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    18
  > run()
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    19
  > EOF
395
fbe8834923c5 commands: report http exceptions nicely
mpm@selenic.com
parents:
diff changeset
    20
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    21
  $ python dumb.py 2>/dev/null &
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    22
  $ echo $! >> $DAEMON_PIDS
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    23
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    24
give the server some time to start running
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    25
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    26
  $ sleep 1
4317
66249be9aa23 test-bad-pull: try to avoid timing-related failures
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3469
diff changeset
    27
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    28
  $ hg clone http://localhost:$HGPORT/foo copy2 2>&1
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    29
  abort: HTTP Error 404: .*
395
fbe8834923c5 commands: report http exceptions nicely
mpm@selenic.com
parents:
diff changeset
    30
11859
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    31
  $ echo $?
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    32
  0
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    33
f48178034569 tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents: 10154
diff changeset
    34
  $ kill $!