Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3079)

Unified Diff: build/android/pylib/gtest/setup.py

Issue 689293002: Add option to push files to device using isolate for instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved shared functions into new base_setup module. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/gtest/setup.py
diff --git a/build/android/pylib/gtest/setup.py b/build/android/pylib/gtest/setup.py
index d73d862b33db9aed3f9c6fb7ea02becdadc25eb4..3ef793bbaee7caf488a5eae68551b39dd0911261 100644
--- a/build/android/pylib/gtest/setup.py
+++ b/build/android/pylib/gtest/setup.py
@@ -10,15 +10,14 @@ import os
import sys
from pylib import constants
-from pylib import valgrind_tools
+from pylib.base import base_setup
from pylib.base import base_test_result
from pylib.base import test_dispatcher
from pylib.device import device_utils
from pylib.gtest import test_package_apk
from pylib.gtest import test_package_exe
from pylib.gtest import test_runner
-from pylib.utils import isolator
sys.path.insert(0,
os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
@@ -26,7 +25,7 @@ sys.path.insert(0,
import unittest_util # pylint: disable=F0401
-_ISOLATE_FILE_PATHS = {
+ISOLATE_FILE_PATHS = {
'base_unittests': 'base/base_unittests.isolate',
'blink_heap_unittests':
'third_party/WebKit/Source/platform/heap/BlinkHeapUnitTests.isolate',
@@ -49,7 +48,7 @@ _ISOLATE_FILE_PATHS = {
# Used for filtering large data deps at a finer grain than what's allowed in
# isolate files since pushing deps to devices is expensive.
# Wildcards are allowed.
-_DEPS_EXCLUSION_LIST = [
+DEPS_EXCLUSION_LIST = [
'chrome/test/data/extensions/api_test',
'chrome/test/data/extensions/secure_shell',
'chrome/test/data/firefox*',
@@ -69,43 +68,6 @@ _DEPS_EXCLUSION_LIST = [
]
-def _GenerateDepsDirUsingIsolate(suite_name, isolate_file_path=None):
- """Generate the dependency dir for the test suite using isolate.
-
- Args:
- suite_name: Name of the test suite (e.g. base_unittests).
- isolate_file_path: .isolate file path to use. If there is a default .isolate
- file path for the suite_name, this will override it.
- """
- if isolate_file_path:
- if os.path.isabs(isolate_file_path):
- isolate_abs_path = isolate_file_path
- else:
- isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT,
- isolate_file_path)
- else:
- isolate_rel_path = _ISOLATE_FILE_PATHS.get(suite_name)
- if not isolate_rel_path:
- logging.info('Did not find an isolate file for the test suite.')
- return
- isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path)
-
- isolated_abs_path = os.path.join(
- constants.GetOutDirectory(), '%s.isolated' % suite_name)
- assert os.path.exists(isolate_abs_path), 'Cannot find %s' % isolate_abs_path
-
- i = isolator.Isolator(constants.ISOLATE_DEPS_DIR)
- i.Clear()
- i.Remap(isolate_abs_path, isolated_abs_path)
- # We're relying on the fact that timestamps are preserved
- # by the remap command (hardlinked). Otherwise, all the data
- # will be pushed to the device once we move to using time diff
- # instead of md5sum. Perform a sanity check here.
- i.VerifyHardlinks()
- i.PurgeExcluded(_DEPS_EXCLUSION_LIST)
- i.MoveOutputDeps()
-
-
def _GetDisabledTestsFilterFromFile(suite_name):
"""Returns a gtest filter based on the *_disabled file.
@@ -214,19 +176,6 @@ def _FilterDisabledTests(tests, suite_name, has_gtest_filter):
return tests
-def PushDataDeps(device, test_options, test_package):
- valgrind_tools.PushFilesForTool(test_options.tool, device)
- if os.path.exists(constants.ISOLATE_DEPS_DIR):
- device_dir = (
- constants.TEST_EXECUTABLE_DIR
- if test_package.suite_name == 'breakpad_unittests'
- else device.GetExternalStoragePath())
- device.PushChangedFiles([
- (os.path.join(constants.ISOLATE_DEPS_DIR, p),
- '%s/%s' % (device_dir, p))
- for p in os.listdir(constants.ISOLATE_DEPS_DIR)])
-
-
def Setup(test_options, devices):
"""Create the test runner factory and tests.
@@ -251,11 +200,17 @@ def Setup(test_options, devices):
test_package = exe_test_package
logging.warning('Found target %s', test_package.suite_path)
- _GenerateDepsDirUsingIsolate(test_options.suite_name,
- test_options.isolate_file_path)
-
+ base_setup.GenerateDepsDirUsingIsolate(test_options.suite_name,
+ test_options.isolate_file_path,
+ ISOLATE_FILE_PATHS,
+ DEPS_EXCLUSION_LIST)
+ def DeviceDir(device):
+ return (constants.TEST_EXECUTABLE_DIR
+ if test_package.suite_name == 'breakpad_unittests'
+ else device.GetExternalStoragePath())
device_utils.DeviceUtils.parallel(devices).pMap(
- PushDataDeps, test_options, test_package)
+ (lambda d, opts: base_setup.PushDataDeps(d, DeviceDir(d), opts)),
jbudorick 2014/11/03 15:52:32 Instead of defining DeviceDir as a separate functi
mikecase (-- gone --) 2014/11/06 00:12:21 Done.
+ test_options)
tests = _GetTests(test_options, test_package, devices)

Powered by Google App Engine
This is Rietveld 408576698