Commit 4f777cad authored by yojan@google.com's avatar yojan@google.com

Test Runner changes for Integration tests.

Test Runner changes to allow integration tests as well as the ability
to point the device's google_base_url (or any android shell flag) to
a specified value in stored in a .flags file.

BUG=None

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

Cr-Commit-Position: refs/heads/master@{#288202}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288202 0039d316-1c4b-4281-b951-d872f2087c98
parent ddaca8ba
......@@ -22,4 +22,5 @@ InstrumentationOptions = collections.namedtuple('InstrumentationOptions', [
'test_apk_path',
'test_apk_jar_path',
'test_runner',
'test_support_apk_path'])
'test_support_apk_path',
'device_flags'])
......@@ -116,7 +116,8 @@ class TestRunner(base_test_runner.BaseTestRunner):
dst_src = dest_host_pair.split(':', 1)
dst_layer = dst_src[0]
host_src = dst_src[1]
host_test_files_path = '%s/%s' % (constants.DIR_SOURCE_ROOT, host_src)
host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT,
host_src)
if os.path.exists(host_test_files_path):
self.device.PushChangedFiles(
host_test_files_path,
......@@ -163,6 +164,9 @@ class TestRunner(base_test_runner.BaseTestRunner):
os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port)
if self.flags:
self.flags.AddFlags(['--disable-fre', '--enable-test-intents'])
if self.options.device_flags:
with open(self.options.device_flags) as device_flags_file:
self.flags.AddFlags(list(device_flags_file))
def TearDown(self):
"""Cleans up the test harness and saves outstanding data from test run."""
......@@ -319,6 +323,8 @@ class TestRunner(base_test_runner.BaseTestRunner):
annotations = self.test_pkg.GetTestAnnotations(test)
if 'Manual' in annotations:
return 10 * 60 * 60
if 'IntegrationTest' in annotations:
return 30 * 60
if 'External' in annotations:
return 10 * 60
if 'EnormousTest' in annotations:
......
......@@ -40,7 +40,8 @@ class TestRunner(instr_test_runner.TestRunner):
test_apk_path=None,
test_apk_jar_path=None,
test_runner=None,
test_support_apk_path=None)
test_support_apk_path=None,
device_flags=None)
super(TestRunner, self).__init__(instrumentation_options, device,
shard_index, test_pkg)
......
......@@ -201,7 +201,7 @@ def ProcessJavaTestOptions(options):
options.annotations = []
else:
options.annotations = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest',
'EnormousTest']
'EnormousTest', 'IntegrationTest']
if options.exclude_annotation_str:
options.exclude_annotations = options.exclude_annotation_str.split(',')
......@@ -237,6 +237,9 @@ def AddInstrumentationTestOptions(option_parser):
option_parser.add_option('--coverage-dir',
help=('Directory in which to place all generated '
'EMMA coverage files.'))
option_parser.add_option('--device-flags', dest='device_flags', default='',
help='The relative filepath to a file containing '
'command-line flags to set on the device')
def ProcessInstrumentationOptions(options, error_func):
......@@ -299,7 +302,8 @@ def ProcessInstrumentationOptions(options, error_func):
options.test_apk_path,
options.test_apk_jar_path,
options.test_runner,
options.test_support_apk_path
options.test_support_apk_path,
options.device_flags
)
......@@ -597,6 +601,10 @@ def _RunInstrumentationTests(options, error_func, devices):
if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
exit_code = test_exit_code
if options.device_flags:
options.device_flags = os.path.join(constants.DIR_SOURCE_ROOT,
options.device_flags)
report_results.LogFull(
results=results,
test_type='Instrumentation',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment