# HG changeset patch # User Martin Geisler # Date 2010-08-14 00:39:39 # Node ID f48178034569d34aa6b10f1c68a614712b63fd30 # Parent 934c7e91c12691cdec0f7e4b4a8ab015923eb919 tests: unify test-bad-pull diff --git a/tests/test-bad-pull.out b/tests/test-bad-pull.out deleted file mode 100644 --- a/tests/test-bad-pull.out +++ /dev/null @@ -1,5 +0,0 @@ -abort: error: Connection refused -255 -copy: No such file or directory -abort: HTTP Error 404 -0 diff --git a/tests/test-bad-pull b/tests/test-bad-pull.t old mode 100755 new mode 100644 rename from tests/test-bad-pull rename to tests/test-bad-pull.t --- a/tests/test-bad-pull +++ b/tests/test-bad-pull.t @@ -1,30 +1,34 @@ -#!/bin/sh - -hg clone http://localhost:$HGPORT/ copy -echo $? -test -d copy || echo copy: No such file or directory + $ hg clone http://localhost:$HGPORT/ copy + abort: error: Connection refused -cat > dumb.py </dev/null & -echo $! >> $DAEMON_PIDS + $ cat > dumb.py < 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 -# give the server some time to start running -sleep 1 + $ 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 $? + $ hg clone http://localhost:$HGPORT/foo copy2 2>&1 + abort: HTTP Error 404: .* -kill $! + $ echo $? + 0 + + $ kill $!