WPT server should be able to do logging even if its output folder is not created...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 22:38:41 +0000 (22:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 22:38:41 +0000 (22:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175543

Patch by Youenn Fablet <youenn@apple.com> on 2017-08-14
Reviewed by Alexey Proskuryakov.

Removing no longer used stdout/stderr member variables.
Creating if needed the output folder so that we can create WPT server output log folder at WPT server launch time.

* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(WebPlatformTestServer.__init__):
(WebPlatformTestServer._prepare_config):
(WebPlatformTestServer._spawn_process):
(WebPlatformTestServer._stop_running_server):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220719 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py

index e4470b8..f6597de 100644 (file)
@@ -1,3 +1,19 @@
+2017-08-14  Youenn Fablet  <youenn@apple.com>
+
+        WPT server should be able to do logging even if its output folder is not created at launch time
+        https://bugs.webkit.org/show_bug.cgi?id=175543
+
+        Reviewed by Alexey Proskuryakov.
+
+        Removing no longer used stdout/stderr member variables.
+        Creating if needed the output folder so that we can create WPT server output log folder at WPT server launch time.
+
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+        (WebPlatformTestServer.__init__):
+        (WebPlatformTestServer._prepare_config):
+        (WebPlatformTestServer._spawn_process):
+        (WebPlatformTestServer._stop_running_server):
+
 2017-08-14  Daniel Bates  <dabates@apple.com>
 
         webkit-patch: Passing --no-review should submit patch to EWS by default
index 8370ab7..671f370 100755 (executable)
@@ -88,8 +88,6 @@ class WebPlatformTestServer(http_server_base.HttpServerBase):
             self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
         self._servers_file = self._filesystem.join(self._runtime_path, '%s_servers.json' % (self._name))
 
-        self._stdout_data = None
-        self._stderr_data = None
         self._filesystem = port_obj.host.filesystem
         self._layout_root = port_obj.layout_tests_dir()
         self._doc_root = self._filesystem.join(self._layout_root, doc_root(port_obj))
@@ -143,18 +141,13 @@ class WebPlatformTestServer(http_server_base.HttpServerBase):
             self._filesystem.remove(config_wpt_filename)
 
     def _prepare_config(self):
-        if self._filesystem.exists(self._output_dir):
-            self._output_log_path = self._filesystem.join(self._output_dir, self._log_file_name)
-            self._wsout = self._filesystem.open_text_file_for_writing(self._output_log_path)
+        self._filesystem.maybe_make_directory(self._output_dir)
+        self._output_log_path = self._filesystem.join(self._output_dir, self._log_file_name)
+        self._wsout = self._filesystem.open_text_file_for_writing(self._output_log_path)
         self._copy_webkit_test_files()
 
     def _spawn_process(self):
-        self._stdout_data = None
-        self._stderr_data = None
-        if self._wsout:
-            self._process = self._executive.popen(self._start_cmd, cwd=self._doc_root_path, shell=False, stdin=self._executive.PIPE, stdout=self._wsout, stderr=self._wsout)
-        else:
-            self._process = self._executive.popen(self._start_cmd, cwd=self._doc_root_path, shell=False, stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=self._executive.STDOUT)
+        self._process = self._executive.popen(self._start_cmd, cwd=self._doc_root_path, shell=False, stdin=self._executive.PIPE, stdout=self._wsout, stderr=self._wsout)
         self._filesystem.write_text_file(self._pid_file, str(self._process.pid))
 
         # Wait a second for the server to actually start so that tests do not start until server is running.
@@ -194,7 +187,7 @@ class WebPlatformTestServer(http_server_base.HttpServerBase):
         self._clean_webkit_test_files()
 
         if self._process:
-            (self._stdout_data, self._stderr_data) = self._process.communicate(input='\n')
+            self._process.communicate(input='\n')
         if self._wsout:
             self._wsout.close()
             self._wsout = None