From 545ed256fcfea80a6996376545697e29f46232fc Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Mon, 6 Jul 2020 12:52:16 +0200
Subject: [PATCH] BUG: fixed keep-test-server make target

---
 makefile                      |  4 ++--
 misc/unit_test_http_server.py | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/makefile b/makefile
index aa0b045b..50dd72b5 100644
--- a/makefile
+++ b/makefile
@@ -92,7 +92,7 @@ run-test-server: test
 	$(MISC_DIR)/unit_test_http_server.py $(PORT) $(TIMEOUT) False $(PUBLIC_DIR)
 
 keep-test-server: test
-	$(MISC_DIR)/unit_test_http_server.py $(PORT) $(TIMEOUT) True $(PUBLIC_DIR)
+	$(MISC_DIR)/unit_test_http_server.py $(PORT) -1 True $(PUBLIC_DIR)
 
 run-qunit: test
 	$(foreach exec, firefox Xvfb xwd,\
@@ -155,7 +155,7 @@ cp-ext:
 cp-ext-test:
 	for f in $(wildcard $(TEST_EXT_DIR)/js/*) ; do \
 		echo "y" | cp -i -r "$$f" $(PUBLIC_DIR)/js/ ; \
-		sed -i "/JS_EXTENSIONS/a \<xsl:element name=\"script\"><xsl:attribute name=\"src\"><xsl:value-of select=\"concat\(\$$basepath, 'webinterface/${BUILD_NUMBER}$${f#$(TEST_EXT_DIR)}'\)\" /></xsl:attribute></xsl:element>" $(PUBLIC_DIR)/xsl/main.xsl ; \
+		sed -i "/JS_EXTENSIONS/a \<xsl:element name=\"script\"><xsl:attribute name=\"src\"><xsl:value-of select=\"concat\(\$$basepath, 'webinterface/${BUILD_NUMBER}$${f#$(SRC_EXT_DIR)}'\)\" /></xsl:attribute></xsl:element>" $(PUBLIC_DIR)/xsl/main.xsl ; \
 	done
 	mkdir -p $(PUBLIC_DIR)/html
 	for f in $(wildcard $(TEST_EXT_DIR)/html/*) ; do \
diff --git a/misc/unit_test_http_server.py b/misc/unit_test_http_server.py
index c52f84e4..68e6a743 100755
--- a/misc/unit_test_http_server.py
+++ b/misc/unit_test_http_server.py
@@ -115,7 +115,7 @@ class UnitTestHTTPServer(HTTPServer):
     def __init__(self, server_address, timeout, ignore_done):
         super(UnitTestHTTPServer, self).__init__(server_address,
                                                  UnitTestsHandler)
-        self.timeout = timeout
+        self.timeout = timeout if timeout > 0 else None
         self.ignore_done = ignore_done
         self._keep_running = True
         self._exit_message = None
@@ -139,8 +139,12 @@ class UnitTestHTTPServer(HTTPServer):
         Start the server and handle request until the `done` resource is being
         called or a timeout occurs.
         """
-        print(("starting UnitTestHTTPServer on {address} with {t}s "
-               "timeout.").format(address=self.server_address, t=self.timeout))
+        timeout_str = "."
+        if self.timeout is not None:
+            timeout_str = " with {}s timeout.".format(self.timeout)
+        print(("starting UnitTestHTTPServer on {address}"
+               "{timeout_str}").format(address=self.server_address,
+                                       timeout_str=timeout_str))
         self._keep_running = True
         while self._keep_running:
             self.handle_request()
-- 
GitLab