OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return 600 * 60 | 299 return 600 * 60 |
300 if 'External' in annotations: | 300 if 'External' in annotations: |
301 return 10 * 60 | 301 return 10 * 60 |
302 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: | 302 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: |
303 return 5 * 60 | 303 return 5 * 60 |
304 if 'MediumTest' in annotations: | 304 if 'MediumTest' in annotations: |
305 return 3 * 60 | 305 return 3 * 60 |
306 return 1 * 60 | 306 return 1 * 60 |
307 | 307 |
308 def _RunTest(self, test, timeout): | 308 def _RunTest(self, test, timeout): |
309 return self.adb.RunInstrumentationTest( | 309 try: |
310 test, self.test_pkg.GetPackageName(), | 310 return self.adb.RunInstrumentationTest( |
311 self._GetInstrumentationArgs(), timeout) | 311 test, self.test_pkg.GetPackageName(), |
| 312 self._GetInstrumentationArgs(), timeout) |
| 313 except android_commands.errors.WaitForResponseTimedOutError: |
| 314 logging.info('Ran the test with timeout of %ds.' % timeout) |
| 315 raise |
312 | 316 |
313 #override | 317 #override |
314 def RunTest(self, test): | 318 def RunTest(self, test): |
315 raw_result = None | 319 raw_result = None |
316 start_date_ms = None | 320 start_date_ms = None |
317 results = base_test_result.TestRunResults() | 321 results = base_test_result.TestRunResults() |
318 timeout=(self._GetIndividualTestTimeoutSecs(test) * | 322 timeout=(self._GetIndividualTestTimeoutSecs(test) * |
319 self._GetIndividualTestTimeoutScale(test) * | 323 self._GetIndividualTestTimeoutScale(test) * |
320 self.tool.GetTimeoutScale()) | 324 self.tool.GetTimeoutScale()) |
321 try: | 325 try: |
(...skipping 27 matching lines...) Expand all Loading... |
349 duration_ms = 0 | 353 duration_ms = 0 |
350 message = str(e) | 354 message = str(e) |
351 if not message: | 355 if not message: |
352 message = 'No information.' | 356 message = 'No information.' |
353 results.AddResult(test_result.InstrumentationTestResult( | 357 results.AddResult(test_result.InstrumentationTestResult( |
354 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 358 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
355 log=message)) | 359 log=message)) |
356 raw_result = None | 360 raw_result = None |
357 self.TestTeardown(test, raw_result) | 361 self.TestTeardown(test, raw_result) |
358 return (results, None if results.DidRunPass() else test) | 362 return (results, None if results.DidRunPass() else test) |
OLD | NEW |