Title: [212905] trunk/Tools
- Revision
- 212905
- Author
- clo...@igalia.com
- Date
- 2017-02-23 11:04:33 -0800 (Thu, 23 Feb 2017)
Log Message
Improve error message when the WPT server fails to start.
https://bugs.webkit.org/show_bug.cgi?id=168759
Reviewed by Ryosuke Niwa.
Check if the WPT server is running after 1 second, and if is not
print useful information for helping the user to debug the issue.
Using check_running_pid() to check if the process is still running
doesn't work. A process started via subprocess popen that has ended
will be in a zombie state until a call to wait/communicate/poll
is done, or until the object is deleted or garbage collected.
This adds also support for testing the behaviour of subprocess
poll() on the unit tests that use MockProcess.
A new test is added also for the battery of tests for the WPT
server.
* Scripts/webkitpy/common/system/executive_mock.py:
(MockProcess.__init__):
(MockProcess.wait):
(MockProcess.communicate):
(MockProcess.poll):
(MockExecutive.popen):
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(WebPlatformTestServer.__init__):
(WebPlatformTestServer._prepare_config):
(WebPlatformTestServer._spawn_process):
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
(TestWebPlatformTestServer.test_corrupted_subserver_files):
(TestWebPlatformTestServer):
(TestWebPlatformTestServer.test_server_fails_to_start_throws_exception):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (212904 => 212905)
--- trunk/Tools/ChangeLog 2017-02-23 19:01:29 UTC (rev 212904)
+++ trunk/Tools/ChangeLog 2017-02-23 19:04:33 UTC (rev 212905)
@@ -1,3 +1,39 @@
+2017-02-23 Carlos Alberto Lopez Perez <clo...@igalia.com>
+
+ Improve error message when the WPT server fails to start.
+ https://bugs.webkit.org/show_bug.cgi?id=168759
+
+ Reviewed by Ryosuke Niwa.
+
+ Check if the WPT server is running after 1 second, and if is not
+ print useful information for helping the user to debug the issue.
+
+ Using check_running_pid() to check if the process is still running
+ doesn't work. A process started via subprocess popen that has ended
+ will be in a zombie state until a call to wait/communicate/poll
+ is done, or until the object is deleted or garbage collected.
+
+ This adds also support for testing the behaviour of subprocess
+ poll() on the unit tests that use MockProcess.
+
+ A new test is added also for the battery of tests for the WPT
+ server.
+
+ * Scripts/webkitpy/common/system/executive_mock.py:
+ (MockProcess.__init__):
+ (MockProcess.wait):
+ (MockProcess.communicate):
+ (MockProcess.poll):
+ (MockExecutive.popen):
+ * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+ (WebPlatformTestServer.__init__):
+ (WebPlatformTestServer._prepare_config):
+ (WebPlatformTestServer._spawn_process):
+ * Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
+ (TestWebPlatformTestServer.test_corrupted_subserver_files):
+ (TestWebPlatformTestServer):
+ (TestWebPlatformTestServer.test_server_fails_to_start_throws_exception):
+
2017-02-23 Wenson Hsieh <wenson_hs...@apple.com>
Unreviewed, temporarily disable DataInteractionTests in TestWebKitAPI.
Modified: trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py (212904 => 212905)
--- trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py 2017-02-23 19:01:29 UTC (rev 212904)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py 2017-02-23 19:04:33 UTC (rev 212905)
@@ -42,14 +42,22 @@
self.stderr = StringIO.StringIO(stderr)
self.stdin = StringIO.StringIO()
self.returncode = 0
+ self._is_running = False
def wait(self):
- return
+ self._is_running = False
+ return self.returncode
def communicate(self, input=None):
+ self._is_running = False
return (self.stdout, self.stderr)
+ def poll(self):
+ if self._is_running:
+ return None
+ return self.returncode
+
# FIXME: This should be unified with MockExecutive2
class MockExecutive(object):
PIPE = "MOCK PIPE"
@@ -146,6 +154,7 @@
_log.info("MOCK popen: %s%s%s" % (args, cwd_string, env_string))
if not self._proc:
self._proc = MockProcess()
+ self._proc._is_running = True
return self._proc
def run_in_parallel(self, commands):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py (212904 => 212905)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py 2017-02-23 19:01:29 UTC (rev 212904)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py 2017-02-23 19:04:33 UTC (rev 212905)
@@ -66,6 +66,7 @@
self._name = name
self._log_file_name = '%s_process_log.out.txt' % (self._name)
+ self._output_log_path = None
self._wsout = None
self._process = None
self._pid_file = pidfile
@@ -140,8 +141,8 @@
def _prepare_config(self):
if self._filesystem.exists(self._output_dir):
- output_log = self._filesystem.join(self._output_dir, self._log_file_name)
- self._wsout = self._filesystem.open_text_file_for_writing(output_log)
+ 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._install_modules()
self._copy_webkit_test_files()
@@ -157,6 +158,16 @@
# Wait a second for the server to actually start so that tests do not start until server is running.
time.sleep(1)
+ # The server is not running after 1 second, something went wrong.
+ if self._process.poll() is not None:
+ self._stop_running_server()
+ error_log = ('WPT Server process exited prematurely with status code %s\n' % self._process.returncode
+ + 'The cmdline for running the WPT server was: %s\n' % self._start_cmd
+ + 'The working dir was: %s\n' % self._doc_root_path)
+ if self._output_log_path is not None and self._filesystem.exists(self._output_log_path):
+ error_log += 'Check the logfile for the command at: %s\n' % self._output_log_path
+ raise http_server_base.ServerError(error_log)
+
return self._process.pid
def _stop_running_subservers(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py (212904 => 212905)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py 2017-02-23 19:01:29 UTC (rev 212904)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py 2017-02-23 19:04:33 UTC (rev 212905)
@@ -97,3 +97,19 @@
server.start()
self.assertFalse(host.filesystem.exists("/mock/output_dir/wpttest_servers.json"))
server.stop()
+
+ def test_server_fails_to_start_throws_exception(self):
+ host = MockHost()
+ options = optparse.Values()
+ options.ensure_value("results_directory", "/mock/output_dir")
+ port = Port(host, "test", options)
+ server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir/pid.txt")
+ server._check_that_all_ports_are_available = lambda: True
+ server._is_server_running_on_all_ports = lambda: True
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/resources/testharness.js", "0")
+ host.filesystem.write_text_file("/mock-checkout/LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js", "0")
+
+ server.start()
+ server.stop()
+ server._process.poll = lambda: 1
+ self.assertRaises(ServerError, server.start)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes