def _upload_perf_results(json_to_upload, name, configuration_name, build_properties, service_account_file, output_json_file): """Upload the contents of result JSON(s) to the perf dashboard.""" args = [ '--buildername', build_properties['buildername'], '--buildnumber', build_properties['buildnumber'], '--name', name, '--configuration-name', configuration_name, '--results-file', json_to_upload, '--results-url', RESULTS_URL, '--got-revision-cp', build_properties['got_revision_cp'], '--got-v8-revision', build_properties['got_v8_revision'], '--got-webrtc-revision', build_properties['got_webrtc_revision'], '--output-json-file', output_json_file, '--perf-dashboard-machine-group', _GetMachineGroup(build_properties) ] is_luci = False buildbucket = build_properties.get('buildbucket', {}) if isinstance(buildbucket, basestring): buildbucket = json.loads(buildbucket) if ('build' in buildbucket and buildbucket['build'].get('bucket') == 'luci.chrome.ci'): is_luci = True if is_luci and _is_gtest(json_to_upload) and ( name in GTEST_CONVERSION_WHITELIST): path_util.AddTracingToPath() from tracing.value import ( # pylint: disable=no-name-in-module gtest_json_converter) gtest_json_converter.ConvertGtestJsonFile(json_to_upload) _data_format_cache[json_to_upload] = DATA_FORMAT_HISTOGRAMS if 'build' in buildbucket: args += [ '--project', buildbucket['build'].get('project'), '--buildbucket', buildbucket['build'].get('bucket'), ] if service_account_file and not is_luci: args += ['--service-account-file', service_account_file] if build_properties.get('git_revision'): args.append('--git-revision') args.append(build_properties['git_revision']) if _is_histogram(json_to_upload): args.append('--send-as-histograms') return upload_results_to_perf_dashboard.main(args)
#!/usr/bin/env vpython3 # Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import sys import unittest sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, 'perf')) from core import path_util path_util.AddPyUtilsToPath() path_util.AddTracingToPath() import metadata_extractor from metadata_extractor import OSName from core.tbmv3 import trace_processor import mock class ExtractMetadataTestCase(unittest.TestCase): def setUp(self): self.trace_processor_path = 'trace_processor_shell' self.trace_file = 'trace_file.proto' def _RunQueryParams(self, query): """Returns tuple of RunQuery function parameters. Args: