OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
5 """Runs perf tests. | 5 """Runs perf tests. |
6 | 6 |
7 Our buildbot infrastructure requires each slave to run steps serially. | 7 Our buildbot infrastructure requires each slave to run steps serially. |
8 This is sub-optimal for android, where these steps can run independently on | 8 This is sub-optimal for android, where these steps can run independently on |
9 multiple connected devices. | 9 multiple connected devices. |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 def _CleanupOutputDirectory(self): | 226 def _CleanupOutputDirectory(self): |
227 if self._output_dir: | 227 if self._output_dir: |
228 shutil.rmtree(self._output_dir, ignore_errors=True) | 228 shutil.rmtree(self._output_dir, ignore_errors=True) |
229 self._output_dir = None | 229 self._output_dir = None |
230 | 230 |
231 def _ReadChartjsonOutput(self): | 231 def _ReadChartjsonOutput(self): |
232 if not self._output_dir: | 232 if not self._output_dir: |
233 return '' | 233 return '' |
234 | 234 |
235 json_output_path = os.path.join(self._output_dir, 'results-chart.json') | 235 json_output_path = os.path.join(self._output_dir, 'results-chart.json') |
236 with open(json_output_path) as f: | 236 try: |
237 return f.read() | 237 with open(json_output_path) as f: |
238 return f.read() | |
239 except IOError, e: | |
240 logging.exception('Exception when reading chartjson: %s', e) | |
jbudorick
2015/06/09 20:00:59
logging.exception automatically logs the exception
shatch
2015/06/09 20:33:47
Done.
| |
241 logging.error('This usually means that telemetry did not run, so it could' | |
242 ' not generate the file. Please check the device running' | |
243 ' the test.') | |
244 return '' | |
238 | 245 |
239 def _LaunchPerfTest(self, test_name): | 246 def _LaunchPerfTest(self, test_name): |
240 """Runs a perf test. | 247 """Runs a perf test. |
241 | 248 |
242 Args: | 249 Args: |
243 test_name: the name of the test to be executed. | 250 test_name: the name of the test to be executed. |
244 | 251 |
245 Returns: | 252 Returns: |
246 A tuple containing (Output, base_test_result.ResultType) | 253 A tuple containing (Output, base_test_result.ResultType) |
247 """ | 254 """ |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 Returns: | 355 Returns: |
349 A tuple of (TestRunResults, retry). | 356 A tuple of (TestRunResults, retry). |
350 """ | 357 """ |
351 _, result_type = self._LaunchPerfTest(test_name) | 358 _, result_type = self._LaunchPerfTest(test_name) |
352 results = base_test_result.TestRunResults() | 359 results = base_test_result.TestRunResults() |
353 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 360 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
354 retry = None | 361 retry = None |
355 if not results.DidRunPass(): | 362 if not results.DidRunPass(): |
356 retry = test_name | 363 retry = test_name |
357 return results, retry | 364 return results, retry |
OLD | NEW |