diff --git a/makefile b/makefile index ae1b2f9030dad2270922cad435f1a53144d83321..4f47998cf27f95174b8169ee729b10f3e1401c0c 100644 --- a/makefile +++ b/makefile @@ -49,7 +49,10 @@ PORT = 8000 TIMEOUT = 200 XVFB-RUN = xvfb-run -e /dev/stderr run-test-server: test - cd $(PUBLIC_DIR); $(MISC_DIR)/unit_test_http_server.py $(PORT) $(TIMEOUT); echo $$? > $(ROOT_DIR)/.server_done + cd $(PUBLIC_DIR); $(MISC_DIR)/unit_test_http_server.py $(PORT) $(TIMEOUT) False; echo $$? > $(ROOT_DIR)/.server_done + +keep-test-server: + cd $(PUBLIC_DIR); $(MISC_DIR)/unit_test_http_server.py $(PORT) $(TIMEOUT) True; echo $$? > $(ROOT_DIR)/.server_done run-qunit: # start server diff --git a/misc/unit_test_http_server.py b/misc/unit_test_http_server.py index 02932298d01eba331cfe6f794d65b61c629d5b92..80a4687898049f76e20f23aa9be50567b38d6e96 100755 --- a/misc/unit_test_http_server.py +++ b/misc/unit_test_http_server.py @@ -59,7 +59,11 @@ class UnitTestsHandler(SimpleHTTPRequestHandler): Shut down the server with an exit code which depends on the success of the unit test suite - If the tests succeeded the server exists with 0, otherwise with 1. + + If the server has the ignore_done flag set this method immediately returns. """ + if self.server.ignore_done: + return #pylint: disable=protected-access post_data = self.log() if "SUCCESS" in post_data: @@ -85,15 +89,18 @@ class UnitTestHTTPServer(HTTPServer): A HTTP server which handles the request to the webcaosdb sources and the tests and servers as a logger when POST request are send to the `log` resource. + + ignore_done: If set to true the server does not terminate on receiving a "/Done". """ - def __init__(self, server_address, timeout): + def __init__(self, server_address, timeout, ignore_done): super(UnitTestHTTPServer, self).__init__(server_address, UnitTestsHandler) self.timeout = timeout + self.ignore_done = ignore_done self._keep_running = True self._exit_message = None - self._exit_code = None + self._exit_code = None def handle_timeout(self): """handle_timeout as defined in socketserver.BaseServer @@ -122,4 +129,4 @@ class UnitTestHTTPServer(HTTPServer): UnitTestHTTPServer(server_address=('127.0.0.1', int(sys.argv[1])), - timeout=float(sys.argv[2])).start() + timeout=float(sys.argv[2]), ignore_done=(sys.argv[3]=="True")).start()