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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 | 436 |
437 return test_result.InstrumentationTestResult( | 437 return test_result.InstrumentationTestResult( |
438 test, result_type, start_ms, duration_ms, log=log) | 438 test, result_type, start_ms, duration_ms, log=log) |
439 | 439 |
440 #override | 440 #override |
441 def RunTest(self, test): | 441 def RunTest(self, test): |
442 results = base_test_result.TestRunResults() | 442 results = base_test_result.TestRunResults() |
443 timeout = (self._GetIndividualTestTimeoutSecs(test) * | 443 timeout = (self._GetIndividualTestTimeoutSecs(test) * |
444 self._GetIndividualTestTimeoutScale(test) * | 444 self._GetIndividualTestTimeoutScale(test) * |
445 self.tool.GetTimeoutScale()) | 445 self.tool.GetTimeoutScale()) |
446 if (self.device.GetProp('ro.build.version.sdk') | 446 if (self.device.build_version_sdk |
447 < constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): | 447 < constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): |
perezju
2014/12/10 13:37:34
Note how this test was actually BROKEN, comparing
jbudorick
2014/12/11 02:05:56
X(
This was me. Nice catch.
| |
448 timeout *= 10 | 448 timeout *= 10 |
449 | 449 |
450 start_ms = 0 | 450 start_ms = 0 |
451 duration_ms = 0 | 451 duration_ms = 0 |
452 try: | 452 try: |
453 self.TestSetup(test) | 453 self.TestSetup(test) |
454 | 454 |
455 time_ms = lambda: int(time.time() * 1000) | 455 time_ms = lambda: int(time.time() * 1000) |
456 start_ms = time_ms() | 456 start_ms = time_ms() |
457 raw_output = self._RunTest(test, timeout) | 457 raw_output = self._RunTest(test, timeout) |
458 duration_ms = time_ms() - start_ms | 458 duration_ms = time_ms() - start_ms |
459 | 459 |
460 # Parse the test output | 460 # Parse the test output |
461 _, _, statuses = self._ParseAmInstrumentRawOutput(raw_output) | 461 _, _, statuses = self._ParseAmInstrumentRawOutput(raw_output) |
462 result = self._GenerateTestResult(test, statuses, start_ms, duration_ms) | 462 result = self._GenerateTestResult(test, statuses, start_ms, duration_ms) |
463 results.AddResult(result) | 463 results.AddResult(result) |
464 except device_errors.CommandTimeoutError as e: | 464 except device_errors.CommandTimeoutError as e: |
465 results.AddResult(test_result.InstrumentationTestResult( | 465 results.AddResult(test_result.InstrumentationTestResult( |
466 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 466 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
467 log=str(e) or 'No information')) | 467 log=str(e) or 'No information')) |
468 except device_errors.DeviceUnreachableError as e: | 468 except device_errors.DeviceUnreachableError as e: |
469 results.AddResult(test_result.InstrumentationTestResult( | 469 results.AddResult(test_result.InstrumentationTestResult( |
470 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 470 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
471 log=str(e) or 'No information')) | 471 log=str(e) or 'No information')) |
472 self.TestTeardown(test, results) | 472 self.TestTeardown(test, results) |
473 return (results, None if results.DidRunPass() else test) | 473 return (results, None if results.DidRunPass() else test) |
OLD | NEW |