Skip to content

Commit 90073b3

Browse files
committed
Bug 1982404: pre: don't assume all tests in test sets are applicable to the kind being loaded r=taskgraph-reviewers,jmaher
This allows for tests to be split up across multiple kinds. Differential Revision: https://phabricator.services.mozilla.com/D260836 UltraBlame original commit: e7be20d17a1cce60fd30930d40ac3852f67276de
1 parent 4929ddc commit 90073b3

File tree

1 file changed

+30
-3
lines changed
  • taskcluster/gecko_taskgraph/loader

1 file changed

+30
-3
lines changed

taskcluster/gecko_taskgraph/loader/test.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import logging
77

8+
from mozbuild.util import memoize
89
from taskgraph.loader.transform import loader as transform_loader
910
from taskgraph.util.copy import deepcopy
1011
from taskgraph.util.yaml import load_yaml
@@ -34,7 +35,7 @@ def loader(kind, path, config, params, loaded_tasks):
3435

3536

3637
test_sets_cfg = load_yaml(TEST_CONFIGS, "test-sets.yml")
37-
test_platforms = expand_tests(test_sets_cfg, test_platforms)
38+
test_platforms = expand_tests(test_sets_cfg, test_platforms, kind)
3839

3940

4041
tests = transform_loader(kind, path, config, params, loaded_tasks)
@@ -118,7 +119,25 @@ def get_test_platforms(
118119
return test_platforms
119120

120121

121-
def expand_tests(test_sets_cfg, test_platforms):
122+
PREFIX_BY_KIND = {}
123+
124+
125+
@memoize
126+
def is_test_for_kind(test_name, kind):
127+
if kind == "test":
128+
129+
130+
131+
for prefixes in PREFIX_BY_KIND.values():
132+
if any([test_name.startswith(prefix) for prefix in prefixes]):
133+
return False
134+
return True
135+
else:
136+
test_set_prefixes = PREFIX_BY_KIND[kind]
137+
return any([test_name.startswith(prefix) for prefix in test_set_prefixes])
138+
139+
140+
def expand_tests(test_sets_cfg, test_platforms, kind):
122141
"""Expand the test sets in `test_platforms` out to sets of test names.
123142
Returns a dictionary like `get_test_platforms`, with an additional
124143
`test-names` key for each test platform, containing a set of test
@@ -134,7 +153,15 @@ def expand_tests(test_sets_cfg, test_platforms):
134153
)
135154
test_names = set()
136155
for test_set in test_sets:
137-
test_names.update(test_sets_cfg[test_set])
156+
for test_name in test_sets_cfg[test_set]:
157+
158+
159+
160+
161+
162+
163+
if is_test_for_kind(test_name, kind):
164+
test_names.add(test_name)
138165
rv[test_platform] = cfg.copy()
139166
rv[test_platform]["test-names"] = test_names
140167
return rv

0 commit comments

Comments
 (0)