diff options
author | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 01:04:57 +0000 |
---|---|---|
committer | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 01:04:57 +0000 |
commit | 095e4dc9888210cb153f712830e7f07e8c9c9a51 (patch) | |
tree | 8524937dae2c4ce3986362f1cb28d455ec356c42 /build/android | |
parent | f0ad54cdb589d9054b86f49872d338b682ba590d (diff) | |
download | chromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.zip chromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.tar.gz chromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.tar.bz2 |
android: Make org.chromium.base.SysUtils.isLowEndDevice() work without native code.
This patch modifies the implementation if SysUtils.isLowEndDevice() to
not rely on any native code, which is required to run it before the native
libraries are actually loaded (e.g. when running certain tests).
+ Simplify the content linker that doesn't need a specific native method
anymore to replicate the yet-unloaded native SysUtils::IsLowEndDevice().
BUG=309926
R=dtrainor@chromium.org,tedchoc@chromium.org,frankf@chromium.org,bulach@chromium.org
TEST=build/android/test_runner.py linker
Review URL: https://codereview.chromium.org/59033008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android')
-rw-r--r-- | build/android/pylib/linker/setup.py | 3 | ||||
-rw-r--r-- | build/android/pylib/linker/test_case.py | 64 |
2 files changed, 1 insertions, 66 deletions
diff --git a/build/android/pylib/linker/setup.py b/build/android/pylib/linker/setup.py index 4024fa7..a13ea4d 100644 --- a/build/android/pylib/linker/setup.py +++ b/build/android/pylib/linker/setup.py @@ -27,8 +27,7 @@ def Setup(options, devices): test_cases = [ test_case.LinkerLibraryAddressTest, test_case.LinkerSharedRelroTest, - test_case.LinkerRandomizationTest, - test_case.LinkerLowMemoryThresholdTest ] + test_case.LinkerRandomizationTest ] low_memory_modes = [False, True] all_tests = [t(is_low_memory=m) for t in test_cases for m in low_memory_modes] diff --git a/build/android/pylib/linker/test_case.py b/build/android/pylib/linker/test_case.py index 3f8ea73..b4bddc7 100644 --- a/build/android/pylib/linker/test_case.py +++ b/build/android/pylib/linker/test_case.py @@ -554,67 +554,3 @@ class LinkerRandomizationTest(LinkerTestCaseBase): return ResultType.FAIL, renderer_logs return ResultType.PASS, logs - - -class LinkerLowMemoryThresholdTest(LinkerTestCaseBase): - """This test checks that the definitions for the low-memory device physical - RAM threshold are identical in the base/ and linker sources. Because these - two components should absolutely not depend on each other, it's difficult - to perform this check correctly at runtime inside the linker test binary - without introducing hairy dependency issues in the build, or complicated - plumbing at runtime. - - To work-around this, this test looks directly into the sources for a - definition of the same constant that should look like: - - #define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB <number> - - And will check that the values for <number> are identical in all of - them.""" - - # A regular expression used to find the definition of the threshold in all - # sources: - _RE_THRESHOLD_DEFINITION = re.compile( - r'^\s*#\s*define\s+ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB\s+(\d+)\s*$', - re.MULTILINE) - - # The list of source files, relative to DIR_SOURCE_ROOT, which must contain - # a line that matches the re above. - _SOURCES_LIST = [ - 'base/android/sys_utils.cc', - 'content/common/android/linker/linker_jni.cc' ] - - def _RunTest(self, adb): - failure = False - values = [] - # First, collect all the values in all input sources. - re = LinkerLowMemoryThresholdTest._RE_THRESHOLD_DEFINITION - for source in LinkerLowMemoryThresholdTest._SOURCES_LIST: - source_path = os.path.join(constants.DIR_SOURCE_ROOT, source); - if not os.path.exists(source_path): - logging.error('Missing source file: ' + source_path) - failure = True - continue - with open(source_path) as f: - source_text = f.read() - # For some reason, re.match() never works here. - source_values = re.findall(source_text) - if not source_values: - logging.error('Missing low-memory threshold definition in ' + \ - source_path) - logging.error('Source:\n%s\n' % source_text) - failure = True - continue - values += source_values - - # Second, check that they are all the same. - if not failure: - for value in values[1:]: - if value != values[0]: - logging.error('Value mismatch: ' + repr(values)) - failure = True - - if failure: - return ResultType.FAIL, 'Incorrect low-end memory threshold definitions!' - - return ResultType.PASS, '' |