Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py

Issue 1783073002: Run auto-formatter on files in webkitpy/layout_tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ran yapf -i --style '{based_on_style: pep8, column_limit: 132}' then did manual fix-up Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4
5 """Start and stop the WPTserve servers as they're used by the layout tests.""" 4 """Start and stop the WPTserve servers as they're used by the layout tests."""
6 5
7 from webkitpy.layout_tests.servers import server_base 6 from webkitpy.layout_tests.servers import server_base
8 7
9 8
10 class WPTServe(server_base.ServerBase): 9 class WPTServe(server_base.ServerBase):
11 def __init__(self, port_obj, output_dir): 10 def __init__(self, port_obj, output_dir):
12 super(WPTServe, self).__init__(port_obj, output_dir) 11 super(WPTServe, self).__init__(port_obj, output_dir)
13 # These ports must match wpt_support/wpt.config.json 12 # These ports must match wpt_support/wpt.config.json
14 http_port, http_alt_port, https_port = (8001, 8081, 8444) 13 http_port, http_alt_port, https_port = (8001, 8081, 8444)
15 ws_port, wss_port = (9001, 9444) 14 ws_port, wss_port = (9001, 9444)
16 self._name = 'wptserve' 15 self._name = 'wptserve'
17 self._log_prefixes = ('access_log', 'error_log') 16 self._log_prefixes = ('access_log', 'error_log')
18 self._mappings = [{'port': http_port}, 17 self._mappings = [{'port': http_port}, {'port': http_alt_port}, {'port': https_port,
19 {'port': http_alt_port}, 18 'sslcer t': True}, {'port': ws_port}, {'port': wss_port,
20 {'port': https_port, 'sslcert': True}, 19 'sslcert': True}]
21 {'port': ws_port},
22 {'port': wss_port, 'sslcert': True}]
23 20
24 # TODO(burnik): We can probably avoid PID files for WPT in the future. 21 # TODO(burnik): We can probably avoid PID files for WPT in the future.
25 fs = self._filesystem 22 fs = self._filesystem
26 self._pid_file = fs.join(self._runtime_path, '%s.pid' % self._name) 23 self._pid_file = fs.join(self._runtime_path, '%s.pid' % self._name)
27 24
28 path_to_thirdparty = self._port_obj.path_from_webkit_base('Tools', 'Scri pts', 'webkitpy', 'thirdparty') 25 path_to_thirdparty = self._port_obj.path_from_webkit_base('Tools', 'Scri pts', 'webkitpy', 'thirdparty')
29 path_to_wpt_support = self._port_obj.path_from_webkit_base('Tools', 'Scr ipts', 'webkitpy', 'thirdparty', 'wpt') 26 path_to_wpt_support = self._port_obj.path_from_webkit_base('Tools', 'Scr ipts', 'webkitpy', 'thirdparty', 'wpt')
30 path_to_wpt_root = fs.join(path_to_wpt_support, 'wpt') 27 path_to_wpt_root = fs.join(path_to_wpt_support, 'wpt')
31 path_to_wpt_config = fs.join(path_to_wpt_support, 'wpt.config.json') 28 path_to_wpt_config = fs.join(path_to_wpt_support, 'wpt.config.json')
32 path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.layout_tests_dir() , 'imported', 'web-platform-tests')) 29 path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.layout_tests_dir() , 'imported', 'web-platform-tests'))
33 path_to_ws_handlers = fs.join(path_to_wpt_tests, 'websockets', 'handlers ') 30 path_to_ws_handlers = fs.join(path_to_wpt_tests, 'websockets', 'handlers ')
34 serve_script = fs.join(path_to_wpt_root, 'serve') 31 serve_script = fs.join(path_to_wpt_root, 'serve')
35 start_cmd = [self._port_obj.host.executable, 32 start_cmd = [self._port_obj.host.executable, '-u', serve_script, '--conf ig', path_to_wpt_config, '--doc_root',
36 '-u', serve_script, 33 path_to_wpt_tests]
37 '--config', path_to_wpt_config,
38 '--doc_root', path_to_wpt_tests]
39 34
40 # TODO(burnik): Merge with default start_cmd once we roll in websockets. 35 # TODO(burnik): Merge with default start_cmd once we roll in websockets.
41 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): 36 if self._port_obj.host.filesystem.exists(path_to_ws_handlers):
42 start_cmd += ['--ws_doc_root', path_to_ws_handlers] 37 start_cmd += ['--ws_doc_root', path_to_ws_handlers]
43 38
44 self._stdout = self._stderr = self._executive.DEVNULL 39 self._stdout = self._stderr = self._executive.DEVNULL
45 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it. 40 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it.
46 self._cwd = path_to_wpt_root 41 self._cwd = path_to_wpt_root
47 self._env = {'PYTHONPATH': path_to_thirdparty} 42 self._env = {'PYTHONPATH': path_to_thirdparty}
48 self._keep_process_reference = True 43 self._keep_process_reference = True
49 self._start_cmd = start_cmd 44 self._start_cmd = start_cmd
50 45
51 def _stop_running_server(self): 46 def _stop_running_server(self):
52 # Clean up the pid file. 47 # Clean up the pid file.
53 if self._pid and not self._executive.check_running_pid(self._pid): 48 if self._pid and not self._executive.check_running_pid(self._pid):
54 self._filesystem.remove(self._pid_file) 49 self._filesystem.remove(self._pid_file)
55 return 50 return
56 51
57 # TODO(burnik): Figure out a cleaner way of stopping wptserve. 52 # TODO(burnik): Figure out a cleaner way of stopping wptserve.
58 self._executive.interrupt(self._pid) 53 self._executive.interrupt(self._pid)
59 54
60 # According to Popen.wait(), this can deadlock when using stdout=PIPE an d/or stderr=PIPE. 55 # According to Popen.wait(), this can deadlock when using stdout=PIPE an d/or stderr=PIPE.
61 # We're using DEVNULL for both so that should not occur. 56 # We're using DEVNULL for both so that should not occur.
62 self._process.wait() 57 self._process.wait()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698