Mercurial > hg
changeset 11859:f48178034569
tests: unify test-bad-pull
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sat, 14 Aug 2010 02:39:39 +0200 |
parents | 934c7e91c126 |
children | 56c7c3209e1a |
files | tests/test-bad-pull tests/test-bad-pull.out tests/test-bad-pull.t |
diffstat | 3 files changed, 34 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-bad-pull Sat Aug 14 02:35:44 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#!/bin/sh - -hg clone http://localhost:$HGPORT/ copy -echo $? -test -d copy || echo copy: No such file or directory - -cat > dumb.py <<EOF -import BaseHTTPServer, SimpleHTTPServer, os, signal - -def run(server_class=BaseHTTPServer.HTTPServer, - handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): - server_address = ('localhost', int(os.environ['HGPORT'])) - httpd = server_class(server_address, handler_class) - httpd.serve_forever() - -signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) -run() -EOF - -python dumb.py 2>/dev/null & -echo $! >> $DAEMON_PIDS - -# give the server some time to start running -sleep 1 - -hg clone http://localhost:$HGPORT/foo copy2 2>&1 | \ - sed -e 's/404.*/404/' -e 's/Date:.*/Date:/' -echo $? - -kill $!
--- a/tests/test-bad-pull.out Sat Aug 14 02:35:44 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -abort: error: Connection refused -255 -copy: No such file or directory -abort: HTTP Error 404 -0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-bad-pull.t Sat Aug 14 02:39:39 2010 +0200 @@ -0,0 +1,34 @@ + $ hg clone http://localhost:$HGPORT/ copy + abort: error: Connection refused + + $ echo $? + 0 + + $ test -d copy || echo copy: No such file or directory + copy: No such file or directory + + $ cat > dumb.py <<EOF + > import BaseHTTPServer, SimpleHTTPServer, os, signal + > def run(server_class=BaseHTTPServer.HTTPServer, + > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): + > server_address = ('localhost', int(os.environ['HGPORT'])) + > httpd = server_class(server_address, handler_class) + > httpd.serve_forever() + > signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) + > run() + > EOF + + $ python dumb.py 2>/dev/null & + $ echo $! >> $DAEMON_PIDS + +give the server some time to start running + + $ sleep 1 + + $ hg clone http://localhost:$HGPORT/foo copy2 2>&1 + abort: HTTP Error 404: .* + + $ echo $? + 0 + + $ kill $!