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 linker tests on a particular device.""" | 5 """Runs linker tests on a particular device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os.path | 8 import os.path |
9 import sys | 9 import sys |
10 import time | 10 import time |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 raise Exception('%s not found, please build it' % apk_path) | 73 raise Exception('%s not found, please build it' % apk_path) |
74 | 74 |
75 package_name = apk_helper.GetPackageName(apk_path) | 75 package_name = apk_helper.GetPackageName(apk_path) |
76 self.adb.ManagedInstall(apk_path, package_name) | 76 self.adb.ManagedInstall(apk_path, package_name) |
77 | 77 |
78 #override | 78 #override |
79 def RunTest(self, test): | 79 def RunTest(self, test): |
80 """Sets up and runs a test case. | 80 """Sets up and runs a test case. |
81 | 81 |
82 Args: | 82 Args: |
83 test: An object which is ostensibly a subclass of LinkerTestCase. | 83 test: An object which is ostensibly a subclass of LinkerTestCaseBase. |
84 | 84 |
85 Returns: | 85 Returns: |
86 A TestRunResults object which contains the result produced by the test | 86 A TestRunResults object which contains the result produced by the test |
87 and, in the case of a failure, the test that should be retried. | 87 and, in the case of a failure, the test that should be retried. |
88 """ | 88 """ |
89 | 89 |
90 assert isinstance(test, test_case.LinkerTestCase) | 90 assert isinstance(test, test_case.LinkerTestCaseBase) |
91 | 91 |
92 try: | 92 try: |
93 results = test.Run(self.device) | 93 results = test.Run(self.device) |
94 except Exception: | 94 except Exception: |
95 logging.exception('Caught exception while trying to run test: ' + | 95 logging.exception('Caught exception while trying to run test: ' + |
96 test.tagged_name) | 96 test.tagged_name) |
97 exc_info = sys.exc_info() | 97 exc_info = sys.exc_info() |
98 results = base_test_result.TestRunResults() | 98 results = base_test_result.TestRunResults() |
99 results.AddResult(LinkerExceptionTestResult( | 99 results.AddResult(LinkerExceptionTestResult( |
100 test.tagged_name, exc_info)) | 100 test.tagged_name, exc_info)) |
101 | 101 |
102 if not results.DidRunPass(): | 102 if not results.DidRunPass(): |
103 return results, test | 103 return results, test |
104 else: | 104 else: |
105 return results, None | 105 return results, None |
OLD | NEW |