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