Mercurial > hg
annotate tests/test-bad-pull.t @ 15446:c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 07 Nov 2011 03:24:53 +0100 |
parents | 97ffc68f71d3 |
children | 21766d5531cb |
rev | line source |
---|---|
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
1 $ "$TESTDIR/hghave" serve || exit 80 |
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
2 |
11859
f48178034569
tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents:
10154
diff
changeset
|
3 $ hg clone http://localhost:$HGPORT/ copy |
f48178034569
tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents:
10154
diff
changeset
|
4 abort: error: Connection refused |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11859
diff
changeset
|
5 [255] |
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 |
12376
97ffc68f71d3
tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents:
12375
diff
changeset
|
29 abort: HTTP Error 404: * (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11859
diff
changeset
|
30 [255] |
395 | 31 |
11859
f48178034569
tests: unify test-bad-pull
Martin Geisler <mg@lazybytes.net>
parents:
10154
diff
changeset
|
32 $ kill $! |