Commit e627ef8b authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

Add support to extract ChartJSON test results from android devices.

Add a '--chartjson_result_file' flag to extract ChartJSON test results from
android devices.

R=jbudorick@chromium.org

Bug: webrtc:8566
Change-Id: I050d1f714471a5525e91d36d1e792815cb4578ae
Reviewed-on: https://chromium-review.googlesource.com/819831
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523758}
parent 6ecbe1f5
...@@ -282,16 +282,17 @@ class GtestTestInstance(test_instance.TestInstance): ...@@ -282,16 +282,17 @@ class GtestTestInstance(test_instance.TestInstance):
# TODO(jbudorick): Support multiple test suites. # TODO(jbudorick): Support multiple test suites.
if len(args.suite_name) > 1: if len(args.suite_name) > 1:
raise ValueError('Platform mode currently supports only 1 gtest suite') raise ValueError('Platform mode currently supports only 1 gtest suite')
self._chartjson_result_file = args.chartjson_result_file
self._exe_dist_dir = None self._exe_dist_dir = None
self._external_shard_index = args.test_launcher_shard_index self._external_shard_index = args.test_launcher_shard_index
self._extract_test_list_from_filter = args.extract_test_list_from_filter self._extract_test_list_from_filter = args.extract_test_list_from_filter
self._filter_tests_lock = threading.Lock() self._filter_tests_lock = threading.Lock()
self._gs_test_artifacts_bucket = args.gs_test_artifacts_bucket
self._shard_timeout = args.shard_timeout self._shard_timeout = args.shard_timeout
self._store_tombstones = args.store_tombstones self._store_tombstones = args.store_tombstones
self._total_external_shards = args.test_launcher_total_shards
self._suite = args.suite_name[0] self._suite = args.suite_name[0]
self._symbolizer = stack_symbolizer.Symbolizer(None, False) self._symbolizer = stack_symbolizer.Symbolizer(None, False)
self._gs_test_artifacts_bucket = args.gs_test_artifacts_bucket self._total_external_shards = args.test_launcher_total_shards
self._wait_for_java_debugger = args.wait_for_java_debugger self._wait_for_java_debugger = args.wait_for_java_debugger
# GYP: # GYP:
...@@ -429,6 +430,10 @@ class GtestTestInstance(test_instance.TestInstance): ...@@ -429,6 +430,10 @@ class GtestTestInstance(test_instance.TestInstance):
def gtest_filter(self): def gtest_filter(self):
return self._gtest_filter return self._gtest_filter
@property
def chartjson_result_file(self):
return self._chartjson_result_file
@property @property
def package(self): def package(self):
return self._apk_helper and self._apk_helper.GetPackageName() return self._apk_helper and self._apk_helper.GetPackageName()
......
...@@ -469,6 +469,10 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): ...@@ -469,6 +469,10 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
device_temp_file.NamedDeviceTemporaryDirectory( device_temp_file.NamedDeviceTemporaryDirectory(
adb=device.adb, dir='/sdcard/'), adb=device.adb, dir='/sdcard/'),
self._test_instance.gs_test_artifacts_bucket) as test_artifacts_dir: self._test_instance.gs_test_artifacts_bucket) as test_artifacts_dir:
with contextlib_ext.Optional(
device_temp_file.DeviceTempFile(
adb=device.adb, dir=self._delegate.ResultsDirectory(device)),
self._test_instance.chartjson_result_file) as chartjson_result_file:
flags = list(self._test_instance.flags) flags = list(self._test_instance.flags)
if self._test_instance.enable_xml_result_parsing: if self._test_instance.enable_xml_result_parsing:
...@@ -477,6 +481,10 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): ...@@ -477,6 +481,10 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
if self._test_instance.gs_test_artifacts_bucket: if self._test_instance.gs_test_artifacts_bucket:
flags.append('--test_artifacts_dir=%s' % test_artifacts_dir.name) flags.append('--test_artifacts_dir=%s' % test_artifacts_dir.name)
if self._test_instance.chartjson_result_file:
flags.append('--chartjson_result_file=%s'
% chartjson_result_file.name)
logging.info('flags:') logging.info('flags:')
for f in flags: for f in flags:
logging.info(' %s', f) logging.info(' %s', f)
...@@ -515,6 +523,15 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): ...@@ -515,6 +523,15 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
str(e)) str(e))
gtest_xml = None gtest_xml = None
if self._test_instance.chartjson_result_file:
try:
device.PullFile(chartjson_result_file.name,
self._test_instance.chartjson_result_file)
except device_errors.CommandFailedError as e:
logging.warning(
'Failed to pull chartjson results %s: %s',
chartjson_result_file.name, str(e))
test_artifacts_url = self._UploadTestArtifacts(device, test_artifacts_url = self._UploadTestArtifacts(device,
test_artifacts_dir) test_artifacts_dir)
......
...@@ -299,6 +299,9 @@ def AddGTestOptions(parser): ...@@ -299,6 +299,9 @@ def AddGTestOptions(parser):
'--app-data-file-dir', '--app-data-file-dir',
help='Host directory to which app data files will be' help='Host directory to which app data files will be'
' saved. Used with --app-data-file.') ' saved. Used with --app-data-file.')
parser.add_argument(
'--chartjson-result-file',
help='If present, store chartjson results on this path.')
parser.add_argument( parser.add_argument(
'--delete-stale-data', '--delete-stale-data',
dest='delete_stale_data', action='store_true', dest='delete_stale_data', action='store_true',
...@@ -319,6 +322,10 @@ def AddGTestOptions(parser): ...@@ -319,6 +322,10 @@ def AddGTestOptions(parser):
'device for the list of all tests. Speeds up local ' 'device for the list of all tests. Speeds up local '
'development, but is not safe to use on bots (' 'development, but is not safe to use on bots ('
'http://crbug.com/549214') 'http://crbug.com/549214')
parser.add_argument(
'--gs-test-artifacts-bucket',
help=('If present, test artifacts will be uploaded to this Google '
'Storage bucket.'))
parser.add_argument( parser.add_argument(
'--gtest_also_run_disabled_tests', '--gtest-also-run-disabled-tests', '--gtest_also_run_disabled_tests', '--gtest-also-run-disabled-tests',
dest='run_disabled', action='store_true', dest='run_disabled', action='store_true',
...@@ -360,11 +367,6 @@ def AddGTestOptions(parser): ...@@ -360,11 +367,6 @@ def AddGTestOptions(parser):
help='Path to file that contains googletest-style filter strings. ' help='Path to file that contains googletest-style filter strings. '
'See also //testing/buildbot/filters/README.md.') 'See also //testing/buildbot/filters/README.md.')
parser.add_argument(
'--gs-test-artifacts-bucket',
help=('If present, test artifacts will be uploaded to this Google '
'Storage bucket.'))
def AddInstrumentationTestOptions(parser): def AddInstrumentationTestOptions(parser):
"""Adds Instrumentation test options to |parser|.""" """Adds Instrumentation test options to |parser|."""
......
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