From 4c9955b1c31b725372e61590c595522cb4e63451 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Wed, 16 Jun 2021 21:13:49 +0000 Subject: [PATCH] Move metrics_python_tests from isolated_script to script. This changes how we invoke metrics_python_tests, so that it is invoked as a 'script' test and run directly on the builder (machine doing the compile) rather than as an 'isolated_script' test under swarming. This fixes an issue where we'd try to run `dirmd`, which requires a checkout. Bug: 1201822 Change-Id: I17c4f6c2341c70b688efc48aada88a5a51ef4a16 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2921324 Auto-Submit: Dirk Pranke Commit-Queue: Dirk Pranke Reviewed-by: Alexei Svitkine Reviewed-by: Nodir Turakulov Reviewed-by: Stephen Martinis Cr-Commit-Position: refs/heads/master@{#893147} --- testing/buildbot/chromium.clang.json | 44 ------- testing/buildbot/chromium.fyi.json | 122 +++++------------- testing/buildbot/chromium.linux.json | 127 ++++--------------- testing/buildbot/chromium.mac.json | 161 +----------------------- testing/buildbot/chromium.win.json | 103 ++------------- testing/buildbot/gn_isolate_map.pyl | 8 -- testing/buildbot/test_suites.pyl | 14 ++- testing/scripts/metrics_python_tests.py | 49 ++++++++ tools/metrics/metrics_python_tests.py | 49 +++++--- 9 files changed, 156 insertions(+), 521 deletions(-) create mode 100755 testing/scripts/metrics_python_tests.py diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 8e6131c1c1865a..abee6a921f14b6 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json @@ -23466,28 +23466,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.15" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -27080,28 +27058,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.15" - } - ], - "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index a8ceef46b39efa..507beeb8f4e810 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json @@ -56,6 +56,12 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "isolate_profile_data": true, + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "isolate_profile_data": true, "name": "webkit_lint", @@ -162,6 +168,11 @@ "script": "check_static_initializers.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -1758,6 +1769,11 @@ "script": "check_network_annotations.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -1775,6 +1791,11 @@ "script": "check_network_annotations.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -75673,6 +75694,11 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -77455,27 +77481,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -79573,28 +79578,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "isolate_profile_data": true, @@ -79845,6 +79828,12 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "isolate_profile_data": true, + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "isolate_profile_data": true, "name": "webkit_lint", @@ -84453,29 +84442,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "arm64", - "os": "Mac-11", - "pool": "chromium.tests.mac-arm64" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -88006,30 +87972,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "gpu": "8086:0a2e", - "os": "Mac-11.3" - } - ], - "expiration": 21600, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index eb4107cb627ad5..a83a4113d3b7e9 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json @@ -4717,6 +4717,12 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "isolate_profile_data": true, + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "isolate_profile_data": true, "name": "webkit_lint", @@ -11695,28 +11701,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "isolate_profile_data": true, @@ -13652,27 +13636,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "telemetry_gpu_unittests", "merge": { @@ -15737,27 +15700,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -15996,6 +15938,11 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -17796,27 +17743,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-14.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -18055,6 +17981,11 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -19838,27 +19769,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-16.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -20077,6 +19987,11 @@ "script": "headless_python_unittests.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index ec326d1f674723..736460465f96be 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json @@ -14,6 +14,11 @@ "script": "check_static_initializers.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -1636,28 +1641,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.11" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -3480,29 +3463,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "gpu": "8086:0a2e", - "os": "Mac-10.12.6" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -5263,28 +5223,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.13.6" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -7046,28 +6984,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.14.6" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { @@ -8928,29 +8844,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.15" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "isolate_profile_data": true, @@ -10647,28 +10540,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-10.15" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "args": [ "--pageset-repeat=1", @@ -12439,28 +12310,6 @@ }, "test_id_prefix": "ninja://chrome/installer/mac:mac_signing_tests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Mac-11|Mac-10.16" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mojo_python_unittests", "merge": { diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index fae256cb94263d..26cbcc1bc6a86c 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json @@ -1362,22 +1362,6 @@ }, "test_id_prefix": "ninja://third_party/flatbuffers:flatbuffers_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mini_installer_tests", "merge": { @@ -1538,6 +1522,11 @@ "script": "check_network_annotations.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -1555,6 +1544,11 @@ "script": "check_network_annotations.py", "swarming": {} }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, { "name": "webkit_lint", "script": "blink_lint_expectations.py", @@ -3779,29 +3773,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "isolate_profile_data": true, - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Windows-10-18363" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mini_installer_tests", "isolate_profile_data": true, @@ -5923,28 +5894,6 @@ }, "test_id_prefix": "ninja://tools/grit:grit_python_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "os": "Windows-10-18363" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "args": [ "--pageset-repeat=1", @@ -7503,22 +7452,6 @@ }, "test_id_prefix": "ninja://third_party/flatbuffers:flatbuffers_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "isolate_name": "mini_installer_tests", "merge": { @@ -8994,22 +8927,6 @@ }, "test_id_prefix": "ninja://third_party/flatbuffers:flatbuffers_unittests/" }, - { - "isolate_name": "metrics_python_tests", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "metrics_python_tests", - "resultdb": { - "enable": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://tools/metrics:metrics_python_tests/" - }, { "args": [ "--pageset-repeat=1", diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index c80a76f9c1773a..f8fd08a9e7f9b6 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl @@ -1231,14 +1231,6 @@ "label": "//ui/message_center:message_center_unittests", "type": "windowed_test_launcher", }, - "metrics_python_tests": { - "args": [ - "../../tools/metrics/metrics_python_tests.py", - ], - "label": "//tools/metrics:metrics_python_tests", - "script": "//testing/scripts/run_isolated_script_test.py", - "type": "script", - }, "microdump_stackwalk": { "label": "//third_party/breakpad:microdump_stackwalk", "type": "additional_compile_target", diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index cbc8ba5dd07053..609692705b6caa 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl @@ -897,6 +897,9 @@ 'headless_python_unittests': { 'script': 'headless_python_unittests.py', }, + 'metrics_python_tests': { + 'script': 'metrics_python_tests.py', + }, 'webkit_lint': { 'script': 'blink_lint_expectations.py', }, @@ -906,6 +909,9 @@ 'check_static_initializers': { 'script': 'check_static_initializers.py', }, + 'metrics_python_tests': { + 'script': 'metrics_python_tests.py', + }, 'webkit_lint': { 'script': 'blink_lint_expectations.py', }, @@ -1098,6 +1104,9 @@ 'check_network_annotations': { 'script': 'check_network_annotations.py', }, + 'metrics_python_tests': { + 'script': 'metrics_python_tests.py', + }, 'webkit_lint': { 'script': 'blink_lint_expectations.py', }, @@ -1303,11 +1312,6 @@ 'enable': True, }, }, - 'metrics_python_tests': { - 'resultdb': { - 'enable': True, - }, - }, 'telemetry_gpu_unittests': { 'swarming': { 'idempotent': False, # https://crbug.com/549140 diff --git a/testing/scripts/metrics_python_tests.py b/testing/scripts/metrics_python_tests.py new file mode 100755 index 00000000000000..206d1b330f16d7 --- /dev/null +++ b/testing/scripts/metrics_python_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# 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. + +"""Runs //tools/metrics/metrics_python_tests.py as a 'script' test.""" + +import json +import os +import sys + + +import common + + +def main_run(args): + with common.temporary_file() as tempfile_path: + rc = common.run_command(['vpython', + os.path.join(common.SRC_DIR, 'testing', 'test_env.py'), + os.path.join(common.SRC_DIR, 'tools', 'metrics', + 'metrics_python_tests.py'), + '--isolated-script-test-output', tempfile_path + ], cwd=os.path.join(common.SRC_DIR, 'out', args.build_config_fs)) + + with open(tempfile_path) as f: + isolated_results = json.load(f) + + results = common.parse_common_test_results(isolated_results, + test_separator='.') + + json.dump({ + 'valid': True, + 'failures': ['%s: %s' % (k, v) + for k, v in results['unexpected_failures'].items()] + }, args.output) + + return rc + + +def main_compile_targets(args): + json.dump([], args.output) + + +if __name__ == '__main__': + funcs = { + 'run': main_run, + 'compile_targets': main_compile_targets, + } + sys.exit(common.run_script(sys.argv[1:], funcs)) diff --git a/tools/metrics/metrics_python_tests.py b/tools/metrics/metrics_python_tests.py index ddd3eb63ab1ece..209d3780a2f338 100755 --- a/tools/metrics/metrics_python_tests.py +++ b/tools/metrics/metrics_python_tests.py @@ -21,22 +21,33 @@ def resolve(*paths): sys.exit( - typ.main(tests=resolve( - 'actions/extract_actions_test.py', - 'histograms/expand_owners_unittest.py', - 'histograms/extract_histograms_test.py', - 'histograms/generate_expired_histograms_array_unittest.py', - 'histograms/pretty_print_test.py', - 'ukm/codegen_test.py', - 'ukm/gen_builders_test.py', - 'ukm/ukm_model_test.py', - 'ukm/xml_validations_test.py', - '../json_comment_eater/json_comment_eater_test.py', - '../json_to_struct/element_generator_test.py', - '../json_to_struct/struct_generator_test.py', - '../variations/fieldtrial_to_struct_unittest.py', - '../variations/fieldtrial_util_unittest.py', - '../variations/split_variations_cmd_unittest.py', - '../../components/variations/service/' - 'generate_ui_string_overrider_unittest.py', - ))) + typ.main( + tests=resolve( + 'actions/extract_actions_test.py', + + # TODO(crbug.com/1220251) - the test ordering is very sensitive due to + # potential name collisions between ukm/pretty_print.py and + # histograms/pretty_print.py and the implementation in typ. + # + # Until this issue is fixed, best to ensure that the 'histograms' files + # show up *after* the 'ukm' files (in order for the histograms + # directory to be added to sys.path *before* ukm), and that we run the + # tests in a single process (jobs=1, below). + 'ukm/codegen_test.py', + 'ukm/gen_builders_test.py', + 'ukm/ukm_model_test.py', + 'ukm/xml_validations_test.py', + 'histograms/expand_owners_unittest.py', + 'histograms/extract_histograms_test.py', + 'histograms/generate_expired_histograms_array_unittest.py', + 'histograms/pretty_print_test.py', + '../json_comment_eater/json_comment_eater_test.py', + '../json_to_struct/element_generator_test.py', + '../json_to_struct/struct_generator_test.py', + '../variations/fieldtrial_to_struct_unittest.py', + '../variations/fieldtrial_util_unittest.py', + '../variations/split_variations_cmd_unittest.py', + '../../components/variations/service/' + 'generate_ui_string_overrider_unittest.py', + ), + jobs=1))