Mercurial > hg
annotate tests/test-bad-pull.t @ 12269:877236cdd437
add: move main part to cmdutil to make it easier to reuse
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 13 Sep 2010 13:09:11 +0200 |
parents | f48178034569 |
children | 4134686b83e1 |
rev | line source |
---|---|
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 | 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 | 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 | 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 | 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 | 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 $! |