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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py

Issue 2846593004: Don't log xvfb errors under normal circumstances in run-webkit-tests (Closed)
Patch Set: merge, address review feedback Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 _log.error('Could not find apache. Not installed or unknown path.') 109 _log.error('Could not find apache. Not installed or unknown path.')
110 return None 110 return None
111 111
112 def setup_test_run(self): 112 def setup_test_run(self):
113 super(LinuxPort, self).setup_test_run() 113 super(LinuxPort, self).setup_test_run()
114 self._start_xvfb() 114 self._start_xvfb()
115 self._setup_dummy_home_dir() 115 self._setup_dummy_home_dir()
116 116
117 def clean_up_test_run(self): 117 def clean_up_test_run(self):
118 super(LinuxPort, self).clean_up_test_run() 118 super(LinuxPort, self).clean_up_test_run()
119 self._stop_xvfb() 119 self._stop_xvfb(save_logs=False)
120 self._clean_up_dummy_home_dir() 120 self._clean_up_dummy_home_dir()
121 121
122 # 122 #
123 # PROTECTED METHODS 123 # PROTECTED METHODS
124 # 124 #
125 125
126 def _setup_dummy_home_dir(self): 126 def _setup_dummy_home_dir(self):
127 """Creates a dummy home directory for running the test. 127 """Creates a dummy home directory for running the test.
128 128
129 This is a workaround for crbug.com/595504; see crbug.com/612730. 129 This is a workaround for crbug.com/595504; see crbug.com/612730.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 # Check that xvfb has started correctly via probing using xdpyinfo. 183 # Check that xvfb has started correctly via probing using xdpyinfo.
184 # While xvfb is running, the poll() method will return None; 184 # While xvfb is running, the poll() method will return None;
185 # https://docs.python.org/2/library/subprocess.html#subprocess.Popen.pol l 185 # https://docs.python.org/2/library/subprocess.html#subprocess.Popen.pol l
186 start_time = self.host.time() 186 start_time = self.host.time()
187 while self.host.time() - start_time < self.XVFB_START_TIMEOUT or self._x vfb_process.poll() is not None: 187 while self.host.time() - start_time < self.XVFB_START_TIMEOUT or self._x vfb_process.poll() is not None:
188 # We don't explicitly set the display, as we want to check the 188 # We don't explicitly set the display, as we want to check the
189 # environment value. 189 # environment value.
190 exit_code = self.host.executive.run_command( 190 exit_code = self.host.executive.run_command(
191 ['xdpyinfo'], return_exit_code=True) 191 ['xdpyinfo'], return_exit_code=True)
192 if exit_code == 0: 192 if exit_code == 0:
193 _log.info('Successfully started Xvfb with display "%s".', displa y) 193 _log.debug('Successfully started Xvfb with display "%s".', displ ay)
194 return 194 return
195 _log.warn('xdpyinfo check failed with exit code %s while starting Xv fb on "%s".', exit_code, display) 195 _log.warn('xdpyinfo check failed with exit code %s while starting Xv fb on "%s".', exit_code, display)
196 self.host.sleep(0.1) 196 self.host.sleep(0.1)
197 197
198 retcode = self._xvfb_process.poll() 198 retcode = self._xvfb_process.poll()
199 self._stop_xvfb() 199 self._stop_xvfb(save_logs=True)
200 _log.critical('Failed to start Xvfb on display "%s" (xvfb retcode: %r).' , display, retcode) 200 _log.critical('Failed to start Xvfb on display "%s" (xvfb retcode: %r).' , display, retcode)
201 201
202 def _find_display(self): 202 def _find_display(self):
203 """Tries to find a free X display, looping if necessary.""" 203 """Tries to find a free X display, looping if necessary."""
204 # The "xvfb-run" command uses :99 by default. 204 # The "xvfb-run" command uses :99 by default.
205 for display_number in range(99, 120): 205 for display_number in range(99, 120):
206 display = ':%d' % display_number 206 display = ':%d' % display_number
207 exit_code = self.host.executive.run_command( 207 exit_code = self.host.executive.run_command(
208 ['xdpyinfo', '-display', display], return_exit_code=True) 208 ['xdpyinfo', '-display', display], return_exit_code=True)
209 if exit_code == 1: 209 if exit_code == 1:
210 return display 210 return display
211 return None 211 return None
212 212
213 def _stop_xvfb(self): 213 def _stop_xvfb(self, save_logs):
214 if self._original_display: 214 if self._original_display:
215 self.host.environ['DISPLAY'] = self._original_display 215 self.host.environ['DISPLAY'] = self._original_display
216 if self._xvfb_stdout: 216 if self._xvfb_stdout:
217 self._xvfb_stdout.close() 217 self._xvfb_stdout.close()
218 if self._xvfb_stderr: 218 if self._xvfb_stderr:
219 self._xvfb_stderr.close() 219 self._xvfb_stderr.close()
220 if self._xvfb_process: 220 if self._xvfb_process:
221 _log.debug('Killing Xvfb process pid %d.', self._xvfb_process.pid) 221 _log.debug('Killing Xvfb process pid %d.', self._xvfb_process.pid)
222 self._xvfb_process.kill() 222 self._xvfb_process.kill()
223 self._xvfb_process.wait() 223 self._xvfb_process.wait()
224 if self._xvfb_stdout and self.host.filesystem.exists(self._xvfb_stdout.n ame): 224 if save_logs and self._xvfb_stdout and self.host.filesystem.exists(self. _xvfb_stdout.name):
225 for line in self.host.filesystem.read_text_file(self._xvfb_stdout.na me).splitlines(): 225 for line in self.host.filesystem.read_text_file(self._xvfb_stdout.na me).splitlines():
226 _log.warn('Xvfb stdout: %s', line) 226 _log.warn('Xvfb stdout: %s', line)
227 self.host.filesystem.remove(self._xvfb_stdout.name) 227 self.host.filesystem.remove(self._xvfb_stdout.name)
228 if self._xvfb_stderr and self.host.filesystem.exists(self._xvfb_stderr.n ame): 228 if save_logs and self._xvfb_stderr and self.host.filesystem.exists(self. _xvfb_stderr.name):
229 for line in self.host.filesystem.read_text_file(self._xvfb_stderr.na me).splitlines(): 229 for line in self.host.filesystem.read_text_file(self._xvfb_stderr.na me).splitlines():
230 _log.warn('Xvfb stderr: %s', line) 230 _log.warn('Xvfb stderr: %s', line)
231 self.host.filesystem.remove(self._xvfb_stderr.name) 231 self.host.filesystem.remove(self._xvfb_stderr.name)
232 self._xvfb_stdout = self._xvfb_stderr = self._xvfb_process = None 232 self._xvfb_stdout = self._xvfb_stderr = self._xvfb_process = None
233 233
234 def _path_to_driver(self, target=None): 234 def _path_to_driver(self, target=None):
235 binary_name = self.driver_name() 235 binary_name = self.driver_name()
236 return self._build_path_with_target(target, binary_name) 236 return self._build_path_with_target(target, binary_name)
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698