[Android] Add --skip-deps-push to test scripts.

This bypasses syncing any deps to the device to speed up
the developer workflow.
    
BUG=243447
NOTRY=True

Review URL: https://chromiumcodereview.appspot.com/16627004

git-svn-id: http://src.chromium.org/svn/trunk/src/build@205317 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
frankf@chromium.org 2013-06-10 21:50:48 +00:00
Родитель 6f58026f56
Коммит 81d0e1a89d
6 изменённых файлов: 21 добавлений и 5 удалений

Просмотреть файл

@ -34,12 +34,13 @@ class BaseTestRunner(object):
the Run() method will set up tests, run them and tear them down.
"""
def __init__(self, device, tool, build_type):
def __init__(self, device, tool, build_type, push_deps):
"""
Args:
device: Tests will run on the device of this ID.
shard_index: Index number of the shard on which the test suite will run.
build_type: 'Release' or 'Debug'.
push_deps: If True, push all dependencies to the device.
"""
self.device = device
self.adb = android_commands.AndroidCommands(device=device)
@ -59,6 +60,7 @@ class BaseTestRunner(object):
self.test_server_spawner_port = 0
self.test_server_port = 0
self.build_type = build_type
self._push_deps = push_deps
def _PushTestServerPortInfoToDevice(self):
"""Pushes the latest port information to device."""
@ -86,7 +88,11 @@ class BaseTestRunner(object):
def SetUp(self):
"""Run once before all tests are run."""
Forwarder.KillDevice(self.adb, self.tool)
self.PushDependencies()
if self._push_deps:
logging.info('Pushing deps to device.')
self.PushDependencies()
else:
logging.warning('Skipping pushing deps to device.')
def TearDown(self):
"""Run once after all tests are run."""

Просмотреть файл

@ -53,6 +53,7 @@ def Dispatch(options):
options.tool,
options.build_type,
options.webkit,
options.push_deps,
constants.BROWSERTEST_TEST_PACKAGE_NAME,
constants.BROWSERTEST_TEST_ACTIVITY_NAME,
constants.BROWSERTEST_COMMAND_LINE_FILE)

Просмотреть файл

@ -149,6 +149,7 @@ def _RunATestSuite(options, suite_name):
options.tool,
options.build_type,
options.webkit,
options.push_deps,
constants.GTEST_TEST_PACKAGE_NAME,
constants.GTEST_TEST_ACTIVITY_NAME,
constants.GTEST_COMMAND_LINE_FILE)

Просмотреть файл

@ -246,6 +246,7 @@ class TestRunner(base_test_runner.BaseTestRunner):
tool_name: Name of the Valgrind tool.
build_type: 'Release' or 'Debug'.
in_webkit_checkout: Whether the suite is being run from a WebKit checkout.
push_deps: If True, push all dependencies to the device.
test_apk_package_name: Apk package name for tests running in APKs.
test_activity_name: Test activity to invoke for APK tests.
command_line_file: Filename to use to pass arguments to tests.
@ -253,9 +254,9 @@ class TestRunner(base_test_runner.BaseTestRunner):
def __init__(self, device, test_suite, test_arguments, timeout,
cleanup_test_files, tool_name, build_type,
in_webkit_checkout, test_apk_package_name=None,
in_webkit_checkout, push_deps, test_apk_package_name=None,
test_activity_name=None, command_line_file=None):
super(TestRunner, self).__init__(device, tool_name, build_type)
super(TestRunner, self).__init__(device, tool_name, build_type, push_deps)
self._running_on_emulator = self.device.startswith('emulator')
self._test_arguments = test_arguments
self.in_webkit_checkout = in_webkit_checkout

Просмотреть файл

@ -66,13 +66,15 @@ class TestRunner(base_test_runner.BaseTestRunner):
- tool: Name of the Valgrind tool.
- wait_for_debugger: blocks until the debugger is connected.
- disable_assertions: Whether to disable java assertions on the device.
- push_deps: If True, push all dependencies to the device.
device: Attached android device.
shard_index: Shard index.
test_pkg: A TestPackage object.
ports_to_forward: A list of port numbers for which to set up forwarders.
Can be optionally requested by a test case.
"""
super(TestRunner, self).__init__(device, options.tool, options.build_type)
super(TestRunner, self).__init__(device, options.tool, options.build_type,
options.push_deps)
self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index
self.build_type = options.build_type

Просмотреть файл

@ -89,6 +89,11 @@ def AddTestRunnerOptions(option_parser, default_timeout=60):
dest='flakiness_dashboard_server',
help=('Address of the server that is hosting the '
'Chrome for Android flakiness dashboard.'))
option_parser.add_option('--skip-deps-push', dest='push_deps',
action='store_false', default=True,
help='Do not push dependencies to the device. '
'Use this at own risk for speeding up test '
'execution on local machine.')
AddBuildTypeOption(option_parser)