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 |
11 | 11 |
12 from devil.android import apk_helper | |
13 from pylib import constants | 12 from pylib import constants |
14 from pylib.base import base_test_result | 13 from pylib.base import base_test_result |
15 from pylib.base import base_test_runner | 14 from pylib.base import base_test_runner |
16 from pylib.linker import test_case | 15 from pylib.linker import test_case |
17 | 16 |
18 | 17 |
19 # Name of the Android package to install for this to work. | 18 # Name of the Android package to install for this to work. |
20 _PACKAGE_NAME = 'ChromiumLinkerTest' | 19 _PACKAGE_NAME = 'ChromiumLinkerTest' |
21 | 20 |
22 | 21 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 76 |
78 Returns: | 77 Returns: |
79 A TestRunResults object which contains the result produced by the test | 78 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. | 79 and, in the case of a failure, the test that should be retried. |
81 """ | 80 """ |
82 | 81 |
83 assert isinstance(test, test_case.LinkerTestCaseBase) | 82 assert isinstance(test, test_case.LinkerTestCaseBase) |
84 | 83 |
85 try: | 84 try: |
86 results = test.Run(self.device) | 85 results = test.Run(self.device) |
87 except Exception: | 86 except Exception: # pylint: disable=broad-except |
88 logging.exception('Caught exception while trying to run test: ' + | 87 logging.exception('Caught exception while trying to run test: ' + |
89 test.tagged_name) | 88 test.tagged_name) |
90 exc_info = sys.exc_info() | 89 exc_info = sys.exc_info() |
91 results = base_test_result.TestRunResults() | 90 results = base_test_result.TestRunResults() |
92 results.AddResult(LinkerExceptionTestResult( | 91 results.AddResult(LinkerExceptionTestResult( |
93 test.tagged_name, exc_info)) | 92 test.tagged_name, exc_info)) |
94 | 93 |
95 if not results.DidRunPass(): | 94 if not results.DidRunPass(): |
96 return results, test | 95 return results, test |
97 else: | 96 else: |
98 return results, None | 97 return results, None |
OLD | NEW |