Added --isolate-file-path option to android test_runner.

Currently, .isolate file list is hard-coded in
build/android/pylib/gtest/setup.py so for downstream to
provide .isolate file, we need to modify the upstream setup.py
file. So add --isolate-file-path option so that downstream
can provide their own .isolate file if they want.

BUG=368034

Review URL: https://codereview.chromium.org/294033003

git-svn-id: http://src.chromium.org/svn/trunk/src/build@272137 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
kkimlabs@chromium.org 2014-05-22 08:18:50 +00:00
Родитель cb9a15cdfd
Коммит af73fa0dac
3 изменённых файлов: 24 добавлений и 7 удалений

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

@ -92,21 +92,30 @@ _ISOLATE_SCRIPT = os.path.join(
constants.DIR_SOURCE_ROOT, 'tools', 'swarming_client', 'isolate.py')
def _GenerateDepsDirUsingIsolate(suite_name):
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 os.path.isdir(constants.ISOLATE_DEPS_DIR):
shutil.rmtree(constants.ISOLATE_DEPS_DIR)
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
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)
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)
@ -309,7 +318,8 @@ def Setup(test_options, devices):
% test_options.suite_name)
logging.warning('Found target %s', test_package.suite_path)
_GenerateDepsDirUsingIsolate(test_options.suite_name)
_GenerateDepsDirUsingIsolate(test_options.suite_name,
test_options.isolate_file_path)
tests = _GetTests(test_options, test_package, devices)

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

@ -14,4 +14,5 @@ GTestOptions = collections.namedtuple('GTestOptions', [
'run_disabled',
'test_arguments',
'timeout',
'isolate_file_path',
'suite_name'])

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

@ -117,6 +117,11 @@ def AddGTestOptions(option_parser):
help='Timeout to wait for each test',
type='int',
default=60)
option_parser.add_option('--isolate_file_path',
'--isolate-file-path',
dest='isolate_file_path',
help='.isolate file path to override the default '
'path')
# TODO(gkanwar): Move these to Common Options once we have the plumbing
# in our other test types to handle these commands
AddCommonOptions(option_parser)
@ -505,6 +510,7 @@ def _RunGTests(options, devices):
options.run_disabled,
options.test_arguments,
options.timeout,
options.isolate_file_path,
suite_name)
runner_factory, tests = gtest_setup.Setup(gtest_options, devices)