| 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 host-driven tests on a particular device.""" | 5 """Runs host-driven tests on a particular device.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import sys | 8 import sys |
| 9 import time | 9 import time |
| 10 import traceback | 10 import traceback |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 A TestRunResults object which contains the result produced by the test | 79 A TestRunResults object which contains the result produced by the test |
| 80 and, in the case of a failure, the test that should be retried. | 80 and, in the case of a failure, the test that should be retried. |
| 81 """ | 81 """ |
| 82 | 82 |
| 83 assert isinstance(test, test_case.HostDrivenTestCase) | 83 assert isinstance(test, test_case.HostDrivenTestCase) |
| 84 | 84 |
| 85 start_date_ms = int(time.time()) * 1000 | 85 start_date_ms = int(time.time()) * 1000 |
| 86 exception_raised = False | 86 exception_raised = False |
| 87 | 87 |
| 88 try: | 88 try: |
| 89 test.SetUp(str(self.device), self.shard_index) | 89 test.SetUp(self.device, self.shard_index) |
| 90 except Exception: | 90 except Exception: |
| 91 logging.exception( | 91 logging.exception( |
| 92 'Caught exception while trying to run SetUp() for test: ' + | 92 'Caught exception while trying to run SetUp() for test: ' + |
| 93 test.tagged_name) | 93 test.tagged_name) |
| 94 # Tests whose SetUp() method has failed are likely to fail, or at least | 94 # Tests whose SetUp() method has failed are likely to fail, or at least |
| 95 # yield invalid results. | 95 # yield invalid results. |
| 96 exc_info = sys.exc_info() | 96 exc_info = sys.exc_info() |
| 97 results = base_test_result.TestRunResults() | 97 results = base_test_result.TestRunResults() |
| 98 results.AddResult(HostDrivenExceptionTestResult( | 98 results.AddResult(HostDrivenExceptionTestResult( |
| 99 test.tagged_name, start_date_ms, exc_info)) | 99 test.tagged_name, start_date_ms, exc_info)) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 124 # until the test is fixed. | 124 # until the test is fixed. |
| 125 exc_info = sys.exc_info() | 125 exc_info = sys.exc_info() |
| 126 results = base_test_result.TestRunResults() | 126 results = base_test_result.TestRunResults() |
| 127 results.AddResult(HostDrivenExceptionTestResult( | 127 results.AddResult(HostDrivenExceptionTestResult( |
| 128 test.tagged_name, start_date_ms, exc_info)) | 128 test.tagged_name, start_date_ms, exc_info)) |
| 129 | 129 |
| 130 if not results.DidRunPass(): | 130 if not results.DidRunPass(): |
| 131 return results, test | 131 return results, test |
| 132 else: | 132 else: |
| 133 return results, None | 133 return results, None |
| OLD | NEW |