void-packages/srcpkgs/electron19/files/chromium-upstream-patches/0047-migrate-metrics_python...

107 lines
4.6 KiB
Diff

From 394e7eb51ff0cdd3c240e8d10d9fb08adfbe60c9 Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta@chromium.org>
Date: Tue, 28 Jun 2022 17:22:43 +0000
Subject: [PATCH 47/59] migrate metrics_python_tests to python3 for M102
This cherry pick includes additional fix for L235 in common.py.
(cherry picked from commit a1b9cfb94303fcbaae90a5def1991d3724b0bdb4)
Bug: 1287214
Change-Id: I68b680617d2e7aa3ccc23375e2eaaa113779d7c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689318
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1011049}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3711081
Cr-Commit-Position: refs/branch-heads/5005@{#1206}
Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738}
---
testing/scripts/common.py | 6 +++---
testing/scripts/metrics_python_tests.py | 4 ++--
tools/variations/fieldtrial_to_struct.py | 2 +-
tools/variations/fieldtrial_util.py | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/testing/scripts/common.py b/testing/scripts/common.py
index 4965f8f58ba0..995fb9688e83 100644
--- a/testing/scripts/common.py
+++ b/testing/scripts/common.py
@@ -208,7 +208,7 @@ def parse_common_test_results(json_results, test_separator='/'):
def convert_trie_to_flat_paths(trie, prefix=None):
# Also see blinkpy.web_tests.layout_package.json_results_generator
result = {}
- for name, data in trie.iteritems():
+ for name, data in trie.items():
if prefix:
name = prefix + test_separator + name
if len(data) and not 'actual' in data and not 'expected' in data:
@@ -232,7 +232,7 @@ def parse_common_test_results(json_results, test_separator='/'):
passing_statuses = ('PASS', 'SLOW', 'NEEDSREBASELINE')
for test, result in convert_trie_to_flat_paths(
- json_results['tests']).iteritems():
+ json_results['tests']).items():
key = 'unexpected_' if result.get('is_unexpected') else ''
data = result['actual']
actual_results = data.split()
@@ -291,7 +291,7 @@ def get_gtest_summary_passes(output):
mapping = {}
for cur_iteration_data in output.get('per_iteration_data', []):
- for test_fullname, results in cur_iteration_data.iteritems():
+ for test_fullname, results in cur_iteration_data.items():
# Results is a list with one entry per test try. Last one is the final
# result.
last_result = results[-1]
diff --git a/testing/scripts/metrics_python_tests.py b/testing/scripts/metrics_python_tests.py
index 70770f41b56e..41db12a37b12 100755
--- a/testing/scripts/metrics_python_tests.py
+++ b/testing/scripts/metrics_python_tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/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.
@@ -15,7 +15,7 @@ import common
def main_run(args):
with common.temporary_file() as tempfile_path:
- rc = common.run_command(['vpython',
+ rc = common.run_command(['vpython3',
os.path.join(common.SRC_DIR, 'testing', 'test_env.py'),
os.path.join(common.SRC_DIR, 'tools', 'metrics',
'metrics_python_tests.py'),
diff --git a/tools/variations/fieldtrial_to_struct.py b/tools/variations/fieldtrial_to_struct.py
index 9ecf38974795..3c90ff9fea5a 100755
--- a/tools/variations/fieldtrial_to_struct.py
+++ b/tools/variations/fieldtrial_to_struct.py
@@ -76,7 +76,7 @@ def _LoadFieldTrialConfig(filename, platforms, invert):
def _ConvertOverrideUIStrings(override_ui_strings):
"""Converts override_ui_strings to formatted dicts."""
overrides = []
- for ui_string, override in override_ui_strings.iteritems():
+ for ui_string, override in override_ui_strings.items():
overrides.append({
'name_hash': generate_ui_string_overrider.HashName(ui_string),
'value': override
diff --git a/tools/variations/fieldtrial_util.py b/tools/variations/fieldtrial_util.py
index ac0b9f54292f..284bcb5899c8 100644
--- a/tools/variations/fieldtrial_util.py
+++ b/tools/variations/fieldtrial_util.py
@@ -31,7 +31,7 @@ def _FindDuplicates(entries):
duplicates.add(entry)
else:
seen.add(entry)
- return duplicates
+ return sorted(duplicates)
def _CheckForDuplicateFeatures(enable_features, disable_features):
enable_features = [f.split('<')[0] for f in enable_features]
--
2.37.0