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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/servers/server_base.py

Issue 1154373005: Introduce WPTServe for running W3C Blink Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add executable bit to pass permchecks. Created 5 years, 6 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 (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 # Subclasses must override these fields. 66 # Subclasses must override these fields.
67 self._name = '<virtual>' 67 self._name = '<virtual>'
68 self._log_prefixes = tuple() 68 self._log_prefixes = tuple()
69 self._mappings = {} 69 self._mappings = {}
70 self._pid_file = None 70 self._pid_file = None
71 self._start_cmd = None 71 self._start_cmd = None
72 72
73 # Subclasses may override these fields. 73 # Subclasses may override these fields.
74 self._env = None 74 self._env = None
75 self._cwd = None
75 self._stdout = self._executive.PIPE 76 self._stdout = self._executive.PIPE
76 self._stderr = self._executive.PIPE 77 self._stderr = self._executive.PIPE
77 self._process = None 78 self._process = None
78 self._pid = None 79 self._pid = None
79 self._error_log_path = None 80 self._error_log_path = None
80 81
81 def start(self): 82 def start(self):
82 """Starts the server. It is an error to start an already started server. 83 """Starts the server. It is an error to start an already started server.
83 84
84 This method also stops any stale servers started by a previous instance. """ 85 This method also stops any stale servers started by a previous instance. """
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 delete the logs will actually cause start() to fail.""" 156 delete the logs will actually cause start() to fail."""
156 # Sometimes logs are open in other processes but they should clear event ually. 157 # Sometimes logs are open in other processes but they should clear event ually.
157 for log_prefix in self._log_prefixes: 158 for log_prefix in self._log_prefixes:
158 try: 159 try:
159 self._remove_log_files(self._output_dir, log_prefix) 160 self._remove_log_files(self._output_dir, log_prefix)
160 except OSError, e: 161 except OSError, e:
161 _log.warning('Failed to remove old %s %s files' % (self._name, l og_prefix)) 162 _log.warning('Failed to remove old %s %s files' % (self._name, l og_prefix))
162 163
163 def _spawn_process(self): 164 def _spawn_process(self):
164 _log.debug('Starting %s server, cmd="%s"' % (self._name, self._start_cmd )) 165 _log.debug('Starting %s server, cmd="%s"' % (self._name, self._start_cmd ))
165 process = self._executive.popen(self._start_cmd, env=self._env, stdout=s elf._stdout, stderr=self._stderr) 166 self._process = self._executive.popen(self._start_cmd,
166 pid = process.pid 167 env=self._env,
168 cwd=self._cwd,
169 stdout=self._stdout,
170 stderr=self._stderr)
171 pid = self._process.pid
167 self._filesystem.write_text_file(self._pid_file, str(pid)) 172 self._filesystem.write_text_file(self._pid_file, str(pid))
168 return pid 173 return pid
169 174
170 def _stop_running_server(self): 175 def _stop_running_server(self):
171 self._wait_for_action(self._check_and_kill) 176 self._wait_for_action(self._check_and_kill)
172 if self._filesystem.exists(self._pid_file): 177 if self._filesystem.exists(self._pid_file):
173 self._filesystem.remove(self._pid_file) 178 self._filesystem.remove(self._pid_file)
174 179
175 def _check_and_kill(self): 180 def _check_and_kill(self):
176 if self._executive.check_running_pid(self._pid): 181 if self._executive.check_running_pid(self._pid):
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 except IOError, e: 274 except IOError, e:
270 if e.errno in (errno.EALREADY, errno.EADDRINUSE): 275 if e.errno in (errno.EALREADY, errno.EADDRINUSE):
271 raise ServerError('Port %d is already in use.' % port) 276 raise ServerError('Port %d is already in use.' % port)
272 elif self._platform.is_win() and e.errno in (errno.WSAEACCES,): # pylint: disable=E1101 277 elif self._platform.is_win() and e.errno in (errno.WSAEACCES,): # pylint: disable=E1101
273 raise ServerError('Port %d is already in use.' % port) 278 raise ServerError('Port %d is already in use.' % port)
274 else: 279 else:
275 raise 280 raise
276 finally: 281 finally:
277 s.close() 282 s.close()
278 _log.debug('all ports are available') 283 _log.debug('all ports are available')
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/servers/pywebsocket.py ('k') | Tools/Scripts/webkitpy/layout_tests/servers/wptserve.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698