OLD | NEW |
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 | 4 |
5 import logging | 5 import logging |
6 import os | |
7 import re | 6 import re |
8 import time | 7 import time |
9 | 8 |
10 from devil.android import device_errors | 9 from devil.android import device_errors |
11 from devil.android import flag_changer | 10 from devil.android import flag_changer |
12 from devil.utils import reraiser_thread | 11 from devil.utils import reraiser_thread |
13 from pylib import valgrind_tools | 12 from pylib import valgrind_tools |
14 from pylib.base import base_test_result | 13 from pylib.base import base_test_result |
15 from pylib.local.device import local_device_test_run | 14 from pylib.local.device import local_device_test_run |
16 | 15 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if r.GetName() == test_name: | 256 if r.GetName() == test_name: |
258 r.SetName(test_display_name) | 257 r.SetName(test_display_name) |
259 if DidPackageCrashOnDevice(self._test_instance.test_package, device): | 258 if DidPackageCrashOnDevice(self._test_instance.test_package, device): |
260 for r in results: | 259 for r in results: |
261 if r.GetType() == base_test_result.ResultType.UNKNOWN: | 260 if r.GetType() == base_test_result.ResultType.UNKNOWN: |
262 r.SetType(base_test_result.ResultType.CRASH) | 261 r.SetType(base_test_result.ResultType.CRASH) |
263 | 262 |
264 if any(r.GetType() not in (base_test_result.ResultType.PASS, | 263 if any(r.GetType() not in (base_test_result.ResultType.PASS, |
265 base_test_result.ResultType.SKIP) | 264 base_test_result.ResultType.SKIP) |
266 for r in results): | 265 for r in results): |
267 if self._test_instance.screenshot_dir: | |
268 file_name = '%s-%s.png' % ( | |
269 test_display_name, | |
270 time.strftime('%Y%m%dT%H%M%S', time.localtime())) | |
271 saved_dir = device.TakeScreenshot( | |
272 os.path.join(self._test_instance.screenshot_dir, file_name)) | |
273 logging.info( | |
274 'Saved screenshot for %s to %s.', | |
275 test_display_name, saved_dir) | |
276 logging.info('detected failure in %s. raw output:', test_display_name) | 266 logging.info('detected failure in %s. raw output:', test_display_name) |
277 for l in output: | 267 for l in output: |
278 logging.info(' %s', l) | 268 logging.info(' %s', l) |
279 if (not self._env.skip_clear_data | 269 if (not self._env.skip_clear_data |
280 and self._test_instance.package_info): | 270 and self._test_instance.package_info): |
281 permissions = ( | 271 permissions = ( |
282 self._test_instance.apk_under_test.GetPermissions() | 272 self._test_instance.apk_under_test.GetPermissions() |
283 if self._test_instance.apk_under_test | 273 if self._test_instance.apk_under_test |
284 else None) | 274 else None) |
285 device.ClearApplicationState(self._test_instance.package_info.package, | 275 device.ClearApplicationState(self._test_instance.package_info.package, |
(...skipping 25 matching lines...) Expand all Loading... |
311 timeout = v | 301 timeout = v |
312 break | 302 break |
313 else: | 303 else: |
314 logging.warning('Using default 1 minute timeout for %s', test_name) | 304 logging.warning('Using default 1 minute timeout for %s', test_name) |
315 timeout = 60 | 305 timeout = 60 |
316 | 306 |
317 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 307 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
318 | 308 |
319 return timeout | 309 return timeout |
320 | 310 |
OLD | NEW |