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 sys | 10 import sys |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if scale_match: | 312 if scale_match: |
313 timeout_scale = int(scale_match.group(1)) | 313 timeout_scale = int(scale_match.group(1)) |
314 if self.options.wait_for_debugger: | 314 if self.options.wait_for_debugger: |
315 timeout_scale *= 100 | 315 timeout_scale *= 100 |
316 return timeout_scale | 316 return timeout_scale |
317 | 317 |
318 def _GetIndividualTestTimeoutSecs(self, test): | 318 def _GetIndividualTestTimeoutSecs(self, test): |
319 """Returns the timeout in seconds for the given |test|.""" | 319 """Returns the timeout in seconds for the given |test|.""" |
320 annotations = self.test_pkg.GetTestAnnotations(test) | 320 annotations = self.test_pkg.GetTestAnnotations(test) |
321 if 'Manual' in annotations: | 321 if 'Manual' in annotations: |
322 return 600 * 60 | 322 return 10 * 60 * 60 |
323 if 'External' in annotations: | 323 if 'External' in annotations: |
324 return 10 * 60 | 324 return 10 * 60 |
| 325 if 'EnormousTest' in annotations: |
| 326 return 10 * 60 |
325 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: | 327 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: |
326 return 5 * 60 | 328 return 5 * 60 |
327 if 'MediumTest' in annotations: | 329 if 'MediumTest' in annotations: |
328 return 3 * 60 | 330 return 3 * 60 |
| 331 if 'SmallTest' in annotations: |
| 332 return 1 * 60 |
| 333 |
| 334 logging.warn(("Test size not found in annotations for test '{0}', using " + |
| 335 "1 minute for timeout.").format(test)) |
329 return 1 * 60 | 336 return 1 * 60 |
330 | 337 |
331 def _RunTest(self, test, timeout): | 338 def _RunTest(self, test, timeout): |
332 try: | 339 try: |
333 return self.device.old_interface.RunInstrumentationTest( | 340 return self.device.old_interface.RunInstrumentationTest( |
334 test, self.test_pkg.GetPackageName(), | 341 test, self.test_pkg.GetPackageName(), |
335 self._GetInstrumentationArgs(), timeout) | 342 self._GetInstrumentationArgs(), timeout) |
336 except (device_errors.CommandTimeoutError, | 343 except (device_errors.CommandTimeoutError, |
337 # TODO(jbudorick) Remove this once the underlying implementations | 344 # TODO(jbudorick) Remove this once the underlying implementations |
338 # for the above are switched or wrapped. | 345 # for the above are switched or wrapped. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 duration_ms = 0 | 394 duration_ms = 0 |
388 message = str(e) | 395 message = str(e) |
389 if not message: | 396 if not message: |
390 message = 'No information.' | 397 message = 'No information.' |
391 results.AddResult(test_result.InstrumentationTestResult( | 398 results.AddResult(test_result.InstrumentationTestResult( |
392 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 399 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
393 log=message)) | 400 log=message)) |
394 raw_result = None | 401 raw_result = None |
395 self.TestTeardown(test, raw_result) | 402 self.TestTeardown(test, raw_result) |
396 return (results, None if results.DidRunPass() else test) | 403 return (results, None if results.DidRunPass() else test) |
OLD | NEW |