| Index: build/android/pylib/linker/test_case.py
|
| diff --git a/build/android/pylib/linker/test_case.py b/build/android/pylib/linker/test_case.py
|
| index b4bddc727c749c0cd5979860f45518360397203f..febab92545ca8b8637da80833db5f97e15adebf5 100644
|
| --- a/build/android/pylib/linker/test_case.py
|
| +++ b/build/android/pylib/linker/test_case.py
|
| @@ -33,36 +33,34 @@
|
| build/android/test_runner.py linker
|
|
|
| """
|
| +# pylint: disable=R0201
|
|
|
| import logging
|
| import os
|
| import re
|
| -import StringIO
|
| -import subprocess
|
| -import tempfile
|
| import time
|
|
|
| from pylib import constants
|
| from pylib import android_commands
|
| -from pylib import flag_changer
|
| from pylib.base import base_test_result
|
|
|
| +
|
| ResultType = base_test_result.ResultType
|
|
|
| -_PACKAGE_NAME='org.chromium.content_linker_test_apk'
|
| -_ACTIVITY_NAME='.ContentLinkerTestActivity'
|
| -_COMMAND_LINE_FILE='/data/local/tmp/content-linker-test-command-line'
|
| +_PACKAGE_NAME = 'org.chromium.content_linker_test_apk'
|
| +_ACTIVITY_NAME = '.ContentLinkerTestActivity'
|
| +_COMMAND_LINE_FILE = '/data/local/tmp/content-linker-test-command-line'
|
|
|
| # Path to the Linker.java source file.
|
| -_LINKER_JAVA_SOURCE_PATH = \
|
| - 'content/public/android/java/src/org/chromium/content/app/Linker.java'
|
| +_LINKER_JAVA_SOURCE_PATH = (
|
| + 'content/public/android/java/src/org/chromium/content/app/Linker.java')
|
|
|
| # A regular expression used to extract the browser shared RELRO configuration
|
| # from the Java source file above.
|
| -_RE_LINKER_BROWSER_CONFIG = \
|
| - re.compile(r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' + \
|
| - 'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*',
|
| - re.MULTILINE | re.DOTALL)
|
| +_RE_LINKER_BROWSER_CONFIG = re.compile(
|
| + r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' +
|
| + 'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*',
|
| + re.MULTILINE | re.DOTALL)
|
|
|
| # Logcat filters used during each test. Only the 'chromium' one is really
|
| # needed, but the logs are added to the TestResult in case of error, and
|
| @@ -150,7 +148,7 @@ def _CheckLinkerTestStatus(logcat):
|
| return (False, None, None)
|
|
|
|
|
| -def _WaitForLinkerTestStatus(adb, timeout):
|
| +def _WaitForLinkerTestStatus(_adb, _timeout):
|
| """Wait up to |timeout| seconds until the full linker test status lines appear
|
| in the logcat being recorded with |adb|.
|
| Args:
|
| @@ -161,6 +159,7 @@ def _WaitForLinkerTestStatus(adb, timeout):
|
| ResultType.TIMEOUT in case of timeout, ResulType.PASS if both status lines
|
| report 'SUCCESS', or ResulType.FAIL otherwise.
|
| """
|
| + pass
|
|
|
|
|
| def _StartActivityAndWaitForLinkerTestStatus(adb, timeout):
|
| @@ -276,7 +275,6 @@ def _CheckLoadAddressRandomization(lib_map_list, process_type):
|
|
|
| # For each library, check the randomness of its load addresses.
|
| bad_libs = {}
|
| - success = True
|
| for lib_name, lib_address_list in lib_addr_map.iteritems():
|
| # If all addresses are different, skip to next item.
|
| lib_address_set = set(lib_address_list)
|
| @@ -304,17 +302,17 @@ class LinkerTestCaseBase(object):
|
| """
|
| self.is_low_memory = is_low_memory
|
| if is_low_memory:
|
| - test_suffix = 'ForLowMemoryDevice'
|
| + test_suffix = 'ForLowMemoryDevice'
|
| else:
|
| - test_suffix = 'ForRegularDevice'
|
| + test_suffix = 'ForRegularDevice'
|
| class_name = self.__class__.__name__
|
| self.qualified_name = '%s.%s' % (class_name, test_suffix)
|
| self.tagged_name = self.qualified_name
|
|
|
| - def _RunTest(self, adb):
|
| + def _RunTest(self, _adb):
|
| """Run the test, must be overriden.
|
| Args:
|
| - adb: An AndroidCommands instance to the device.
|
| + _adb: An AndroidCommands instance to the device.
|
| Returns:
|
| A (status, log) tuple, where <status> is a ResultType constant, and <log>
|
| is the logcat output captured during the test in case of error, or None
|
| @@ -499,7 +497,7 @@ class LinkerRandomizationTest(LinkerTestCaseBase):
|
| browser_lib_map_list = []
|
| renderer_lib_map_list = []
|
| logs_list = []
|
| - for loop in range(max_loops):
|
| + for _loop in range(max_loops):
|
| # Start the activity.
|
| result, logs = _StartActivityAndWaitForLinkerTestStatus(adb, timeout=30)
|
| if result == ResultType.TIMEOUT:
|
|
|