| 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 """Base class for linker-specific test cases. | 5 """Base class for linker-specific test cases. |
| 6 | 6 |
| 7 The custom dynamic linker can only be tested through a custom test case | 7 The custom dynamic linker can only be tested through a custom test case |
| 8 for various technical reasons: | 8 for various technical reasons: |
| 9 | 9 |
| 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or | 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 To build and run the linker tests, do the following: | 30 To build and run the linker tests, do the following: |
| 31 | 31 |
| 32 ninja -C out/Debug chromium_linker_test_apk | 32 ninja -C out/Debug chromium_linker_test_apk |
| 33 build/android/test_runner.py linker | 33 build/android/test_runner.py linker |
| 34 | 34 |
| 35 """ | 35 """ |
| 36 # pylint: disable=R0201 | 36 # pylint: disable=R0201 |
| 37 | 37 |
| 38 import logging | 38 import logging |
| 39 import os | |
| 40 import re | 39 import re |
| 41 import time | |
| 42 | 40 |
| 43 from devil.android import device_errors | 41 from devil.android import device_errors |
| 44 from devil.android.sdk import intent | 42 from devil.android.sdk import intent |
| 45 from pylib import constants | |
| 46 from pylib.base import base_test_result | 43 from pylib.base import base_test_result |
| 47 | 44 |
| 48 | 45 |
| 49 ResultType = base_test_result.ResultType | 46 ResultType = base_test_result.ResultType |
| 50 | 47 |
| 51 _PACKAGE_NAME = 'org.chromium.chromium_linker_test_apk' | 48 _PACKAGE_NAME = 'org.chromium.chromium_linker_test_apk' |
| 52 _ACTIVITY_NAME = '.ChromiumLinkerTestActivity' | 49 _ACTIVITY_NAME = '.ChromiumLinkerTestActivity' |
| 53 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line' | 50 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line' |
| 54 | 51 |
| 55 # Logcat filters used during each test. Only the 'chromium' one is really | 52 # Logcat filters used during each test. Only the 'chromium' one is really |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 test_suffix = 'ForLegacyLinker' | 134 test_suffix = 'ForLegacyLinker' |
| 138 self.is_low_memory = is_low_memory | 135 self.is_low_memory = is_low_memory |
| 139 if is_low_memory: | 136 if is_low_memory: |
| 140 test_suffix += 'LowMemoryDevice' | 137 test_suffix += 'LowMemoryDevice' |
| 141 else: | 138 else: |
| 142 test_suffix += 'RegularDevice' | 139 test_suffix += 'RegularDevice' |
| 143 class_name = self.__class__.__name__ | 140 class_name = self.__class__.__name__ |
| 144 self.qualified_name = '%s.%s' % (class_name, test_suffix) | 141 self.qualified_name = '%s.%s' % (class_name, test_suffix) |
| 145 self.tagged_name = self.qualified_name | 142 self.tagged_name = self.qualified_name |
| 146 | 143 |
| 144 # pylint: disable=unused-argument |
| 147 def _RunTest(self, _device): | 145 def _RunTest(self, _device): |
| 148 """Run the test, must be overriden. | 146 """Run the test, must be overriden. |
| 149 Args: | 147 Args: |
| 150 _device: A DeviceUtils interface. | 148 _device: A DeviceUtils interface. |
| 151 Returns: | 149 Returns: |
| 152 A (status, log) tuple, where <status> is a ResultType constant, and <log> | 150 A (status, log) tuple, where <status> is a ResultType constant, and <log> |
| 153 is the logcat output captured during the test in case of error, or None | 151 is the logcat output captured during the test in case of error, or None |
| 154 in case of success. | 152 in case of success. |
| 155 """ | 153 """ |
| 156 return ResultType.FAIL, 'Unimplemented _RunTest() method!' | 154 return ResultType.FAIL, 'Unimplemented _RunTest() method!' |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 219 |
| 222 Note that there can be other lines beginning with BROWSER_LINKER_TEST: | 220 Note that there can be other lines beginning with BROWSER_LINKER_TEST: |
| 223 and RENDERER_LINKER_TEST:, but are not followed by a <status> code. | 221 and RENDERER_LINKER_TEST:, but are not followed by a <status> code. |
| 224 | 222 |
| 225 - The test case passes if the <status> for both the browser and renderer | 223 - The test case passes if the <status> for both the browser and renderer |
| 226 process are SUCCESS. Otherwise its a fail. | 224 process are SUCCESS. Otherwise its a fail. |
| 227 """ | 225 """ |
| 228 def _RunTest(self, device): | 226 def _RunTest(self, device): |
| 229 # Wait up to 30 seconds until the linker test status is in the logcat. | 227 # Wait up to 30 seconds until the linker test status is in the logcat. |
| 230 return _StartActivityAndWaitForLinkerTestStatus(device, timeout=30) | 228 return _StartActivityAndWaitForLinkerTestStatus(device, timeout=30) |
| OLD | NEW |