summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorjbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 21:14:39 +0000
committerjbudorick@chromium.org <jbudorick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 21:14:39 +0000
commit95c04d077f6083ef1b4f9ef681588e7e313a1868 (patch)
tree6305fcefadf90bb14896329d0803f11e78197d07 /build
parent326b8fb321e4fa57c24c53ab7042b54d40eb7529 (diff)
downloadchromium_src-95c04d077f6083ef1b4f9ef681588e7e313a1868.zip
chromium_src-95c04d077f6083ef1b4f9ef681588e7e313a1868.tar.gz
chromium_src-95c04d077f6083ef1b4f9ef681588e7e313a1868.tar.bz2
[Android] Lint pylib/linker.
BUG=168518 Review URL: https://codereview.chromium.org/165393008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252645 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/android/pylib/linker/setup.py12
-rw-r--r--build/android/pylib/linker/test_case.py48
-rw-r--r--build/android/pylib/linker/test_runner.py4
3 files changed, 22 insertions, 42 deletions
diff --git a/build/android/pylib/linker/setup.py b/build/android/pylib/linker/setup.py
index a13ea4d..a863a0d 100644
--- a/build/android/pylib/linker/setup.py
+++ b/build/android/pylib/linker/setup.py
@@ -6,19 +6,17 @@
import os
import sys
-import types
-
-import test_case
-import test_runner
from pylib import constants
+from pylib.linker import test_case
+from pylib.linker import test_runner
sys.path.insert(0,
os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
'common'))
-import unittest_util
+import unittest_util # pylint: disable=F0401
-def Setup(options, devices):
+def Setup(options, _devices):
"""Creates a list of test cases and a runner factory.
Returns:
@@ -39,7 +37,7 @@ def Setup(options, devices):
all_tests = [t for t in all_tests \
if t.qualified_name in filtered_test_names]
- def TestRunnerFactory(device, shard_index):
+ def TestRunnerFactory(device, _shard_index):
return test_runner.LinkerTestRunner(
device, options.tool, options.push_deps,
options.cleanup_test_files)
diff --git a/build/android/pylib/linker/test_case.py b/build/android/pylib/linker/test_case.py
index 7a2a010..6789287 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.chromium_linker_test_apk'
-_ACTIVITY_NAME='.ChromiumLinkerTestActivity'
-_COMMAND_LINE_FILE='/data/local/tmp/chromium-linker-test-command-line'
+_PACKAGE_NAME = 'org.chromium.chromium_linker_test_apk'
+_ACTIVITY_NAME = '.ChromiumLinkerTestActivity'
+_COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line'
# Path to the Linker.java source file.
-_LINKER_JAVA_SOURCE_PATH = \
- 'base/android/java/src/org/chromium/base/library_loader/Linker.java'
+_LINKER_JAVA_SOURCE_PATH = (
+ 'base/android/java/src/org/chromium/base/library_loader/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,19 +148,6 @@ def _CheckLinkerTestStatus(logcat):
return (False, None, None)
-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:
- adb: An AndroidCommands instance. This assumes adb.StartRecordingLogcat()
- was called previously.
- timeout: Timeout in seconds.
- Returns:
- ResultType.TIMEOUT in case of timeout, ResulType.PASS if both status lines
- report 'SUCCESS', or ResulType.FAIL otherwise.
- """
-
-
def _StartActivityAndWaitForLinkerTestStatus(adb, timeout):
"""Force-start an activity and wait up to |timeout| seconds until the full
linker test status lines appear in the logcat, recorded through |adb|.
@@ -276,7 +261,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 +288,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 +483,7 @@ class LinkerRandomizationTest(LinkerTestCaseBase):
browser_lib_map_list = []
renderer_lib_map_list = []
logs_list = []
- for loop in range(max_loops):
+ for _ in range(max_loops):
# Start the activity.
result, logs = _StartActivityAndWaitForLinkerTestStatus(adb, timeout=30)
if result == ResultType.TIMEOUT:
diff --git a/build/android/pylib/linker/test_runner.py b/build/android/pylib/linker/test_runner.py
index f64cb25..c9b7dd9 100644
--- a/build/android/pylib/linker/test_runner.py
+++ b/build/android/pylib/linker/test_runner.py
@@ -7,16 +7,14 @@
import logging
import os.path
import sys
-import time
import traceback
from pylib import constants
from pylib.base import base_test_result
from pylib.base import base_test_runner
+from pylib.linker import test_case
from pylib.utils import apk_helper
-import test_case
-
# Name of the Android package to install for this to work.
_PACKAGE_NAME = 'ChromiumLinkerTest'