Fix GPU UPF suite names
Switches the GPU UPF query builder to convert names using the generated
name mapping instead of a manually curated list. This fixes the issue
with expected_color expectations being listed as unused and should make
it impossible for the mapping to get out of date in the future.
Bug: 1480175
Change-Id: I70980f7d3527ada45fdddd680b4c0bc32fd69ea3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4851818
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1194199}
diff --git a/content/test/gpu/unexpected_passes/gpu_queries.py b/content/test/gpu/unexpected_passes/gpu_queries.py
index 789b67c..1ecb1e7 100644
--- a/content/test/gpu/unexpected_passes/gpu_queries.py
+++ b/content/test/gpu/unexpected_passes/gpu_queries.py
@@ -5,6 +5,8 @@
import typing
+from gpu_tests import gpu_integration_test
+
from unexpected_passes_common import constants
from unexpected_passes_common import data_types
from unexpected_passes_common import queries as queries_module
@@ -192,25 +194,15 @@
{all_builders_from_table_subquery}""".format(
all_builders_from_table_subquery=ALL_BUILDERS_FROM_TABLE_SUBQUERY)
-# The suite reported to Telemetry for selecting which suite to run is not
-# necessarily the same one that is reported to typ/ResultDB, so map any special
-# cases here.
-TELEMETRY_SUITE_TO_RDB_SUITE_EXCEPTION_MAP = {
- 'info_collection': 'info_collection_test',
- 'power': 'power_measurement_integration_test',
- 'trace_test': 'trace_integration_test',
-}
-
class GpuBigQueryQuerier(queries_module.BigQueryQuerier):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- # Most test names are |suite|_integration_test, but there are several that
- # are not reported that way in typ, and by extension ResultDB, so adjust
- # that here.
- self._suite = TELEMETRY_SUITE_TO_RDB_SUITE_EXCEPTION_MAP.get(
- self._suite, self._suite + '_integration_test')
+ name_mapping = gpu_integration_test.GenerateTestNameMapping()
+ # The suite name we use for identification (return value of Name()) is not
+ # the same as the one used by ResultDB (Python module), so convert here.
+ self._suite = name_mapping[self._suite].__module__.split('.')[-1]
def _GetQueryGeneratorForBuilder(
self, builder: data_types.BuilderEntry
diff --git a/content/test/gpu/unexpected_passes/gpu_queries_unittest.py b/content/test/gpu/unexpected_passes/gpu_queries_unittest.py
index 21c89df..dae3eee 100755
--- a/content/test/gpu/unexpected_passes/gpu_queries_unittest.py
+++ b/content/test/gpu/unexpected_passes/gpu_queries_unittest.py
@@ -29,44 +29,45 @@
uu.RegisterGenericBuildersImplementation()
uu.RegisterGenericExpectationsImplementation()
- def testSuiteExceptionMap(self) -> None:
- """Tests that the suite passed to the query changes for some suites."""
+ def testSuiteNameTranslation(self) -> None:
+ """Tests that the suite passed to the query is auto-translated."""
+ # The key is the return value of Name() for a test suite, while the value is
+ # the last part of the Python module for the test file (i.e. the name of the
+ # file without .py). The former is used when running the tests, while the
+ # latter is used by ResultDB for reporting.
+ suites_to_modules = {
+ 'cast_streaming': 'cast_streaming_integration_test',
+ 'context_lost': 'context_lost_integration_test',
+ 'expected_color': 'expected_color_test',
+ 'gpu_process': 'gpu_process_integration_test',
+ 'hardware_accelerated_feature':
+ 'hardware_accelerated_feature_integration_test',
+ 'info_collection': 'info_collection_test',
+ 'mediapipe': 'mediapipe_integration_test',
+ 'noop_sleep': 'noop_sleep_integration_test',
+ 'pixel': 'pixel_integration_test',
+ 'power': 'power_measurement_integration_test',
+ 'screenshot_sync': 'screenshot_sync_integration_test',
+ 'trace_test': 'trace_integration_test',
+ 'webcodecs': 'webcodecs_integration_test',
+ 'webgl1_conformance': 'webgl1_conformance_integration_test',
+ 'webgl2_conformance': 'webgl2_conformance_integration_test',
+ 'webgpu_cts': 'webgpu_cts_integration_test',
+ }
def assertSuiteInQuery(suite: str, call_args: tuple) -> None:
query = call_args[0][0][0]
s = 'r"gpu_tests\\.%s\\."' % suite
self.assertIn(s, query)
- # Non-special cased suite.
- querier = gpu_uu.CreateGenericGpuQuerier()
- with mock.patch.object(querier,
- '_RunBigQueryCommandsForJsonOutput') as query_mock:
- _ = querier.QueryBuilder(
- data_types.BuilderEntry('builder', constants.BuilderTypes.CI, False))
- assertSuiteInQuery('pixel_integration_test', query_mock.call_args)
-
- # Special-cased suites.
- querier = gpu_uu.CreateGenericGpuQuerier(suite='info_collection')
- with mock.patch.object(querier,
- '_RunBigQueryCommandsForJsonOutput') as query_mock:
- _ = querier.QueryBuilder(
- data_types.BuilderEntry('builder', constants.BuilderTypes.CI, False))
- assertSuiteInQuery('info_collection_test', query_mock.call_args)
-
- querier = gpu_uu.CreateGenericGpuQuerier(suite='power')
- with mock.patch.object(querier,
- '_RunBigQueryCommandsForJsonOutput') as query_mock:
- _ = querier.QueryBuilder(
- data_types.BuilderEntry('builder', constants.BuilderTypes.CI, False))
- assertSuiteInQuery('power_measurement_integration_test',
- query_mock.call_args)
-
- querier = gpu_uu.CreateGenericGpuQuerier(suite='trace_test')
- with mock.patch.object(querier,
- '_RunBigQueryCommandsForJsonOutput') as query_mock:
- _ = querier.QueryBuilder(
- data_types.BuilderEntry('builder', constants.BuilderTypes.CI, False))
- assertSuiteInQuery('trace_integration_test', query_mock.call_args)
+ for suite, module in suites_to_modules.items():
+ querier = gpu_uu.CreateGenericGpuQuerier(suite=suite)
+ with mock.patch.object(querier,
+ '_RunBigQueryCommandsForJsonOutput') as query_mock:
+ _ = querier.QueryBuilder(
+ data_types.BuilderEntry('builder', constants.BuilderTypes.CI,
+ False))
+ assertSuiteInQuery(module, query_mock.call_args)
class GetQueryGeneratorForBuilderUnittest(unittest.TestCase):