Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1 | #!/usr/bin/env vpython3 |
Avi Drissman | dfd88085 | 2022-09-15 20:11:09 | [diff] [blame] | 2 | # Copyright 2017 The Chromium Authors |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """Tests for generate_buildbot_json.py.""" |
| 7 | |
Garrett Beaty | 777c291 | 2020-05-07 00:54:33 | [diff] [blame] | 8 | import contextlib |
| 9 | import json |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 10 | import os |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 11 | import re |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 12 | import unittest |
Garrett Beaty | 777c291 | 2020-05-07 00:54:33 | [diff] [blame] | 13 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 14 | import generate_buildbot_json |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 15 | from pyfakefs import fake_filesystem_unittest |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 16 | |
Joshua Hood | 56c673c | 2022-03-02 20:29:33 | [diff] [blame] | 17 | # pylint: disable=super-with-arguments |
| 18 | |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 19 | EMPTY_PYL_FILE = """\ |
| 20 | { |
| 21 | } |
| 22 | """ |
| 23 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 24 | # Use this value to refer to the directory containing this code |
| 25 | # The tests use a fake filesystem and python filesystem calls are monkey-patched |
| 26 | # to use the fake filesystem, which affects abspath |
| 27 | THIS_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 28 | |
| 29 | |
| 30 | class TestCase(fake_filesystem_unittest.TestCase): |
| 31 | def setUp(self): |
| 32 | self.setUpPyfakefs() |
| 33 | self.fs.cwd = THIS_DIR |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 34 | |
| 35 | expectations_dir = os.path.join(THIS_DIR, 'unittest_expectations') |
| 36 | self.output_dir = os.path.join(expectations_dir, self.id().split('.')[-1]) |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 37 | |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 38 | # This allows reads into this directory to fallback to the real fs, which we |
| 39 | # want so each test case's json can be checked-in. |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 40 | self.fs.add_real_directory(expectations_dir) |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 41 | |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 42 | self.set_args() |
| 43 | |
| 44 | def set_args(self, *args): |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 45 | self.args = generate_buildbot_json.BBJSONGenerator.parse_args(( |
| 46 | '--output-dir', |
| 47 | self.output_dir, |
| 48 | ) + args) |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 49 | |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 50 | def regen_test_json(self, fakebb): |
| 51 | """Regenerates a unittest's json files. |
| 52 | |
| 53 | Useful when making sweeping changes to pyl inputs in many test cases. Can be |
| 54 | used by simply inserting a call to this method in a unit test after |
| 55 | initializing its FakeBBGen object. |
| 56 | """ |
| 57 | contents = fakebb.generate_outputs() |
| 58 | with fake_filesystem_unittest.Pause(self.fs): |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 59 | try: |
| 60 | os.mkdir(self.output_dir) |
| 61 | except FileExistsError: |
| 62 | if not os.path.isdir(self.output_dir): |
| 63 | raise |
| 64 | |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 65 | fakebb.write_json_result(contents) |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 66 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 67 | |
Garrett Beaty | 777c291 | 2020-05-07 00:54:33 | [diff] [blame] | 68 | @contextlib.contextmanager |
| 69 | def dump_on_failure(fbb, dump=True): |
| 70 | try: |
| 71 | yield |
| 72 | except: |
| 73 | if dump: |
| 74 | for l in fbb.printed_lines: |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 75 | print(l) |
Garrett Beaty | 777c291 | 2020-05-07 00:54:33 | [diff] [blame] | 76 | raise |
| 77 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 78 | class FakeBBGen(generate_buildbot_json.BBJSONGenerator): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 79 | def __init__(self, |
| 80 | args, |
| 81 | waterfalls, |
| 82 | test_suites, |
| 83 | luci_milo_cfg, |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 84 | project_pyl='{"validate_source_side_specs_have_builder": True}', |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 85 | exceptions=EMPTY_PYL_FILE, |
Stephanie Kim | 572b43c0 | 2023-04-13 14:24:13 | [diff] [blame] | 86 | autoshard_exceptions=json.dumps({}), |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 87 | mixins=EMPTY_PYL_FILE, |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 88 | gn_isolate_map=EMPTY_PYL_FILE, |
| 89 | variants=EMPTY_PYL_FILE): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 90 | super(FakeBBGen, self).__init__(args) |
| 91 | |
| 92 | pyl_files_dir = args.pyl_files_dir or THIS_DIR |
| 93 | infra_config_dir = args.infra_config_dir |
| 94 | |
| 95 | files = { |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 96 | args.waterfalls_pyl_path: waterfalls, |
| 97 | args.test_suites_pyl_path: test_suites, |
| 98 | args.test_suite_exceptions_pyl_path: exceptions, |
Stephanie Kim | 572b43c0 | 2023-04-13 14:24:13 | [diff] [blame] | 99 | args.autoshard_exceptions_json_path: autoshard_exceptions, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 100 | args.mixins_pyl_path: mixins, |
| 101 | args.gn_isolate_map_pyl_path: gn_isolate_map, |
| 102 | args.variants_pyl_path: variants, |
| 103 | os.path.join(pyl_files_dir, 'gn_isolate_map2.pyl'): |
| 104 | GPU_TELEMETRY_GN_ISOLATE_MAP, |
| 105 | os.path.join(infra_config_dir, 'generated/project.pyl'): project_pyl, |
| 106 | os.path.join(infra_config_dir, 'generated/luci/luci-milo.cfg'): |
| 107 | luci_milo_cfg, |
| 108 | os.path.join(infra_config_dir, 'generated/luci/luci-milo-dev.cfg'): '', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 109 | } |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 110 | for path, content in files.items(): |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 111 | if content is None: |
| 112 | continue |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 113 | parent = os.path.abspath(os.path.dirname(path)) |
| 114 | if not os.path.exists(parent): |
| 115 | os.makedirs(parent) |
| 116 | with open(path, 'w') as f: |
| 117 | f.write(content) |
| 118 | |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 119 | self.printed_lines = [] |
| 120 | |
| 121 | def print_line(self, line): |
| 122 | self.printed_lines.append(line) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 123 | |
Kenneth Russell | 73c3bd8b | 2018-10-19 22:30:19 | [diff] [blame] | 124 | # pragma pylint: disable=arguments-differ |
| 125 | def check_output_file_consistency(self, verbose=False, dump=True): |
Garrett Beaty | 777c291 | 2020-05-07 00:54:33 | [diff] [blame] | 126 | with dump_on_failure(self, dump=verbose and dump): |
Kenneth Russell | 73c3bd8b | 2018-10-19 22:30:19 | [diff] [blame] | 127 | super(FakeBBGen, self).check_output_file_consistency(verbose) |
Joshua Hood | 56c673c | 2022-03-02 20:29:33 | [diff] [blame] | 128 | # pragma pylint: enable=arguments-differ |
Kenneth Russell | 73c3bd8b | 2018-10-19 22:30:19 | [diff] [blame] | 129 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 130 | |
| 131 | FOO_GTESTS_WATERFALL = """\ |
| 132 | [ |
| 133 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 134 | 'project': 'chromium', |
| 135 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 136 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 137 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 138 | 'Fake Tester': { |
| 139 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 140 | 'dimensions':{ |
| 141 | 'kvm': '1', |
| 142 | 'os': 'Linux', |
| 143 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 144 | }, |
| 145 | 'test_suites': { |
| 146 | 'gtest_tests': 'foo_tests', |
| 147 | }, |
| 148 | }, |
| 149 | }, |
| 150 | }, |
| 151 | ] |
| 152 | """ |
| 153 | |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 154 | FOO_GTESTS_WITH_ENABLE_FEATURES_WATERFALL = """\ |
| 155 | [ |
| 156 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 157 | 'project': 'chromium', |
| 158 | 'bucket': 'ci', |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 159 | 'name': 'chromium.test', |
| 160 | 'machines': { |
| 161 | 'Fake Tester': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 162 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 163 | 'dimensions': { |
| 164 | 'os': 'Linux', |
| 165 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 166 | }, |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 167 | 'test_suites': { |
| 168 | 'gtest_tests': 'foo_tests', |
| 169 | }, |
| 170 | 'args': [ |
| 171 | '--enable-features=Baz', |
| 172 | ], |
| 173 | }, |
| 174 | }, |
| 175 | }, |
| 176 | ] |
| 177 | """ |
| 178 | |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 179 | FOO_CHROMEOS_TRIGGER_SCRIPT_WATERFALL = """\ |
| 180 | [ |
| 181 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 182 | 'project': 'chromium', |
| 183 | 'bucket': 'ci', |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 184 | 'name': 'chromium.test', |
| 185 | 'machines': { |
| 186 | 'Fake Tester': { |
| 187 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 188 | 'dimensions': { |
| 189 | "device_type": "foo_device", |
| 190 | }, |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 191 | }, |
| 192 | 'test_suites': { |
| 193 | 'gtest_tests': 'foo_tests', |
| 194 | }, |
| 195 | 'os_type': 'chromeos', |
| 196 | }, |
| 197 | }, |
| 198 | }, |
| 199 | ] |
| 200 | """ |
Stephen Martinis | f8389372 | 2018-09-19 00:02:18 | [diff] [blame] | 201 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 202 | FOO_LINUX_GTESTS_WATERFALL = """\ |
| 203 | [ |
| 204 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 205 | 'project': 'chromium', |
| 206 | 'bucket': 'ci', |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 207 | 'name': 'chromium.test', |
| 208 | 'machines': { |
| 209 | 'Fake Tester': { |
| 210 | 'os_type': 'linux', |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 211 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 212 | 'dimensions': { |
| 213 | 'os': 'Linux', |
| 214 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 215 | }, |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 216 | 'test_suites': { |
| 217 | 'gtest_tests': 'foo_tests', |
| 218 | }, |
| 219 | }, |
| 220 | }, |
| 221 | }, |
| 222 | ] |
| 223 | """ |
| 224 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 225 | COMPOSITION_GTEST_SUITE_WATERFALL = """\ |
| 226 | [ |
| 227 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 228 | 'project': 'chromium', |
| 229 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 230 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 231 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 232 | 'Fake Tester': { |
| 233 | 'test_suites': { |
| 234 | 'gtest_tests': 'composition_tests', |
| 235 | }, |
| 236 | }, |
| 237 | }, |
| 238 | }, |
| 239 | ] |
| 240 | """ |
| 241 | |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 242 | COMPOSITION_GTEST_SUITE_WITH_ARGS_WATERFALL = """\ |
| 243 | [ |
| 244 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 245 | 'project': 'chromium', |
| 246 | 'bucket': 'ci', |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 247 | 'name': 'chromium.test', |
| 248 | 'machines': { |
| 249 | 'Fake Tester': { |
| 250 | 'test_suites': { |
| 251 | 'gtest_tests': 'composition_tests', |
| 252 | }, |
| 253 | 'args': [ |
| 254 | '--this-is-an-argument', |
| 255 | ], |
| 256 | }, |
| 257 | }, |
| 258 | }, |
| 259 | ] |
| 260 | """ |
| 261 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 262 | FOO_ISOLATED_SCRIPTS_WATERFALL = """\ |
| 263 | [ |
| 264 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 265 | 'project': 'chromium', |
| 266 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 267 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 268 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 269 | 'Fake Tester': { |
| 270 | 'test_suites': { |
| 271 | 'isolated_scripts': 'composition_tests', |
| 272 | }, |
| 273 | }, |
| 274 | }, |
| 275 | }, |
| 276 | ] |
| 277 | """ |
| 278 | |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 279 | FOO_ISOLATED_SCRIPTS_WATERFALL_ANDROID = """\ |
| 280 | [ |
| 281 | { |
| 282 | 'project': 'chromium', |
| 283 | 'bucket': 'ci', |
| 284 | 'name': 'chromium.test', |
| 285 | 'machines': { |
| 286 | 'Fake Tester': { |
Yuly Novikov | 26dd4705 | 2021-02-11 00:57:14 | [diff] [blame] | 287 | 'os_type': 'android', |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 288 | 'test_suites': { |
| 289 | 'isolated_scripts': 'composition_tests', |
| 290 | }, |
| 291 | 'use_android_presentation': True, |
| 292 | }, |
| 293 | }, |
| 294 | }, |
| 295 | ] |
| 296 | """ |
| 297 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 298 | FOO_SCRIPT_WATERFALL = """\ |
| 299 | [ |
| 300 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 301 | 'project': 'chromium', |
| 302 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 303 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 304 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 305 | 'Fake Tester': { |
| 306 | 'test_suites': { |
| 307 | 'scripts': 'foo_scripts', |
| 308 | }, |
| 309 | }, |
| 310 | }, |
| 311 | }, |
| 312 | ] |
| 313 | """ |
| 314 | |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 315 | FOO_SCRIPT_WATERFALL_MACHINE_FORBIDS_SCRIPT_TESTS = """\ |
| 316 | [ |
| 317 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 318 | 'project': 'chromium', |
| 319 | 'bucket': 'ci', |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 320 | 'name': 'chromium.test', |
| 321 | 'machines': { |
| 322 | 'Fake Tester': { |
| 323 | 'forbid_script_tests': True, |
| 324 | 'test_suites': { |
| 325 | 'scripts': 'foo_scripts', |
| 326 | }, |
| 327 | }, |
| 328 | }, |
| 329 | }, |
| 330 | ] |
| 331 | """ |
| 332 | |
| 333 | FOO_SCRIPT_WATERFALL_FORBID_SCRIPT_TESTS = """\ |
| 334 | [ |
| 335 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 336 | 'project': 'chromium', |
| 337 | 'bucket': 'ci', |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 338 | 'name': 'chromium.test', |
| 339 | 'forbid_script_tests': True, |
| 340 | 'machines': { |
| 341 | 'Fake Tester': { |
| 342 | 'test_suites': { |
| 343 | 'scripts': 'foo_scripts', |
| 344 | }, |
| 345 | }, |
| 346 | }, |
| 347 | }, |
| 348 | ] |
| 349 | """ |
| 350 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 351 | FOO_JUNIT_WATERFALL = """\ |
| 352 | [ |
| 353 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 354 | 'project': 'chromium', |
| 355 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 356 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 357 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 358 | 'Fake Tester': { |
| 359 | 'test_suites': { |
| 360 | 'junit_tests': 'composition_tests', |
| 361 | }, |
| 362 | }, |
| 363 | }, |
| 364 | }, |
| 365 | ] |
| 366 | """ |
| 367 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 368 | FOO_GPU_TELEMETRY_TEST_WATERFALL = """\ |
| 369 | [ |
| 370 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 371 | 'project': 'chromium', |
| 372 | 'bucket': 'ci', |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 373 | 'name': 'chromium.test', |
| 374 | 'machines': { |
| 375 | 'Fake Tester': { |
| 376 | 'os_type': 'win', |
| 377 | 'browser_config': 'release', |
| 378 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 379 | 'dimensions': { |
| 380 | 'gpu': '10de:1cb3', |
| 381 | }, |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 382 | }, |
| 383 | 'test_suites': { |
| 384 | 'gpu_telemetry_tests': 'composition_tests', |
| 385 | }, |
| 386 | }, |
| 387 | }, |
| 388 | }, |
| 389 | ] |
| 390 | """ |
| 391 | |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 392 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID = """\ |
| 393 | [ |
| 394 | { |
| 395 | 'project': 'chromium', |
| 396 | 'bucket': 'ci', |
| 397 | 'name': 'chromium.test', |
| 398 | 'machines': { |
| 399 | 'Fake Tester': { |
| 400 | 'os_type': 'android', |
| 401 | 'browser_config': 'android-chromium', |
| 402 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 403 | 'dimensions': { |
| 404 | 'device_type': 'bullhead', |
| 405 | }, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 406 | }, |
| 407 | 'test_suites': { |
| 408 | 'gpu_telemetry_tests': 'composition_tests', |
| 409 | }, |
| 410 | }, |
| 411 | }, |
| 412 | }, |
| 413 | ] |
| 414 | """ |
| 415 | |
| 416 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID_WEBVIEW = """\ |
| 417 | [ |
| 418 | { |
| 419 | 'project': 'chromium', |
| 420 | 'bucket': 'ci', |
| 421 | 'name': 'chromium.test', |
| 422 | 'machines': { |
| 423 | 'Fake Tester': { |
| 424 | 'os_type': 'android', |
| 425 | 'browser_config': 'not-a-real-browser', |
| 426 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 427 | 'dimensions': { |
| 428 | 'device_type': 'bullhead', |
| 429 | }, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 430 | }, |
| 431 | 'test_suites': { |
| 432 | 'android_webview_gpu_telemetry_tests': 'composition_tests', |
| 433 | }, |
| 434 | }, |
| 435 | }, |
| 436 | }, |
| 437 | ] |
| 438 | """ |
| 439 | |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 440 | FOO_GPU_TELEMETRY_TEST_WATERFALL_FUCHSIA = """\ |
| 441 | [ |
| 442 | { |
| 443 | 'project': 'chromium', |
| 444 | 'bucket': 'ci', |
| 445 | 'name': 'chromium.test', |
| 446 | 'machines': { |
| 447 | 'Fake Tester': { |
| 448 | 'os_type': 'fuchsia', |
| 449 | 'browser_config': 'fuchsia-chrome', |
| 450 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 451 | 'dimensions': { |
| 452 | 'kvm': '1', |
| 453 | }, |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 454 | }, |
| 455 | 'test_suites': { |
| 456 | 'gpu_telemetry_tests': 'composition_tests', |
| 457 | }, |
| 458 | }, |
| 459 | }, |
| 460 | }, |
| 461 | ] |
| 462 | """ |
| 463 | |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 464 | FOO_GPU_TELEMETRY_TEST_WATERFALL_CAST_STREAMING = """\ |
| 465 | [ |
| 466 | { |
| 467 | 'project': 'chromium', |
| 468 | 'bucket': 'ci', |
| 469 | 'name': 'chromium.test', |
| 470 | 'machines': { |
| 471 | 'Fake Tester': { |
| 472 | 'os_type': 'fuchsia', |
| 473 | 'browser_config': 'not-a-real-browser', |
| 474 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 475 | 'dimensions': { |
| 476 | 'kvm': '1', |
| 477 | }, |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 478 | }, |
| 479 | 'test_suites': { |
| 480 | 'cast_streaming_tests': 'composition_tests', |
| 481 | }, |
| 482 | }, |
| 483 | }, |
| 484 | }, |
| 485 | ] |
| 486 | """ |
| 487 | |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 488 | FOO_GPU_TELEMETRY_TEST_WATERFALL_SKYLAB = """\ |
| 489 | [ |
| 490 | { |
| 491 | 'project': 'chromium', |
| 492 | 'bucket': 'ci', |
| 493 | 'name': 'chromium.test', |
| 494 | 'machines': { |
| 495 | 'Fake Tester': { |
| 496 | 'os_type': 'chromeos', |
| 497 | 'browser_config': 'cros-chrome', |
| 498 | 'use_swarming': False, |
| 499 | 'swarming': { |
| 500 | 'some_key': 'some_value', |
| 501 | }, |
| 502 | 'test_suites': { |
| 503 | 'skylab_gpu_telemetry_tests': 'composition_tests', |
| 504 | }, |
| 505 | }, |
| 506 | }, |
| 507 | }, |
| 508 | ] |
| 509 | """ |
| 510 | |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 511 | NVIDIA_GPU_TELEMETRY_TEST_WATERFALL = """\ |
| 512 | [ |
| 513 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 514 | 'project': 'chromium', |
| 515 | 'bucket': 'ci', |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 516 | 'name': 'chromium.test', |
| 517 | 'machines': { |
| 518 | 'Fake Tester': { |
| 519 | 'os_type': 'win', |
| 520 | 'browser_config': 'release', |
| 521 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 522 | 'dimensions': { |
| 523 | 'gpu': '10de:1cb3-26.21.14.3102', |
| 524 | }, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 525 | }, |
| 526 | 'test_suites': { |
| 527 | 'gpu_telemetry_tests': 'composition_tests', |
| 528 | }, |
| 529 | }, |
| 530 | }, |
| 531 | }, |
| 532 | ] |
| 533 | """ |
| 534 | |
| 535 | INTEL_GPU_TELEMETRY_TEST_WATERFALL = """\ |
| 536 | [ |
| 537 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 538 | 'project': 'chromium', |
| 539 | 'bucket': 'ci', |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 540 | 'name': 'chromium.test', |
| 541 | 'machines': { |
| 542 | 'Fake Tester': { |
| 543 | 'os_type': 'win', |
| 544 | 'browser_config': 'release', |
| 545 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 546 | 'dimensions': { |
| 547 | 'gpu': '8086:5912-24.20.100.6286', |
| 548 | }, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 549 | }, |
| 550 | 'test_suites': { |
| 551 | 'gpu_telemetry_tests': 'composition_tests', |
| 552 | }, |
| 553 | }, |
| 554 | }, |
| 555 | }, |
| 556 | ] |
| 557 | """ |
| 558 | |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 559 | INTEL_UHD_GPU_TELEMETRY_TEST_WATERFALL = """\ |
| 560 | [ |
| 561 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 562 | 'project': 'chromium', |
| 563 | 'bucket': 'ci', |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 564 | 'name': 'chromium.test', |
| 565 | 'machines': { |
| 566 | 'Fake Tester': { |
| 567 | 'os_type': 'win', |
| 568 | 'browser_config': 'release', |
| 569 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 570 | 'dimensions': { |
| 571 | 'gpu': '8086:3e92-24.20.100.6286', |
| 572 | }, |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 573 | }, |
| 574 | 'test_suites': { |
| 575 | 'gpu_telemetry_tests': 'composition_tests', |
| 576 | }, |
| 577 | }, |
| 578 | }, |
| 579 | }, |
| 580 | ] |
| 581 | """ |
| 582 | |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 583 | GPU_TELEMETRY_TEST_VARIANTS_WATERFALL = """\ |
| 584 | [ |
| 585 | { |
| 586 | 'project': 'chromium', |
| 587 | 'bucket': 'ci', |
| 588 | 'name': 'chromium.test', |
| 589 | 'machines': { |
| 590 | 'Fake Tester': { |
| 591 | 'os_type': 'win', |
| 592 | 'browser_config': 'release', |
| 593 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 594 | 'dimensions': { |
| 595 | 'gpu': '8086:3e92-24.20.100.6286', |
| 596 | 'os': 'Linux', |
| 597 | }, |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 598 | }, |
| 599 | 'test_suites': { |
| 600 | 'gpu_telemetry_tests': 'matrix_tests', |
| 601 | }, |
| 602 | }, |
| 603 | }, |
| 604 | }, |
| 605 | ] |
| 606 | """ |
| 607 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 608 | UNKNOWN_TEST_SUITE_WATERFALL = """\ |
| 609 | [ |
| 610 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 611 | 'project': 'chromium', |
| 612 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 613 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 614 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 615 | 'Fake Tester': { |
| 616 | 'test_suites': { |
| 617 | 'gtest_tests': 'baz_tests', |
| 618 | }, |
| 619 | }, |
| 620 | }, |
| 621 | }, |
| 622 | ] |
| 623 | """ |
| 624 | |
| 625 | UNKNOWN_TEST_SUITE_TYPE_WATERFALL = """\ |
| 626 | [ |
| 627 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 628 | 'project': 'chromium', |
| 629 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 630 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 631 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 632 | 'Fake Tester': { |
| 633 | 'test_suites': { |
| 634 | 'gtest_tests': 'foo_tests', |
| 635 | 'foo_test_type': 'foo_tests', |
| 636 | }, |
| 637 | }, |
| 638 | }, |
| 639 | }, |
| 640 | ] |
| 641 | """ |
| 642 | |
| 643 | ANDROID_WATERFALL = """\ |
| 644 | [ |
| 645 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 646 | 'project': 'chromium', |
| 647 | 'bucket': 'ci', |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 648 | 'name': 'chromium.test', |
Kenneth Russell | 139f864 | 2017-12-05 08:51:43 | [diff] [blame] | 649 | 'machines': { |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 650 | 'Android Builder': { |
| 651 | 'additional_compile_targets': [ |
| 652 | 'bar_test', |
| 653 | ], |
| 654 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 655 | 'Fake Android K Tester': { |
| 656 | 'additional_compile_targets': [ |
| 657 | 'bar_test', |
| 658 | ], |
| 659 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 660 | 'dimensions': { |
| 661 | 'device_os': 'KTU84P', |
| 662 | 'device_type': 'hammerhead', |
| 663 | 'os': 'Android', |
| 664 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 665 | }, |
| 666 | 'os_type': 'android', |
Nico Weber | 79dc5f685 | 2018-07-13 19:38:49 | [diff] [blame] | 667 | 'skip_merge_script': True, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 668 | 'test_suites': { |
| 669 | 'gtest_tests': 'foo_tests', |
| 670 | }, |
| 671 | }, |
| 672 | 'Fake Android L Tester': { |
| 673 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 674 | 'dimensions': { |
| 675 | 'device_os': 'LMY41U', |
| 676 | 'device_os_type': 'user', |
| 677 | 'device_type': 'hammerhead', |
| 678 | 'os': 'Android', |
| 679 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 680 | }, |
| 681 | 'os_type': 'android', |
| 682 | 'skip_merge_script': True, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 683 | 'test_suites': { |
| 684 | 'gtest_tests': 'foo_tests', |
| 685 | }, |
| 686 | }, |
| 687 | 'Fake Android M Tester': { |
| 688 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 689 | 'dimensions': { |
| 690 | 'device_os': 'MMB29Q', |
| 691 | 'device_type': 'bullhead', |
| 692 | 'os': 'Android', |
| 693 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 694 | }, |
| 695 | 'os_type': 'android', |
| 696 | 'use_swarming': False, |
| 697 | 'test_suites': { |
| 698 | 'gtest_tests': 'foo_tests', |
| 699 | }, |
| 700 | }, |
| 701 | }, |
| 702 | }, |
| 703 | ] |
| 704 | """ |
| 705 | |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 706 | UNKNOWN_BOT_GTESTS_WATERFALL = """\ |
| 707 | [ |
| 708 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 709 | 'project': 'chromium', |
| 710 | 'bucket': 'ci', |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 711 | 'name': 'chromium.test', |
| 712 | 'machines': { |
| 713 | 'Unknown Bot': { |
| 714 | 'test_suites': { |
| 715 | 'gtest_tests': 'foo_tests', |
| 716 | }, |
| 717 | }, |
| 718 | }, |
| 719 | }, |
| 720 | ] |
| 721 | """ |
| 722 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 723 | MATRIX_GTEST_SUITE_WATERFALL = """\ |
| 724 | [ |
| 725 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 726 | 'project': 'chromium', |
| 727 | 'bucket': 'ci', |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 728 | 'name': 'chromium.test', |
| 729 | 'machines': { |
| 730 | 'Fake Tester': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 731 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 732 | 'dimensions': { |
| 733 | 'os': 'Linux', |
| 734 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 735 | }, |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 736 | 'test_suites': { |
| 737 | 'gtest_tests': 'matrix_tests', |
| 738 | }, |
| 739 | }, |
| 740 | }, |
| 741 | }, |
| 742 | ] |
| 743 | """ |
| 744 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 745 | MATRIX_GTEST_SUITE_WATERFALL_MIXINS = """\ |
| 746 | [ |
| 747 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 748 | 'project': 'chromium', |
| 749 | 'bucket': 'ci', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 750 | 'name': 'chromium.test', |
| 751 | 'machines': { |
| 752 | 'Fake Tester': { |
| 753 | 'mixins': ['dimension_mixin'], |
| 754 | 'test_suites': { |
| 755 | 'gtest_tests': 'matrix_tests', |
| 756 | }, |
| 757 | }, |
| 758 | }, |
| 759 | }, |
| 760 | ] |
| 761 | """ |
| 762 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 763 | FOO_TEST_SUITE = """\ |
| 764 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 765 | 'basic_suites': { |
| 766 | 'foo_tests': { |
| 767 | 'foo_test': { |
| 768 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 769 | 'dimensions': { |
| 770 | 'integrity': 'high', |
| 771 | 'os': 'Linux', |
| 772 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 773 | 'expiration': 120, |
| 774 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 775 | }, |
| 776 | }, |
| 777 | }, |
| 778 | } |
| 779 | """ |
| 780 | |
Garrett Beaty | e3a606ceb | 2024-04-30 22:13:13 | [diff] [blame] | 781 | FOO_TEST_SUITE_ANDROID_SWARMING = """\ |
| 782 | { |
| 783 | 'basic_suites': { |
| 784 | 'foo_tests': { |
| 785 | 'foo_test': { |
| 786 | 'android_swarming': { |
| 787 | 'shards': 100, |
| 788 | }, |
| 789 | }, |
| 790 | }, |
| 791 | }, |
| 792 | } |
| 793 | """ |
| 794 | |
Brian Sheedy | cae63b2 | 2020-06-10 22:52:11 | [diff] [blame] | 795 | FOO_TEST_SUITE_NO_DIMENSIONS = """\ |
| 796 | { |
| 797 | 'basic_suites': { |
| 798 | 'foo_tests': { |
| 799 | 'foo_test': { |
| 800 | }, |
| 801 | }, |
| 802 | }, |
| 803 | } |
| 804 | """ |
| 805 | |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 806 | FOO_TEST_SUITE_NOT_SORTED = """\ |
| 807 | { |
| 808 | 'basic_suites': { |
| 809 | 'foo_tests': { |
| 810 | 'foo_test': {}, |
| 811 | 'a_test': {}, |
| 812 | }, |
| 813 | }, |
| 814 | } |
| 815 | """ |
| 816 | |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 817 | FOO_TEST_SUITE_WITH_ARGS = """\ |
| 818 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 819 | 'basic_suites': { |
| 820 | 'foo_tests': { |
| 821 | 'foo_test': { |
| 822 | 'args': [ |
| 823 | '--c_arg', |
| 824 | ], |
| 825 | }, |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 826 | }, |
| 827 | }, |
| 828 | } |
| 829 | """ |
| 830 | |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 831 | FOO_TEST_SUITE_WITH_SWARMING_DIMENSION_SETS = """\ |
| 832 | { |
| 833 | 'basic_suites': { |
| 834 | 'foo_tests': { |
| 835 | 'foo_test': { |
| 836 | 'swarming': { |
| 837 | 'dimension_sets': [ |
| 838 | { |
| 839 | 'foo': 'bar', |
| 840 | }, |
| 841 | ], |
| 842 | }, |
| 843 | }, |
| 844 | }, |
| 845 | }, |
| 846 | } |
| 847 | """ |
| 848 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 849 | FOO_TEST_SUITE_WITH_NAME = """\ |
| 850 | { |
| 851 | 'basic_suites': { |
| 852 | 'foo_tests': { |
| 853 | 'foo_test': { |
| 854 | 'name': 'bar_test', |
| 855 | }, |
| 856 | }, |
| 857 | }, |
| 858 | } |
| 859 | """ |
| 860 | |
Garrett Beaty | dca3d88 | 2023-09-14 23:50:32 | [diff] [blame] | 861 | FOO_TEST_SUITE_WITH_ISOLATE_NAME = """\ |
| 862 | { |
| 863 | 'basic_suites': { |
| 864 | 'foo_tests': { |
| 865 | 'foo_test': { |
| 866 | 'isolate_name': 'bar_test', |
| 867 | }, |
| 868 | }, |
| 869 | }, |
| 870 | } |
| 871 | """ |
| 872 | |
Zhaoyang Li | 473dd0ae | 2021-05-10 18:28:28 | [diff] [blame] | 873 | FOO_TEST_SUITE_WITH_SWARMING_NAMED_CACHES = """\ |
| 874 | { |
| 875 | 'basic_suites': { |
| 876 | 'foo_tests': { |
| 877 | 'foo_test': { |
| 878 | 'swarming': { |
| 879 | 'named_caches': [ |
| 880 | { |
| 881 | 'name': 'cache_in_test', |
| 882 | 'file': 'cache_in_test_file', |
| 883 | }, |
| 884 | ], |
| 885 | }, |
| 886 | }, |
| 887 | }, |
| 888 | }, |
| 889 | } |
| 890 | """ |
| 891 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 892 | FOO_TEST_SUITE_WITH_LINUX_ARGS = """\ |
| 893 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 894 | 'basic_suites': { |
| 895 | 'foo_tests': { |
| 896 | 'foo_test': { |
| 897 | 'linux_args': [ |
| 898 | '--no-xvfb', |
| 899 | ], |
| 900 | }, |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 901 | }, |
| 902 | }, |
| 903 | } |
| 904 | """ |
| 905 | |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 906 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES = """\ |
| 907 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 908 | 'basic_suites': { |
| 909 | 'foo_tests': { |
| 910 | 'foo_test': { |
| 911 | 'args': [ |
| 912 | '--enable-features=Foo,Bar', |
| 913 | ], |
| 914 | }, |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 915 | }, |
| 916 | }, |
| 917 | } |
| 918 | """ |
| 919 | |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 920 | FOO_TEST_SUITE_WITH_REMOVE_WATERFALL_MIXIN = """\ |
| 921 | { |
| 922 | 'basic_suites': { |
| 923 | 'foo_tests': { |
| 924 | 'foo_test': { |
| 925 | 'remove_mixins': ['waterfall_mixin'], |
| 926 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 927 | 'dimensions': { |
| 928 | 'integrity': 'high', |
| 929 | }, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 930 | 'expiration': 120, |
| 931 | }, |
| 932 | }, |
| 933 | }, |
| 934 | }, |
| 935 | } |
| 936 | """ |
| 937 | |
| 938 | FOO_TEST_SUITE_WITH_REMOVE_BUILDER_MIXIN = """\ |
| 939 | { |
| 940 | 'basic_suites': { |
| 941 | 'foo_tests': { |
| 942 | 'foo_test': { |
| 943 | 'remove_mixins': ['builder_mixin'], |
| 944 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 945 | 'dimensions': { |
| 946 | 'integrity': 'high', |
| 947 | }, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 948 | 'expiration': 120, |
| 949 | }, |
| 950 | }, |
| 951 | }, |
| 952 | }, |
| 953 | } |
| 954 | """ |
| 955 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 956 | FOO_SCRIPT_SUITE = """\ |
| 957 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 958 | 'basic_suites': { |
| 959 | 'foo_scripts': { |
| 960 | 'foo_test': { |
| 961 | 'script': 'foo.py', |
| 962 | }, |
| 963 | 'bar_test': { |
| 964 | 'script': 'bar.py', |
| 965 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 966 | }, |
| 967 | }, |
| 968 | } |
| 969 | """ |
| 970 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 971 | GOOD_COMPOSITION_TEST_SUITES = """\ |
| 972 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 973 | 'basic_suites': { |
| 974 | 'bar_tests': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 975 | 'bar_test': { |
| 976 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 977 | 'dimensions': { |
| 978 | 'os': 'Linux', |
| 979 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 980 | }, |
| 981 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 982 | }, |
| 983 | 'foo_tests': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 984 | 'foo_test': { |
| 985 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 986 | 'dimensions': { |
| 987 | 'os': 'Linux', |
| 988 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 989 | }, |
| 990 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 991 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 992 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 993 | 'compound_suites': { |
| 994 | 'composition_tests': [ |
| 995 | 'foo_tests', |
| 996 | 'bar_tests', |
| 997 | ], |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 998 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 999 | } |
| 1000 | """ |
| 1001 | |
| 1002 | BAD_COMPOSITION_TEST_SUITES = """\ |
| 1003 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1004 | 'basic_suites': { |
| 1005 | 'bar_tests': {}, |
| 1006 | 'foo_tests': {}, |
| 1007 | }, |
| 1008 | 'compound_suites': { |
| 1009 | 'buggy_composition_tests': [ |
| 1010 | 'bar_tests', |
| 1011 | ], |
| 1012 | 'composition_tests': [ |
| 1013 | 'foo_tests', |
| 1014 | 'buggy_composition_tests', |
| 1015 | ], |
| 1016 | }, |
| 1017 | } |
| 1018 | """ |
| 1019 | |
Andrew Luo | 0f1dee0 | 2019-09-06 16:50:47 | [diff] [blame] | 1020 | CONFLICTING_COMPOSITION_TEST_SUITES = """\ |
| 1021 | { |
| 1022 | 'basic_suites': { |
| 1023 | 'bar_tests': { |
| 1024 | 'baz_tests': { |
| 1025 | 'args': [ |
| 1026 | '--bar', |
| 1027 | ], |
| 1028 | } |
| 1029 | }, |
| 1030 | 'foo_tests': { |
| 1031 | 'baz_tests': { |
| 1032 | 'args': [ |
| 1033 | '--foo', |
| 1034 | ], |
| 1035 | } |
| 1036 | }, |
| 1037 | }, |
| 1038 | 'compound_suites': { |
| 1039 | 'foobar_tests': [ |
| 1040 | 'foo_tests', |
| 1041 | 'bar_tests', |
| 1042 | ], |
| 1043 | }, |
| 1044 | } |
| 1045 | """ |
| 1046 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1047 | DUPLICATES_COMPOSITION_TEST_SUITES = """\ |
| 1048 | { |
| 1049 | 'basic_suites': { |
| 1050 | 'bar_tests': {}, |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 1051 | 'buggy_composition_tests': {}, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1052 | 'foo_tests': {}, |
| 1053 | }, |
| 1054 | 'compound_suites': { |
| 1055 | 'bar_tests': [ |
| 1056 | 'foo_tests', |
| 1057 | ], |
| 1058 | 'composition_tests': [ |
| 1059 | 'foo_tests', |
| 1060 | 'buggy_composition_tests', |
| 1061 | ], |
| 1062 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1063 | } |
| 1064 | """ |
| 1065 | |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1066 | SCRIPT_SUITE = """\ |
| 1067 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1068 | 'basic_suites': { |
| 1069 | 'foo_scripts': { |
| 1070 | 'foo_test': { |
| 1071 | 'script': 'foo.py', |
| 1072 | }, |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1073 | }, |
| 1074 | }, |
| 1075 | } |
| 1076 | """ |
| 1077 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1078 | UNREFED_TEST_SUITE = """\ |
| 1079 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1080 | 'basic_suites': { |
| 1081 | 'bar_tests': {}, |
| 1082 | 'foo_tests': {}, |
| 1083 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1084 | } |
| 1085 | """ |
| 1086 | |
| 1087 | REUSING_TEST_WITH_DIFFERENT_NAME = """\ |
| 1088 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1089 | 'basic_suites': { |
| 1090 | 'foo_tests': { |
| 1091 | 'foo_test': {}, |
| 1092 | 'variation_test': { |
| 1093 | 'args': [ |
| 1094 | '--variation', |
| 1095 | ], |
| 1096 | 'test': 'foo_test', |
| 1097 | }, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1098 | }, |
| 1099 | }, |
| 1100 | } |
| 1101 | """ |
| 1102 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 1103 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST_WITH_INVALID_NAME = """\ |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1104 | { |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1105 | 'basic_suites': { |
| 1106 | 'foo_tests': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1107 | 'foo': { |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 1108 | 'telemetry_test_name': 'foo', |
| 1109 | 'swarming': { |
| 1110 | 'dimensions': { |
| 1111 | 'os': 'Linux', |
| 1112 | }, |
| 1113 | }, |
| 1114 | }, |
| 1115 | }, |
| 1116 | }, |
| 1117 | 'compound_suites': { |
| 1118 | 'composition_tests': [ |
| 1119 | 'foo_tests', |
| 1120 | ], |
| 1121 | }, |
| 1122 | } |
| 1123 | """ |
| 1124 | |
| 1125 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST = """\ |
| 1126 | { |
| 1127 | 'basic_suites': { |
| 1128 | 'foo_tests': { |
| 1129 | 'foo_tests': { |
| 1130 | 'telemetry_test_name': 'foo', |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1131 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1132 | 'dimensions': { |
| 1133 | 'os': 'Linux', |
| 1134 | }, |
Xinan Lin | edcf05b3 | 2023-10-19 23:13:50 | [diff] [blame] | 1135 | 'shards': 2, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1136 | }, |
| 1137 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1138 | }, |
| 1139 | 'bar_tests': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1140 | 'bar_test': { |
| 1141 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1142 | 'dimensions': { |
| 1143 | 'os': 'Linux', |
| 1144 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1145 | }, |
| 1146 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1147 | }, |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1148 | }, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1149 | 'compound_suites': { |
| 1150 | 'composition_tests': [ |
| 1151 | 'foo_tests', |
| 1152 | 'bar_tests', |
| 1153 | ], |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1154 | }, |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1155 | } |
| 1156 | """ |
| 1157 | |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 1158 | COMPOSITION_SUITE_WITH_GPU_ARGS = """\ |
| 1159 | { |
| 1160 | 'basic_suites': { |
| 1161 | 'foo_tests': { |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 1162 | 'foo_tests': { |
| 1163 | 'telemetry_test_name': 'foo', |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1164 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1165 | 'dimensions': { |
| 1166 | 'os': 'Linux', |
| 1167 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1168 | }, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 1169 | 'args': [ |
| 1170 | '--gpu-vendor-id', |
| 1171 | '${gpu_vendor_id}', |
| 1172 | '--gpu-device-id', |
| 1173 | '${gpu_device_id}', |
| 1174 | ], |
| 1175 | }, |
| 1176 | }, |
| 1177 | 'bar_tests': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1178 | 'bar_test': { |
| 1179 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1180 | 'dimensions': { |
| 1181 | 'os': 'Linux', |
| 1182 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 1183 | }, |
| 1184 | }, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 1185 | }, |
| 1186 | }, |
| 1187 | 'compound_suites': { |
| 1188 | 'composition_tests': [ |
| 1189 | 'foo_tests', |
| 1190 | 'bar_tests', |
| 1191 | ], |
| 1192 | }, |
| 1193 | } |
| 1194 | """ |
| 1195 | |
Brian Sheedy | d8c0c73d | 2021-07-05 02:11:30 | [diff] [blame] | 1196 | COMPOSITION_SUITE_WITH_PIXEL_AND_FILTER = """\ |
| 1197 | { |
| 1198 | 'basic_suites': { |
| 1199 | 'foo_tests': { |
| 1200 | 'pixel': { |
| 1201 | 'args': [ |
| 1202 | '--git-revision=aaaa', |
| 1203 | '--test-filter=bar', |
| 1204 | ], |
| 1205 | }, |
| 1206 | }, |
| 1207 | 'bar_tests': { |
| 1208 | 'bar_test': {}, |
| 1209 | }, |
| 1210 | }, |
| 1211 | 'compound_suites': { |
| 1212 | 'composition_tests': [ |
| 1213 | 'foo_tests', |
| 1214 | 'bar_tests', |
| 1215 | ], |
| 1216 | }, |
| 1217 | } |
| 1218 | """ |
| 1219 | |
Jamie Madill | a8be0d7 | 2020-10-02 05:24:04 | [diff] [blame] | 1220 | GTEST_AS_ISOLATED_SCRIPT_SUITE = """\ |
| 1221 | { |
| 1222 | 'basic_suites': { |
| 1223 | 'foo_tests': { |
| 1224 | 'foo_test': { |
| 1225 | 'script': 'foo.py', |
| 1226 | 'use_isolated_scripts_api': True, |
| 1227 | }, |
| 1228 | }, |
| 1229 | }, |
| 1230 | } |
| 1231 | """ |
| 1232 | |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1233 | SCRIPT_WITH_ARGS_EXCEPTIONS = """\ |
| 1234 | { |
| 1235 | 'foo_test': { |
| 1236 | 'modifications': { |
| 1237 | 'Fake Tester': { |
| 1238 | 'args': ['--fake-arg'], |
| 1239 | }, |
| 1240 | }, |
| 1241 | }, |
| 1242 | } |
| 1243 | """ |
| 1244 | |
Stephen Martinis | 0382bc1 | 2018-09-17 22:29:07 | [diff] [blame] | 1245 | SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS = """\ |
| 1246 | { |
| 1247 | 'foo_test': { |
| 1248 | 'modifications': { |
| 1249 | 'Fake Tester': { |
| 1250 | 'swarming': { |
| 1251 | 'value': 'exception', |
| 1252 | }, |
| 1253 | }, |
| 1254 | }, |
| 1255 | }, |
| 1256 | } |
| 1257 | """ |
| 1258 | |
Stephanie Kim | 572b43c0 | 2023-04-13 14:24:13 | [diff] [blame] | 1259 | AUTOSHARD_EXCEPTIONS = json.dumps({ |
| 1260 | 'chromium.test': { |
| 1261 | 'Fake Tester': { |
| 1262 | 'foo_test': { |
| 1263 | 'shards': 20, |
| 1264 | }, |
| 1265 | 'foo_test_apk': { |
| 1266 | 'shards': 2, |
| 1267 | }, |
| 1268 | 'swarming_test a_variant': { |
| 1269 | 'shards': 10, |
| 1270 | }, |
| 1271 | } |
| 1272 | }, |
| 1273 | }) |
| 1274 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1275 | NO_BAR_TEST_EXCEPTIONS = """\ |
| 1276 | { |
| 1277 | 'bar_test': { |
| 1278 | 'remove_from': [ |
| 1279 | 'Fake Tester', |
| 1280 | ] |
| 1281 | } |
| 1282 | } |
| 1283 | """ |
| 1284 | |
| 1285 | EMPTY_BAR_TEST_EXCEPTIONS = """\ |
| 1286 | { |
| 1287 | 'bar_test': { |
| 1288 | } |
| 1289 | } |
| 1290 | """ |
| 1291 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1292 | EXCEPTIONS_SORTED = """\ |
| 1293 | { |
| 1294 | 'suite_c': { |
| 1295 | 'modifications': { |
| 1296 | 'Fake Tester': { |
| 1297 | 'foo': 'bar', |
| 1298 | }, |
| 1299 | }, |
| 1300 | }, |
| 1301 | 'suite_d': { |
| 1302 | 'modifications': { |
| 1303 | 'Fake Tester': { |
| 1304 | 'foo': 'baz', |
| 1305 | }, |
| 1306 | }, |
| 1307 | }, |
| 1308 | } |
| 1309 | """ |
| 1310 | |
| 1311 | EXCEPTIONS_UNSORTED = """\ |
| 1312 | { |
| 1313 | 'suite_d': { |
| 1314 | 'modifications': { |
| 1315 | 'Fake Tester': { |
| 1316 | 'foo': 'baz', |
| 1317 | }, |
| 1318 | }, |
| 1319 | }, |
| 1320 | 'suite_c': { |
| 1321 | 'modifications': { |
| 1322 | 'Fake Tester': { |
| 1323 | 'foo': 'bar', |
| 1324 | }, |
| 1325 | }, |
| 1326 | }, |
| 1327 | } |
| 1328 | """ |
| 1329 | |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 1330 | EXCEPTIONS_PER_TEST_UNSORTED = """\ |
| 1331 | { |
| 1332 | 'suite_d': { |
| 1333 | 'modifications': { |
| 1334 | 'Other Tester': { |
| 1335 | 'foo': 'baz', |
| 1336 | }, |
| 1337 | 'Fake Tester': { |
| 1338 | 'foo': 'baz', |
| 1339 | }, |
| 1340 | }, |
| 1341 | }, |
| 1342 | } |
| 1343 | """ |
| 1344 | |
| 1345 | EXCEPTIONS_DUPS_REMOVE_FROM = """\ |
| 1346 | { |
| 1347 | 'suite_d': { |
| 1348 | 'remove_from': [ |
| 1349 | 'Fake Tester', |
| 1350 | 'Fake Tester', |
| 1351 | ], |
| 1352 | 'modifications': { |
| 1353 | 'Fake Tester': { |
| 1354 | 'foo': 'baz', |
| 1355 | }, |
| 1356 | }, |
| 1357 | }, |
| 1358 | } |
| 1359 | """ |
| 1360 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1361 | FOO_TEST_MODIFICATIONS = """\ |
| 1362 | { |
| 1363 | 'foo_test': { |
| 1364 | 'modifications': { |
| 1365 | 'Fake Tester': { |
| 1366 | 'args': [ |
| 1367 | '--bar', |
| 1368 | ], |
| 1369 | 'swarming': { |
| 1370 | 'hard_timeout': 600, |
| 1371 | }, |
| 1372 | }, |
| 1373 | }, |
| 1374 | } |
| 1375 | } |
| 1376 | """ |
| 1377 | |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1378 | FOO_TEST_EXPLICIT_NONE_EXCEPTIONS = """\ |
| 1379 | { |
| 1380 | 'foo_test': { |
| 1381 | 'modifications': { |
| 1382 | 'Fake Tester': { |
| 1383 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1384 | 'dimensions': { |
| 1385 | 'integrity': None, |
| 1386 | }, |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1387 | }, |
| 1388 | }, |
| 1389 | }, |
| 1390 | }, |
| 1391 | } |
| 1392 | """ |
| 1393 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1394 | NONEXISTENT_REMOVAL = """\ |
| 1395 | { |
| 1396 | 'foo_test': { |
| 1397 | 'remove_from': [ |
| 1398 | 'Nonexistent Tester', |
| 1399 | ] |
| 1400 | } |
| 1401 | } |
| 1402 | """ |
| 1403 | |
| 1404 | NONEXISTENT_MODIFICATION = """\ |
| 1405 | { |
| 1406 | 'foo_test': { |
| 1407 | 'modifications': { |
| 1408 | 'Nonexistent Tester': { |
| 1409 | 'args': [], |
| 1410 | }, |
| 1411 | }, |
| 1412 | } |
| 1413 | } |
| 1414 | """ |
| 1415 | |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1416 | LUCI_MILO_CFG = """\ |
| 1417 | consoles { |
| 1418 | builders { |
| 1419 | name: "buildbucket/luci.chromium.ci/Fake Tester" |
| 1420 | } |
| 1421 | } |
| 1422 | """ |
| 1423 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1424 | LUCI_MILO_CFG_WATERFALL_SORTING = """\ |
| 1425 | consoles { |
| 1426 | builders { |
| 1427 | name: "buildbucket/luci.chromium.ci/Fake Tester" |
| 1428 | name: "buildbucket/luci.chromium.ci/Really Fake Tester" |
| 1429 | } |
| 1430 | } |
| 1431 | """ |
| 1432 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1433 | TEST_SUITE_SORTING_WATERFALL = """ |
| 1434 | [ |
| 1435 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1436 | 'project': 'chromium', |
| 1437 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1438 | 'name': 'chromium.test', |
| 1439 | 'machines': { |
| 1440 | 'Fake Tester': { |
| 1441 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1442 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1443 | 'scripts': 'suite_b', |
| 1444 | }, |
| 1445 | }, |
| 1446 | }, |
| 1447 | }, |
| 1448 | ] |
| 1449 | """ |
| 1450 | |
| 1451 | TEST_SUITE_SORTED_WATERFALL = """ |
| 1452 | [ |
| 1453 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1454 | 'project': 'chromium', |
| 1455 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1456 | 'name': 'chromium.test', |
| 1457 | 'machines': { |
| 1458 | 'Fake Tester': { |
| 1459 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1460 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1461 | 'scripts': 'suite_b', |
| 1462 | }, |
| 1463 | }, |
| 1464 | 'Really Fake Tester': { |
| 1465 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1466 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1467 | 'scripts': 'suite_b', |
| 1468 | }, |
| 1469 | }, |
| 1470 | }, |
| 1471 | }, |
| 1472 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1473 | 'project': 'chromium', |
| 1474 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1475 | 'name': 'chromium.zz.test', |
| 1476 | 'machines': { |
| 1477 | 'Fake Tester': { |
| 1478 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1479 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1480 | 'scripts': 'suite_b', |
| 1481 | }, |
| 1482 | }, |
| 1483 | 'Really Fake Tester': { |
| 1484 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1485 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1486 | 'scripts': 'suite_b', |
| 1487 | }, |
| 1488 | }, |
| 1489 | }, |
| 1490 | }, |
| 1491 | ] |
| 1492 | """ |
| 1493 | |
| 1494 | TEST_SUITE_UNSORTED_WATERFALL_1 = """ |
| 1495 | [ |
| 1496 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1497 | 'project': 'chromium', |
| 1498 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1499 | 'name': 'chromium.zz.test', |
| 1500 | 'machines': { |
| 1501 | 'Fake Tester': { |
| 1502 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1503 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1504 | 'scripts': 'suite_b', |
| 1505 | }, |
| 1506 | }, |
| 1507 | 'Really Fake Tester': { |
| 1508 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1509 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1510 | 'scripts': 'suite_b', |
| 1511 | }, |
| 1512 | }, |
| 1513 | }, |
| 1514 | }, |
| 1515 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1516 | 'project': 'chromium', |
| 1517 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1518 | 'name': 'chromium.test', |
| 1519 | 'machines': { |
| 1520 | 'Fake Tester': { |
| 1521 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1522 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1523 | 'scripts': 'suite_b', |
| 1524 | }, |
| 1525 | }, |
| 1526 | 'Really Fake Tester': { |
| 1527 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1528 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1529 | 'scripts': 'suite_b', |
| 1530 | }, |
| 1531 | }, |
| 1532 | }, |
| 1533 | }, |
| 1534 | ] |
| 1535 | """ |
| 1536 | |
| 1537 | TEST_SUITE_UNSORTED_WATERFALL_2 = """ |
| 1538 | [ |
| 1539 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1540 | 'project': 'chromium', |
| 1541 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1542 | 'name': 'chromium.test', |
| 1543 | 'machines': { |
| 1544 | 'Really Fake Tester': { |
| 1545 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1546 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1547 | 'scripts': 'suite_b', |
| 1548 | }, |
| 1549 | }, |
| 1550 | 'Fake Tester': { |
| 1551 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1552 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1553 | 'scripts': 'suite_b', |
| 1554 | }, |
| 1555 | }, |
| 1556 | }, |
| 1557 | }, |
| 1558 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 1559 | 'project': 'chromium', |
| 1560 | 'bucket': 'ci', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1561 | 'name': 'chromium.zz.test', |
| 1562 | 'machines': { |
| 1563 | 'Fake Tester': { |
| 1564 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1565 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1566 | 'scripts': 'suite_b', |
| 1567 | }, |
| 1568 | }, |
| 1569 | 'Really Fake Tester': { |
| 1570 | 'test_suites': { |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1571 | 'gtest_tests': 'suite_a', |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1572 | 'scripts': 'suite_b', |
| 1573 | }, |
| 1574 | }, |
| 1575 | }, |
| 1576 | }, |
| 1577 | ] |
| 1578 | """ |
| 1579 | |
| 1580 | # Note that the suites in basic_suites would be sorted after the suites in |
| 1581 | # compound_suites. This is valid though, because each set of suites is sorted |
| 1582 | # separately. |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1583 | # suite_c is a 'gtest_tests' test |
| 1584 | # suite_d is a 'scripts' test |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1585 | TEST_SUITE_SORTED = """\ |
| 1586 | { |
| 1587 | 'basic_suites': { |
| 1588 | 'suite_c': { |
| 1589 | 'suite_c': {}, |
| 1590 | }, |
| 1591 | 'suite_d': { |
| 1592 | 'script': { |
| 1593 | 'script': 'suite_d.py', |
| 1594 | } |
| 1595 | }, |
| 1596 | }, |
| 1597 | 'compound_suites': { |
| 1598 | 'suite_a': [ |
| 1599 | 'suite_c', |
| 1600 | ], |
| 1601 | 'suite_b': [ |
| 1602 | 'suite_d', |
| 1603 | ], |
| 1604 | }, |
| 1605 | } |
| 1606 | """ |
| 1607 | |
| 1608 | TEST_SUITE_UNSORTED_1 = """\ |
| 1609 | { |
| 1610 | 'basic_suites': { |
| 1611 | 'suite_d': { |
| 1612 | 'a': 'b', |
| 1613 | }, |
| 1614 | 'suite_c': { |
| 1615 | 'a': 'b', |
| 1616 | }, |
| 1617 | }, |
| 1618 | 'compound_suites': { |
| 1619 | 'suite_a': [ |
| 1620 | 'suite_c', |
| 1621 | ], |
| 1622 | 'suite_b': [ |
| 1623 | 'suite_d', |
| 1624 | ], |
| 1625 | }, |
| 1626 | } |
| 1627 | """ |
| 1628 | |
| 1629 | TEST_SUITE_UNSORTED_2 = """\ |
| 1630 | { |
| 1631 | 'basic_suites': { |
| 1632 | 'suite_c': { |
| 1633 | 'a': 'b', |
| 1634 | }, |
| 1635 | 'suite_d': { |
| 1636 | 'a': 'b', |
| 1637 | }, |
| 1638 | }, |
| 1639 | 'compound_suites': { |
| 1640 | 'suite_b': [ |
| 1641 | 'suite_c', |
| 1642 | ], |
| 1643 | 'suite_a': [ |
| 1644 | 'suite_d', |
| 1645 | ], |
| 1646 | }, |
| 1647 | } |
| 1648 | """ |
| 1649 | TEST_SUITE_UNSORTED_3 = """\ |
| 1650 | { |
| 1651 | 'basic_suites': { |
| 1652 | 'suite_d': { |
| 1653 | 'a': 'b', |
| 1654 | }, |
| 1655 | 'suite_c': { |
| 1656 | 'a': 'b', |
| 1657 | }, |
| 1658 | }, |
| 1659 | 'compound_suites': { |
| 1660 | 'suite_b': [ |
| 1661 | 'suite_c', |
| 1662 | ], |
| 1663 | 'suite_a': [ |
| 1664 | 'suite_d', |
| 1665 | ], |
| 1666 | }, |
| 1667 | } |
| 1668 | """ |
| 1669 | |
| 1670 | |
| 1671 | TEST_SUITES_SYNTAX_ERROR = """\ |
| 1672 | { |
| 1673 | 'basic_suites': { |
| 1674 | 3: { |
| 1675 | 'suite_c': {}, |
| 1676 | }, |
| 1677 | }, |
| 1678 | 'compound_suites': {}, |
| 1679 | } |
| 1680 | """ |
| 1681 | |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1682 | GN_ISOLATE_MAP="""\ |
| 1683 | { |
| 1684 | 'foo_test': { |
| 1685 | 'label': '//chrome/test:foo_test', |
| 1686 | 'type': 'windowed_test_launcher', |
| 1687 | } |
| 1688 | } |
| 1689 | """ |
| 1690 | |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 1691 | GPU_TELEMETRY_GN_ISOLATE_MAP="""\ |
| 1692 | { |
| 1693 | 'telemetry_gpu_integration_test': { |
| 1694 | 'label': '//chrome/test:telemetry_gpu_integration_test', |
| 1695 | 'type': 'script', |
| 1696 | } |
| 1697 | } |
| 1698 | """ |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 1699 | |
| 1700 | GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID = """\ |
| 1701 | { |
| 1702 | 'telemetry_gpu_integration_test_android_chrome': { |
| 1703 | 'label': '//chrome/test:telemetry_gpu_integration_test_android_chrome', |
| 1704 | 'type': 'script', |
| 1705 | } |
| 1706 | } |
| 1707 | """ |
| 1708 | |
| 1709 | GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID_WEBVIEW = """\ |
| 1710 | { |
| 1711 | 'telemetry_gpu_integration_test_android_webview': { |
| 1712 | 'label': '//chrome/test:telemetry_gpu_integration_test_android_webview', |
| 1713 | 'type': 'script', |
| 1714 | } |
| 1715 | } |
| 1716 | """ |
| 1717 | |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 1718 | GPU_TELEMETRY_GN_ISOLATE_MAP_FUCHSIA = """\ |
| 1719 | { |
| 1720 | 'telemetry_gpu_integration_test_fuchsia': { |
| 1721 | 'label': '//chrome/test:telemetry_gpu_integration_test_fuchsia', |
| 1722 | 'type': 'script', |
| 1723 | } |
| 1724 | } |
| 1725 | """ |
| 1726 | |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 1727 | GPU_TELEMETRY_GN_ISOLATE_MAP_CAST_STREAMING = """\ |
| 1728 | { |
| 1729 | 'telemetry_gpu_integration_test_fuchsia': { |
| 1730 | 'label': '//chrome/test:telemetry_gpu_integration_test_fuchsia', |
| 1731 | 'type': 'script', |
| 1732 | } |
| 1733 | } |
| 1734 | """ |
| 1735 | |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1736 | GN_ISOLATE_MAP_KEY_LABEL_MISMATCH="""\ |
| 1737 | { |
| 1738 | 'foo_test': { |
| 1739 | 'label': '//chrome/test:foo_test_tmp', |
| 1740 | 'type': 'windowed_test_launcher', |
| 1741 | } |
| 1742 | } |
| 1743 | """ |
| 1744 | |
| 1745 | GN_ISOLATE_MAP_USING_IMPLICIT_NAME="""\ |
| 1746 | { |
| 1747 | 'foo_test': { |
| 1748 | 'label': '//chrome/foo_test', |
| 1749 | 'type': 'windowed_test_launcher', |
| 1750 | } |
| 1751 | } |
| 1752 | """ |
| 1753 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1754 | class UnitTest(TestCase): |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1755 | |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1756 | def test_dimension_sets_causes_error(self): |
| 1757 | fbb = FakeBBGen(self.args, FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 1758 | FOO_TEST_SUITE_WITH_SWARMING_DIMENSION_SETS, LUCI_MILO_CFG) |
| 1759 | fbb.check_input_file_consistency(verbose=True) |
| 1760 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1761 | r'.*dimension_sets is no longer supported.*'): |
| 1762 | fbb.check_output_file_consistency(verbose=True) |
| 1763 | self.assertFalse(fbb.printed_lines) |
| 1764 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 1765 | def test_name_causes_error(self): |
| 1766 | fbb = FakeBBGen(self.args, FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 1767 | FOO_TEST_SUITE_WITH_NAME, LUCI_MILO_CFG) |
| 1768 | fbb.check_input_file_consistency(verbose=True) |
| 1769 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
Garrett Beaty | dca3d88 | 2023-09-14 23:50:32 | [diff] [blame] | 1770 | r'.*\bname field is set\b.*'): |
| 1771 | fbb.check_output_file_consistency(verbose=True) |
| 1772 | self.assertFalse(fbb.printed_lines) |
| 1773 | |
| 1774 | def test_isolate_name_causes_error(self): |
| 1775 | fbb = FakeBBGen(self.args, FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 1776 | FOO_TEST_SUITE_WITH_ISOLATE_NAME, LUCI_MILO_CFG) |
| 1777 | fbb.check_input_file_consistency(verbose=True) |
| 1778 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1779 | r'.*\bisolate_name field is set\b.*'): |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 1780 | fbb.check_output_file_consistency(verbose=True) |
| 1781 | self.assertFalse(fbb.printed_lines) |
| 1782 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1783 | def test_good_test_suites_are_ok(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1784 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1785 | LUCI_MILO_CFG) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1786 | fbb.check_input_file_consistency(verbose=True) |
| 1787 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1788 | |
| 1789 | def test_good_composition_test_suites_are_ok(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1790 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1791 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1792 | fbb.check_input_file_consistency(verbose=True) |
| 1793 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1794 | |
| 1795 | def test_bad_composition_test_suites_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1796 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1797 | BAD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1798 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1799 | 'compound_suites may not refer to.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1800 | fbb.check_input_file_consistency(verbose=True) |
| 1801 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1802 | |
Andrew Luo | 0f1dee0 | 2019-09-06 16:50:47 | [diff] [blame] | 1803 | def test_composition_test_suites_no_conflicts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1804 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1805 | CONFLICTING_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1806 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1807 | 'Conflicting test definitions.*'): |
Andrew Luo | 0f1dee0 | 2019-09-06 16:50:47 | [diff] [blame] | 1808 | fbb.check_input_file_consistency(verbose=True) |
| 1809 | self.assertFalse(fbb.printed_lines) |
| 1810 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1811 | def test_composition_test_suites_no_duplicate_names(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1812 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1813 | DUPLICATES_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1814 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1815 | '.*may not duplicate basic test suite.*'): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1816 | fbb.check_input_file_consistency(verbose=True) |
| 1817 | self.assertFalse(fbb.printed_lines) |
| 1818 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1819 | def test_unknown_test_suites_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1820 | fbb = FakeBBGen(self.args, UNKNOWN_TEST_SUITE_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1821 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1822 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1823 | 'Test suite baz_tests from machine.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1824 | fbb.check_input_file_consistency(verbose=True) |
| 1825 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1826 | |
| 1827 | def test_unknown_test_suite_types_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1828 | fbb = FakeBBGen(self.args, UNKNOWN_TEST_SUITE_TYPE_WATERFALL, |
| 1829 | FOO_TEST_SUITE, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1830 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1831 | 'Unknown test suite type foo_test_type.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1832 | fbb.check_input_file_consistency(verbose=True) |
| 1833 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1834 | |
| 1835 | def test_unrefed_test_suite_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1836 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, UNREFED_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1837 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1838 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1839 | '.*unreferenced.*bar_tests.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1840 | fbb.check_input_file_consistency(verbose=True) |
| 1841 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1842 | |
| 1843 | def test_good_waterfall_output(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1844 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1845 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1846 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1847 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1848 | |
| 1849 | def test_reusing_gtest_targets(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1850 | fbb = FakeBBGen(self.args, |
| 1851 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1852 | REUSING_TEST_WITH_DIFFERENT_NAME, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1853 | LUCI_MILO_CFG, |
| 1854 | gn_isolate_map=GN_ISOLATE_MAP) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1855 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1856 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1857 | |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1858 | def test_load_multiple_isolate_map_files_with_duplicates(self): |
| 1859 | self.args.isolate_map_files = ['gn_isolate_map.pyl'] |
| 1860 | fbb = FakeBBGen(self.args, |
| 1861 | FOO_GTESTS_WATERFALL, |
| 1862 | REUSING_TEST_WITH_DIFFERENT_NAME, |
| 1863 | LUCI_MILO_CFG, |
| 1864 | gn_isolate_map=GN_ISOLATE_MAP) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1865 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1866 | 'Duplicate targets in isolate map files.*'): |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1867 | fbb.load_configuration_files() |
| 1868 | |
| 1869 | def test_load_multiple_isolate_map_files_without_duplicates(self): |
| 1870 | self.args.isolate_map_files = ['gn_isolate_map2.pyl'] |
| 1871 | fbb = FakeBBGen(self.args, |
| 1872 | FOO_GTESTS_WATERFALL, |
| 1873 | REUSING_TEST_WITH_DIFFERENT_NAME, |
| 1874 | LUCI_MILO_CFG, |
| 1875 | gn_isolate_map=GN_ISOLATE_MAP) |
| 1876 | fbb.load_configuration_files() |
| 1877 | isolate_dict = {} |
| 1878 | isolate_map_1 = fbb.load_pyl_file('gn_isolate_map.pyl') |
| 1879 | isolate_map_2 = fbb.load_pyl_file('gn_isolate_map2.pyl') |
| 1880 | isolate_dict.update(isolate_map_1) |
| 1881 | isolate_dict.update(isolate_map_2) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1882 | self.assertEqual(isolate_dict, fbb.gn_isolate_map) |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1883 | |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1884 | def test_gn_isolate_map_with_label_mismatch(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1885 | fbb = FakeBBGen(self.args, |
| 1886 | FOO_GTESTS_WATERFALL, |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1887 | FOO_TEST_SUITE, |
| 1888 | LUCI_MILO_CFG, |
| 1889 | gn_isolate_map=GN_ISOLATE_MAP_KEY_LABEL_MISMATCH) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1890 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1891 | 'key name.*foo_test.*label.*' |
| 1892 | 'foo_test_tmp.*'): |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1893 | fbb.check_input_file_consistency(verbose=True) |
| 1894 | self.assertFalse(fbb.printed_lines) |
| 1895 | |
| 1896 | def test_gn_isolate_map_using_implicit_gn_name(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1897 | fbb = FakeBBGen(self.args, |
| 1898 | FOO_GTESTS_WATERFALL, |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1899 | FOO_TEST_SUITE, |
| 1900 | LUCI_MILO_CFG, |
| 1901 | gn_isolate_map=GN_ISOLATE_MAP_USING_IMPLICIT_NAME) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1902 | with self.assertRaisesRegex( |
| 1903 | generate_buildbot_json.BBGenErr, |
| 1904 | 'Malformed.*//chrome/foo_test.*for key.*' |
| 1905 | 'foo_test.*'): |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1906 | fbb.check_input_file_consistency(verbose=True) |
| 1907 | self.assertFalse(fbb.printed_lines) |
| 1908 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1909 | def test_noop_exception_does_nothing(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1910 | fbb = FakeBBGen(self.args, |
| 1911 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1912 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1913 | LUCI_MILO_CFG, |
| 1914 | exceptions=EMPTY_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1915 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1916 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1917 | |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1918 | def test_test_arg_merges(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1919 | fbb = FakeBBGen(self.args, |
| 1920 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1921 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1922 | LUCI_MILO_CFG, |
| 1923 | exceptions=FOO_TEST_MODIFICATIONS) |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1924 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1925 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1926 | |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1927 | def test_enable_features_arg_merges(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1928 | fbb = FakeBBGen(self.args, FOO_GTESTS_WITH_ENABLE_FEATURES_WATERFALL, |
| 1929 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, LUCI_MILO_CFG) |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1930 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1931 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1932 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1933 | def test_linux_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1934 | fbb = FakeBBGen(self.args, FOO_LINUX_GTESTS_WATERFALL, |
| 1935 | FOO_TEST_SUITE_WITH_LINUX_ARGS, LUCI_MILO_CFG) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1936 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1937 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1938 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1939 | def test_test_filtering(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1940 | fbb = FakeBBGen(self.args, |
| 1941 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1942 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1943 | LUCI_MILO_CFG, |
| 1944 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1945 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1946 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1947 | |
| 1948 | def test_test_modifications(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1949 | fbb = FakeBBGen(self.args, |
| 1950 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1951 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1952 | LUCI_MILO_CFG, |
| 1953 | exceptions=FOO_TEST_MODIFICATIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1954 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1955 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1956 | |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1957 | def test_test_with_explicit_none(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1958 | fbb = FakeBBGen(self.args, |
| 1959 | FOO_GTESTS_WATERFALL, |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1960 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1961 | LUCI_MILO_CFG, |
| 1962 | exceptions=FOO_TEST_EXPLICIT_NONE_EXCEPTIONS, |
| 1963 | mixins=SWARMING_MIXINS) |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1964 | fbb.check_output_file_consistency(verbose=True) |
| 1965 | self.assertFalse(fbb.printed_lines) |
| 1966 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1967 | def test_isolated_script_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1968 | fbb = FakeBBGen(self.args, |
| 1969 | FOO_ISOLATED_SCRIPTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1970 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1971 | LUCI_MILO_CFG, |
| 1972 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1973 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1974 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1975 | |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 1976 | def test_isolated_script_tests_android(self): |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1977 | fbb = FakeBBGen(self.args, |
| 1978 | FOO_ISOLATED_SCRIPTS_WATERFALL_ANDROID, |
| 1979 | GOOD_COMPOSITION_TEST_SUITES, |
| 1980 | LUCI_MILO_CFG, |
| 1981 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1982 | fbb.check_output_file_consistency(verbose=True) |
| 1983 | self.assertFalse(fbb.printed_lines) |
| 1984 | |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1985 | def test_script_with_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1986 | fbb = FakeBBGen(self.args, |
| 1987 | FOO_SCRIPT_WATERFALL, |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1988 | SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1989 | LUCI_MILO_CFG, |
| 1990 | exceptions=SCRIPT_WITH_ARGS_EXCEPTIONS) |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1991 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1992 | self.assertFalse(fbb.printed_lines) |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1993 | |
| 1994 | def test_script(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1995 | fbb = FakeBBGen(self.args, |
| 1996 | FOO_SCRIPT_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1997 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1998 | LUCI_MILO_CFG, |
| 1999 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2000 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2001 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2002 | |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 2003 | def test_script_machine_forbids_scripts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2004 | fbb = FakeBBGen(self.args, |
| 2005 | FOO_SCRIPT_WATERFALL_MACHINE_FORBIDS_SCRIPT_TESTS, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 2006 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2007 | LUCI_MILO_CFG, |
| 2008 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2009 | with self.assertRaisesRegex( |
| 2010 | generate_buildbot_json.BBGenErr, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 2011 | 'Attempted to generate a script test on tester.*'): |
| 2012 | fbb.check_output_file_consistency(verbose=True) |
| 2013 | |
| 2014 | def test_script_waterfall_forbids_scripts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2015 | fbb = FakeBBGen(self.args, |
| 2016 | FOO_SCRIPT_WATERFALL_FORBID_SCRIPT_TESTS, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 2017 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2018 | LUCI_MILO_CFG, |
| 2019 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2020 | with self.assertRaisesRegex( |
| 2021 | generate_buildbot_json.BBGenErr, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 2022 | 'Attempted to generate a script test on tester.*'): |
| 2023 | fbb.check_output_file_consistency(verbose=True) |
| 2024 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2025 | def test_junit_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2026 | fbb = FakeBBGen(self.args, |
| 2027 | FOO_JUNIT_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2028 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2029 | LUCI_MILO_CFG, |
| 2030 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2031 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2032 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2033 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2034 | def test_gpu_telemetry_test_with_invalid_name(self): |
| 2035 | fbb = FakeBBGen(self.args, |
| 2036 | FOO_GPU_TELEMETRY_TEST_WATERFALL, |
| 2037 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST_WITH_INVALID_NAME, |
| 2038 | LUCI_MILO_CFG, |
| 2039 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2040 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
| 2041 | with self.assertRaisesRegex( |
| 2042 | generate_buildbot_json.BBGenErr, |
| 2043 | 'telemetry test names must end with test or tests.*'): |
| 2044 | fbb.check_output_file_consistency(verbose=True) |
| 2045 | self.assertFalse(fbb.printed_lines) |
| 2046 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2047 | def test_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2048 | fbb = FakeBBGen(self.args, |
| 2049 | FOO_GPU_TELEMETRY_TEST_WATERFALL, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2050 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2051 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2052 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2053 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2054 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2055 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2056 | |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2057 | def test_gpu_telemetry_tests_android(self): |
| 2058 | fbb = FakeBBGen(self.args, |
| 2059 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2060 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2061 | LUCI_MILO_CFG, |
| 2062 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2063 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID) |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2064 | fbb.check_output_file_consistency(verbose=True) |
| 2065 | self.assertFalse(fbb.printed_lines) |
| 2066 | |
| 2067 | def test_gpu_telemetry_tests_android_webview(self): |
| 2068 | fbb = FakeBBGen(self.args, |
| 2069 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID_WEBVIEW, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2070 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2071 | LUCI_MILO_CFG, |
| 2072 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2073 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID_WEBVIEW) |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2074 | fbb.check_output_file_consistency(verbose=True) |
| 2075 | self.assertFalse(fbb.printed_lines) |
| 2076 | |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2077 | def test_gpu_telemetry_tests_fuchsia(self): |
| 2078 | fbb = FakeBBGen(self.args, |
| 2079 | FOO_GPU_TELEMETRY_TEST_WATERFALL_FUCHSIA, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2080 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2081 | LUCI_MILO_CFG, |
| 2082 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2083 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_FUCHSIA) |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2084 | fbb.check_output_file_consistency(verbose=True) |
| 2085 | self.assertFalse(fbb.printed_lines) |
| 2086 | |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2087 | def test_gpu_telemetry_tests_cast_streaming(self): |
| 2088 | fbb = FakeBBGen(self.args, |
| 2089 | FOO_GPU_TELEMETRY_TEST_WATERFALL_CAST_STREAMING, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2090 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2091 | LUCI_MILO_CFG, |
| 2092 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2093 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_CAST_STREAMING) |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2094 | fbb.check_output_file_consistency(verbose=True) |
| 2095 | self.assertFalse(fbb.printed_lines) |
| 2096 | |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2097 | def test_gpu_telemetry_tests_skylab(self): |
| 2098 | fbb = FakeBBGen(self.args, |
| 2099 | FOO_GPU_TELEMETRY_TEST_WATERFALL_SKYLAB, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 2100 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2101 | LUCI_MILO_CFG, |
| 2102 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2103 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2104 | fbb.check_output_file_consistency(verbose=True) |
| 2105 | self.assertFalse(fbb.printed_lines) |
| 2106 | |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2107 | def test_nvidia_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2108 | fbb = FakeBBGen(self.args, |
| 2109 | NVIDIA_GPU_TELEMETRY_TEST_WATERFALL, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2110 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2111 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2112 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2113 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2114 | fbb.check_output_file_consistency(verbose=True) |
| 2115 | self.assertFalse(fbb.printed_lines) |
| 2116 | |
| 2117 | def test_intel_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2118 | fbb = FakeBBGen(self.args, |
| 2119 | INTEL_GPU_TELEMETRY_TEST_WATERFALL, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2120 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2121 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2122 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2123 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2124 | fbb.check_output_file_consistency(verbose=True) |
| 2125 | self.assertFalse(fbb.printed_lines) |
| 2126 | |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 2127 | def test_gpu_telemetry_tests_with_variants(self): |
| 2128 | fbb = FakeBBGen(self.args, |
| 2129 | GPU_TELEMETRY_TEST_VARIANTS_WATERFALL, |
| 2130 | MATRIX_COMPOUND_MIXED_VARIANTS_REF, |
| 2131 | LUCI_MILO_CFG, |
| 2132 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2133 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP, |
| 2134 | variants=MULTI_VARIANTS_FILE) |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 2135 | fbb.check_output_file_consistency(verbose=True) |
| 2136 | self.assertFalse(fbb.printed_lines) |
| 2137 | |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2138 | def test_intel_uhd_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2139 | fbb = FakeBBGen(self.args, |
| 2140 | INTEL_UHD_GPU_TELEMETRY_TEST_WATERFALL, |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2141 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2142 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2143 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2144 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2145 | fbb.check_output_file_consistency(verbose=True) |
| 2146 | self.assertFalse(fbb.printed_lines) |
| 2147 | |
Jamie Madill | a8be0d7 | 2020-10-02 05:24:04 | [diff] [blame] | 2148 | def test_gtest_as_isolated_Script(self): |
| 2149 | fbb = FakeBBGen(self.args, |
| 2150 | FOO_GTESTS_WATERFALL, |
| 2151 | GTEST_AS_ISOLATED_SCRIPT_SUITE, |
| 2152 | LUCI_MILO_CFG, |
| 2153 | gn_isolate_map=GN_ISOLATE_MAP) |
Jamie Madill | a8be0d7 | 2020-10-02 05:24:04 | [diff] [blame] | 2154 | fbb.check_output_file_consistency(verbose=True) |
| 2155 | self.assertFalse(fbb.printed_lines) |
| 2156 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2157 | def test_ungenerated_output_files_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2158 | fbb = FakeBBGen(self.args, |
| 2159 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2160 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2161 | LUCI_MILO_CFG, |
| 2162 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2163 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
Kenneth Russell | 73c3bd8b | 2018-10-19 22:30:19 | [diff] [blame] | 2164 | fbb.check_output_file_consistency(verbose=True, dump=False) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2165 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2166 | self.assertRegex( |
Dirk Pranke | 6269d30 | 2020-10-01 00:14:39 | [diff] [blame] | 2167 | joined_lines, 'File chromium.test.json did not have the following' |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2168 | ' expected contents:.*') |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2169 | self.assertRegex(joined_lines, r'.*--- expected.*') |
| 2170 | self.assertRegex(joined_lines, r'.*\+\+\+ current.*') |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2171 | fbb.printed_lines = [] |
| 2172 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2173 | |
| 2174 | def test_android_output_options(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2175 | fbb = FakeBBGen(self.args, ANDROID_WATERFALL, FOO_TEST_SUITE, LUCI_MILO_CFG) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2176 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2177 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2178 | |
Garrett Beaty | e3a606ceb | 2024-04-30 22:13:13 | [diff] [blame] | 2179 | def test_android_swarming(self): |
| 2180 | fbb = FakeBBGen(self.args, ANDROID_WATERFALL, |
| 2181 | FOO_TEST_SUITE_ANDROID_SWARMING, LUCI_MILO_CFG) |
| 2182 | fbb.check_output_file_consistency(verbose=True) |
| 2183 | self.assertFalse(fbb.printed_lines) |
| 2184 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2185 | def test_nonexistent_removal_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2186 | fbb = FakeBBGen(self.args, |
| 2187 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2188 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2189 | LUCI_MILO_CFG, |
| 2190 | exceptions=NONEXISTENT_REMOVAL) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2191 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2192 | 'The following nonexistent machines.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2193 | fbb.check_input_file_consistency(verbose=True) |
| 2194 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2195 | |
| 2196 | def test_nonexistent_modification_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2197 | fbb = FakeBBGen(self.args, |
| 2198 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2199 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2200 | LUCI_MILO_CFG, |
| 2201 | exceptions=NONEXISTENT_MODIFICATION) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2202 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2203 | 'The following nonexistent machines.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2204 | fbb.check_input_file_consistency(verbose=True) |
| 2205 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2206 | |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2207 | def test_waterfall_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2208 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WITH_ARGS_WATERFALL, |
| 2209 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2210 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2211 | self.assertFalse(fbb.printed_lines) |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2212 | |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 2213 | def test_chromeos_trigger_script_output(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2214 | fbb = FakeBBGen(self.args, FOO_CHROMEOS_TRIGGER_SCRIPT_WATERFALL, |
| 2215 | FOO_TEST_SUITE, LUCI_MILO_CFG) |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 2216 | fbb.check_output_file_consistency(verbose=True) |
| 2217 | self.assertFalse(fbb.printed_lines) |
| 2218 | |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2219 | def test_relative_pyl_file_dir(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2220 | self.set_args('--pyl-files-dir=relative/path') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2221 | fbb = FakeBBGen(self.args, |
| 2222 | FOO_GTESTS_WATERFALL, |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2223 | REUSING_TEST_WITH_DIFFERENT_NAME, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2224 | LUCI_MILO_CFG, |
| 2225 | gn_isolate_map=GN_ISOLATE_MAP) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2226 | fbb.check_input_file_consistency(verbose=True) |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2227 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2228 | self.assertFalse(fbb.printed_lines) |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2229 | |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2230 | def test_nonexistent_bot_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2231 | fbb = FakeBBGen(self.args, UNKNOWN_BOT_GTESTS_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 2232 | LUCI_MILO_CFG) |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2233 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2234 | fbb.check_input_file_consistency(verbose=True) |
| 2235 | self.assertFalse(fbb.printed_lines) |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2236 | |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 2237 | def test_nonexistent_bot_raises_when_no_project_pyl_exists(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2238 | fbb = FakeBBGen(self.args, |
| 2239 | UNKNOWN_BOT_GTESTS_WATERFALL, |
Garrett Beaty | 2a02de3c | 2020-05-15 13:57:35 | [diff] [blame] | 2240 | FOO_TEST_SUITE, |
| 2241 | LUCI_MILO_CFG, |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 2242 | project_pyl=None) |
| 2243 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2244 | fbb.check_input_file_consistency(verbose=True) |
| 2245 | self.assertFalse(fbb.printed_lines) |
| 2246 | |
| 2247 | def test_nonexistent_bot_does_not_raise_when_validation_disabled(self): |
| 2248 | fbb = FakeBBGen( |
| 2249 | self.args, |
| 2250 | UNKNOWN_BOT_GTESTS_WATERFALL, |
| 2251 | FOO_TEST_SUITE, |
| 2252 | LUCI_MILO_CFG, |
| 2253 | project_pyl='{"validate_source_side_specs_have_builder": False}') |
Garrett Beaty | 2a02de3c | 2020-05-15 13:57:35 | [diff] [blame] | 2254 | fbb.check_input_file_consistency(verbose=True) |
| 2255 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2256 | def test_waterfalls_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2257 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTED_WATERFALL, TEST_SUITE_SORTED, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2258 | LUCI_MILO_CFG_WATERFALL_SORTING) |
| 2259 | fbb.check_input_file_consistency(verbose=True) |
| 2260 | self.assertFalse(fbb.printed_lines) |
| 2261 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2262 | fbb = FakeBBGen(self.args, TEST_SUITE_UNSORTED_WATERFALL_1, |
| 2263 | TEST_SUITE_SORTED, LUCI_MILO_CFG_WATERFALL_SORTING) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2264 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2265 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2266 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2267 | re.escape(self.args.waterfalls_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2268 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2269 | fbb.check_input_file_consistency(verbose=True) |
| 2270 | joined_lines = '\n'.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2271 | self.assertRegex(joined_lines, r'.*\+ chromium\..*test.*') |
| 2272 | self.assertRegex(joined_lines, r'.*\- chromium\..*test.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2273 | fbb.printed_lines = [] |
| 2274 | self.assertFalse(fbb.printed_lines) |
| 2275 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2276 | fbb = FakeBBGen(self.args, TEST_SUITE_UNSORTED_WATERFALL_2, |
| 2277 | TEST_SUITE_SORTED, LUCI_MILO_CFG_WATERFALL_SORTING) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2278 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2279 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2280 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2281 | re.escape(self.args.waterfalls_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2282 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2283 | fbb.check_input_file_consistency(verbose=True) |
| 2284 | joined_lines = ' '.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2285 | self.assertRegex(joined_lines, r'.*\+.*Fake Tester.*') |
| 2286 | self.assertRegex(joined_lines, r'.*\-.*Fake Tester.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2287 | fbb.printed_lines = [] |
| 2288 | self.assertFalse(fbb.printed_lines) |
| 2289 | |
| 2290 | def test_test_suite_exceptions_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2291 | fbb = FakeBBGen(self.args, |
| 2292 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2293 | TEST_SUITE_SORTED, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2294 | LUCI_MILO_CFG, |
| 2295 | exceptions=EXCEPTIONS_SORTED) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2296 | fbb.check_input_file_consistency(verbose=True) |
| 2297 | self.assertFalse(fbb.printed_lines) |
Stephen Martinis | f8389372 | 2018-09-19 00:02:18 | [diff] [blame] | 2298 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2299 | fbb = FakeBBGen(self.args, |
| 2300 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2301 | TEST_SUITE_SORTED, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2302 | LUCI_MILO_CFG, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2303 | exceptions=EXCEPTIONS_DUPS_REMOVE_FROM) |
| 2304 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2305 | fbb.check_input_file_consistency(verbose=True) |
| 2306 | joined_lines = ' '.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2307 | self.assertRegex(joined_lines, r'.*\- Fake Tester.*') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2308 | fbb.printed_lines = [] |
| 2309 | self.assertFalse(fbb.printed_lines) |
| 2310 | |
| 2311 | def test_test_suite_exceptions_no_dups_remove_from(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2312 | fbb = FakeBBGen(self.args, |
| 2313 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2314 | TEST_SUITE_SORTED, |
| 2315 | LUCI_MILO_CFG, |
| 2316 | exceptions=EXCEPTIONS_SORTED) |
| 2317 | fbb.check_input_file_consistency(verbose=True) |
| 2318 | self.assertFalse(fbb.printed_lines) |
| 2319 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2320 | fbb = FakeBBGen(self.args, |
| 2321 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2322 | TEST_SUITE_SORTED, |
| 2323 | LUCI_MILO_CFG, |
| 2324 | exceptions=EXCEPTIONS_PER_TEST_UNSORTED) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2325 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2326 | fbb.check_input_file_consistency(verbose=True) |
| 2327 | joined_lines = ' '.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2328 | self.assertRegex(joined_lines, r'.*\+ Fake Tester.*') |
| 2329 | self.assertRegex(joined_lines, r'.*\- Fake Tester.*') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2330 | fbb.printed_lines = [] |
| 2331 | self.assertFalse(fbb.printed_lines) |
| 2332 | |
| 2333 | def test_test_suite_exceptions_per_test_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2334 | fbb = FakeBBGen(self.args, |
| 2335 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2336 | TEST_SUITE_SORTED, |
| 2337 | LUCI_MILO_CFG, |
| 2338 | exceptions=EXCEPTIONS_SORTED) |
| 2339 | fbb.check_input_file_consistency(verbose=True) |
| 2340 | self.assertFalse(fbb.printed_lines) |
| 2341 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2342 | fbb = FakeBBGen(self.args, |
| 2343 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2344 | TEST_SUITE_SORTED, |
| 2345 | LUCI_MILO_CFG, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2346 | exceptions=EXCEPTIONS_UNSORTED) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2347 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2348 | fbb.check_input_file_consistency(verbose=True) |
| 2349 | joined_lines = ' '.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2350 | self.assertRegex(joined_lines, r'.*\+ suite_.*') |
| 2351 | self.assertRegex(joined_lines, r'.*\- suite_.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2352 | fbb.printed_lines = [] |
| 2353 | self.assertFalse(fbb.printed_lines) |
| 2354 | |
| 2355 | def test_test_suites_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2356 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTING_WATERFALL, TEST_SUITE_SORTED, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2357 | LUCI_MILO_CFG) |
| 2358 | fbb.check_input_file_consistency(verbose=True) |
| 2359 | self.assertFalse(fbb.printed_lines) |
| 2360 | |
| 2361 | for unsorted in ( |
| 2362 | TEST_SUITE_UNSORTED_1, |
| 2363 | TEST_SUITE_UNSORTED_2, |
| 2364 | TEST_SUITE_UNSORTED_3, |
| 2365 | ): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2366 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTING_WATERFALL, unsorted, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2367 | LUCI_MILO_CFG) |
| 2368 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2369 | fbb.check_input_file_consistency(verbose=True) |
| 2370 | joined_lines = ' '.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2371 | self.assertRegex(joined_lines, r'.*\+ suite_.*') |
| 2372 | self.assertRegex(joined_lines, r'.*\- suite_.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2373 | fbb.printed_lines = [] |
| 2374 | self.assertFalse(fbb.printed_lines) |
| 2375 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2376 | |
| 2377 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL = """\ |
| 2378 | [ |
| 2379 | { |
| 2380 | 'mixins': ['waterfall_mixin'], |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2381 | 'project': 'chromium', |
| 2382 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2383 | 'name': 'chromium.test', |
| 2384 | 'machines': { |
| 2385 | 'Fake Tester': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2386 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2387 | 'dimensions': { |
| 2388 | 'os': 'Linux', |
| 2389 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2390 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2391 | 'test_suites': { |
| 2392 | 'gtest_tests': 'foo_tests', |
| 2393 | }, |
| 2394 | }, |
| 2395 | }, |
| 2396 | }, |
| 2397 | ] |
| 2398 | """ |
| 2399 | |
| 2400 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL = """\ |
| 2401 | [ |
| 2402 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2403 | 'project': 'chromium', |
| 2404 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2405 | 'name': 'chromium.test', |
| 2406 | 'machines': { |
| 2407 | 'Fake Tester': { |
| 2408 | 'mixins': ['builder_mixin'], |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2409 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2410 | 'dimensions': { |
| 2411 | 'os': 'Linux', |
| 2412 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2413 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2414 | 'test_suites': { |
| 2415 | 'gtest_tests': 'foo_tests', |
| 2416 | }, |
| 2417 | }, |
| 2418 | }, |
| 2419 | }, |
| 2420 | ] |
| 2421 | """ |
| 2422 | |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2423 | FOO_LINUX_GTESTS_BUILDER_MIXIN_WATERFALL = """\ |
| 2424 | [ |
| 2425 | { |
| 2426 | 'project': 'chromium', |
| 2427 | 'bucket': 'ci', |
| 2428 | 'name': 'chromium.test', |
| 2429 | 'machines': { |
| 2430 | 'Fake Tester': { |
| 2431 | 'os_type': 'linux', |
| 2432 | 'mixins': ['builder_mixin'], |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2433 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2434 | 'dimensions': { |
| 2435 | 'os': 'Linux', |
| 2436 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2437 | }, |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2438 | 'test_suites': { |
| 2439 | 'gtest_tests': 'foo_tests', |
| 2440 | }, |
| 2441 | }, |
| 2442 | }, |
| 2443 | }, |
| 2444 | ] |
| 2445 | """ |
| 2446 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2447 | FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL = """\ |
| 2448 | [ |
| 2449 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2450 | 'project': 'chromium', |
| 2451 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2452 | 'name': 'chromium.test', |
| 2453 | 'machines': { |
| 2454 | 'Fake Tester': { |
| 2455 | 'mixins': ['random_mixin'], |
| 2456 | 'swarming': {}, |
| 2457 | 'test_suites': { |
| 2458 | 'gtest_tests': 'foo_tests', |
| 2459 | }, |
| 2460 | }, |
| 2461 | }, |
| 2462 | }, |
| 2463 | ] |
| 2464 | """ |
| 2465 | |
| 2466 | FOO_GTESTS_DIMENSIONS_MIXIN_WATERFALL = """\ |
| 2467 | [ |
| 2468 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2469 | 'project': 'chromium', |
| 2470 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2471 | 'name': 'chromium.test', |
| 2472 | 'machines': { |
| 2473 | 'Fake Tester': { |
| 2474 | 'mixins': ['dimension_mixin'], |
| 2475 | 'swarming': {}, |
| 2476 | 'test_suites': { |
| 2477 | 'gtest_tests': 'foo_tests', |
| 2478 | }, |
| 2479 | }, |
| 2480 | }, |
| 2481 | }, |
| 2482 | ] |
| 2483 | """ |
| 2484 | |
| 2485 | FOO_GPU_TELEMETRY_TEST_DIMENSIONS_WATERFALL = """\ |
| 2486 | [ |
| 2487 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2488 | 'project': 'chromium', |
| 2489 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2490 | 'name': 'chromium.test', |
| 2491 | 'machines': { |
| 2492 | 'Fake Tester': { |
| 2493 | 'mixins': ['dimension_mixin'], |
| 2494 | 'os_type': 'win', |
| 2495 | 'browser_config': 'release', |
| 2496 | 'test_suites': { |
| 2497 | 'gpu_telemetry_tests': 'foo_tests', |
| 2498 | }, |
| 2499 | }, |
| 2500 | }, |
| 2501 | }, |
| 2502 | ] |
| 2503 | """ |
| 2504 | |
| 2505 | # Swarming mixins must be a list, a single string is not allowed. |
| 2506 | FOO_GTESTS_INVALID_LIST_MIXIN_WATERFALL = """\ |
| 2507 | [ |
| 2508 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2509 | 'project': 'chromium', |
| 2510 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2511 | 'name': 'chromium.test', |
| 2512 | 'machines': { |
| 2513 | 'Fake Tester': { |
| 2514 | 'mixins': 'dimension_mixin', |
| 2515 | 'swarming': {}, |
| 2516 | 'test_suites': { |
| 2517 | 'gtest_tests': 'foo_tests', |
| 2518 | }, |
| 2519 | }, |
| 2520 | }, |
| 2521 | }, |
| 2522 | ] |
| 2523 | """ |
| 2524 | FOO_GTESTS_INVALID_NOTFOUND_MIXIN_WATERFALL = """\ |
| 2525 | [ |
| 2526 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2527 | 'project': 'chromium', |
| 2528 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2529 | 'name': 'chromium.test', |
| 2530 | 'machines': { |
| 2531 | 'Fake Tester': { |
| 2532 | 'mixins': ['nonexistant'], |
| 2533 | 'swarming': {}, |
| 2534 | 'test_suites': { |
| 2535 | 'gtest_tests': 'foo_tests', |
| 2536 | }, |
| 2537 | }, |
| 2538 | }, |
| 2539 | }, |
| 2540 | ] |
| 2541 | """ |
| 2542 | |
| 2543 | FOO_GTESTS_TEST_MIXIN_WATERFALL = """\ |
| 2544 | [ |
| 2545 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2546 | 'project': 'chromium', |
| 2547 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2548 | 'name': 'chromium.test', |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2549 | 'mixins': ['waterfall_mixin'], |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2550 | 'machines': { |
| 2551 | 'Fake Tester': { |
| 2552 | 'swarming': {}, |
| 2553 | 'test_suites': { |
| 2554 | 'gtest_tests': 'foo_tests', |
| 2555 | }, |
| 2556 | }, |
| 2557 | }, |
| 2558 | }, |
| 2559 | ] |
| 2560 | """ |
| 2561 | |
| 2562 | FOO_GTESTS_SORTING_MIXINS_WATERFALL = """\ |
| 2563 | [ |
| 2564 | { |
| 2565 | 'mixins': ['a_mixin', 'b_mixin', 'c_mixin'], |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2566 | 'project': 'chromium', |
| 2567 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2568 | 'name': 'chromium.test', |
| 2569 | 'machines': { |
| 2570 | 'Fake Tester': { |
| 2571 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2572 | 'dimensions': { |
| 2573 | 'kvm': '1', |
| 2574 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2575 | }, |
| 2576 | 'test_suites': { |
| 2577 | 'gtest_tests': 'foo_tests', |
| 2578 | }, |
| 2579 | }, |
| 2580 | }, |
| 2581 | }, |
| 2582 | ] |
| 2583 | """ |
| 2584 | |
| 2585 | FOO_TEST_SUITE_WITH_MIXIN = """\ |
| 2586 | { |
| 2587 | 'basic_suites': { |
| 2588 | 'foo_tests': { |
| 2589 | 'foo_test': { |
| 2590 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2591 | 'dimensions': { |
| 2592 | 'integrity': 'high', |
| 2593 | 'os': 'Linux', |
| 2594 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2595 | 'expiration': 120, |
| 2596 | }, |
| 2597 | 'mixins': ['test_mixin'], |
| 2598 | }, |
| 2599 | }, |
| 2600 | }, |
| 2601 | } |
| 2602 | """ |
| 2603 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2604 | MIXIN_ARGS = """\ |
| 2605 | { |
| 2606 | 'builder_mixin': { |
| 2607 | 'args': [], |
| 2608 | }, |
| 2609 | } |
| 2610 | """ |
| 2611 | |
| 2612 | MIXIN_ARGS_NOT_LIST = """\ |
| 2613 | { |
| 2614 | 'builder_mixin': { |
| 2615 | 'args': 'I am not a list', |
| 2616 | }, |
| 2617 | } |
| 2618 | """ |
| 2619 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2620 | MIXIN_LINUX_ARGS = """\ |
| 2621 | { |
| 2622 | 'builder_mixin': { |
| 2623 | 'args': [ '--mixin-argument' ], |
| 2624 | 'linux_args': [ '--linux-mixin-argument' ], |
| 2625 | }, |
| 2626 | } |
| 2627 | """ |
| 2628 | |
| 2629 | MIXIN_APPEND = """\ |
| 2630 | { |
| 2631 | 'builder_mixin': { |
| 2632 | '$mixin_append': { |
| 2633 | 'args': [ '--mixin-argument' ], |
| 2634 | }, |
| 2635 | }, |
| 2636 | } |
| 2637 | """ |
| 2638 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2639 | # These mixins are invalid; if passed to check_input_file_consistency, they will |
| 2640 | # fail. These are used for output file consistency checks. |
| 2641 | SWARMING_MIXINS = """\ |
| 2642 | { |
| 2643 | 'builder_mixin': { |
| 2644 | 'swarming': { |
| 2645 | 'value': 'builder', |
| 2646 | }, |
| 2647 | }, |
| 2648 | 'dimension_mixin': { |
| 2649 | 'swarming': { |
| 2650 | 'dimensions': { |
| 2651 | 'iama': 'mixin', |
| 2652 | }, |
| 2653 | }, |
| 2654 | }, |
| 2655 | 'random_mixin': { |
| 2656 | 'value': 'random', |
| 2657 | }, |
| 2658 | 'test_mixin': { |
| 2659 | 'swarming': { |
| 2660 | 'value': 'test', |
| 2661 | }, |
| 2662 | }, |
| 2663 | 'waterfall_mixin': { |
| 2664 | 'swarming': { |
| 2665 | 'value': 'waterfall', |
| 2666 | }, |
| 2667 | }, |
| 2668 | } |
| 2669 | """ |
| 2670 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2671 | SWARMING_NAMED_CACHES = """\ |
| 2672 | { |
| 2673 | 'builder_mixin': { |
| 2674 | 'swarming': { |
| 2675 | 'named_caches': [ |
| 2676 | { |
| 2677 | 'name': 'cache', |
| 2678 | 'file': 'cache_file', |
| 2679 | }, |
| 2680 | ], |
| 2681 | }, |
| 2682 | }, |
| 2683 | } |
| 2684 | """ |
| 2685 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2686 | SWARMING_MIXINS_DUPLICATED = """\ |
| 2687 | { |
| 2688 | 'builder_mixin': { |
| 2689 | 'value': 'builder', |
| 2690 | }, |
| 2691 | 'builder_mixin': { |
| 2692 | 'value': 'builder', |
| 2693 | }, |
| 2694 | } |
| 2695 | """ |
| 2696 | |
| 2697 | SWARMING_MIXINS_UNSORTED = """\ |
| 2698 | { |
| 2699 | 'b_mixin': { |
| 2700 | 'b': 'b', |
| 2701 | }, |
| 2702 | 'a_mixin': { |
| 2703 | 'a': 'a', |
| 2704 | }, |
| 2705 | 'c_mixin': { |
| 2706 | 'c': 'c', |
| 2707 | }, |
| 2708 | } |
| 2709 | """ |
| 2710 | |
| 2711 | SWARMING_MIXINS_SORTED = """\ |
| 2712 | { |
| 2713 | 'a_mixin': { |
| 2714 | 'a': 'a', |
| 2715 | }, |
| 2716 | 'b_mixin': { |
| 2717 | 'b': 'b', |
| 2718 | }, |
| 2719 | 'c_mixin': { |
| 2720 | 'c': 'c', |
| 2721 | }, |
| 2722 | } |
| 2723 | """ |
| 2724 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2725 | |
| 2726 | class MixinTests(TestCase): |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2727 | """Tests for the mixins feature.""" |
| 2728 | def test_mixins_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2729 | fbb = FakeBBGen(self.args, |
| 2730 | FOO_GTESTS_SORTING_MIXINS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2731 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2732 | LUCI_MILO_CFG, |
| 2733 | mixins=SWARMING_MIXINS_SORTED) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2734 | fbb.check_input_file_consistency(verbose=True) |
| 2735 | self.assertFalse(fbb.printed_lines) |
| 2736 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2737 | fbb = FakeBBGen(self.args, |
| 2738 | FOO_GTESTS_SORTING_MIXINS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2739 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2740 | LUCI_MILO_CFG, |
| 2741 | mixins=SWARMING_MIXINS_UNSORTED) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2742 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2743 | fbb.check_input_file_consistency(verbose=True) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2744 | joined_lines = '\n'.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2745 | self.assertRegex(joined_lines, r'.*\+ ._mixin.*') |
| 2746 | self.assertRegex(joined_lines, r'.*\- ._mixin.*') |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2747 | fbb.printed_lines = [] |
| 2748 | self.assertFalse(fbb.printed_lines) |
| 2749 | |
| 2750 | def test_waterfall(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2751 | fbb = FakeBBGen(self.args, |
| 2752 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2753 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2754 | LUCI_MILO_CFG, |
| 2755 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2756 | fbb.check_output_file_consistency(verbose=True) |
| 2757 | self.assertFalse(fbb.printed_lines) |
| 2758 | |
| 2759 | def test_waterfall_exception_overrides(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2760 | fbb = FakeBBGen(self.args, |
| 2761 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2762 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2763 | LUCI_MILO_CFG, |
| 2764 | exceptions=SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS, |
| 2765 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2766 | fbb.check_output_file_consistency(verbose=True) |
| 2767 | self.assertFalse(fbb.printed_lines) |
| 2768 | |
Stephanie Kim | 572b43c0 | 2023-04-13 14:24:13 | [diff] [blame] | 2769 | def test_autoshard_exceptions(self): |
| 2770 | fbb = FakeBBGen(self.args, |
| 2771 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
| 2772 | FOO_TEST_SUITE, |
| 2773 | LUCI_MILO_CFG, |
| 2774 | exceptions=SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS, |
| 2775 | autoshard_exceptions=AUTOSHARD_EXCEPTIONS, |
| 2776 | mixins=SWARMING_MIXINS) |
| 2777 | fbb.check_output_file_consistency(verbose=True) |
| 2778 | self.assertFalse(fbb.printed_lines) |
| 2779 | |
| 2780 | def test_autoshard_exceptions_variant_names(self): |
| 2781 | fbb = FakeBBGen(self.args, |
| 2782 | MATRIX_GTEST_SUITE_WATERFALL, |
| 2783 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY, |
| 2784 | LUCI_MILO_CFG, |
| 2785 | autoshard_exceptions=AUTOSHARD_EXCEPTIONS, |
| 2786 | variants=VARIANTS_FILE) |
| 2787 | fbb.check_output_file_consistency(verbose=True) |
| 2788 | self.assertFalse(fbb.printed_lines) |
| 2789 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2790 | def test_builder(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2791 | fbb = FakeBBGen(self.args, |
| 2792 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2793 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2794 | LUCI_MILO_CFG, |
| 2795 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2796 | fbb.check_output_file_consistency(verbose=True) |
| 2797 | self.assertFalse(fbb.printed_lines) |
| 2798 | |
| 2799 | def test_builder_non_swarming(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2800 | fbb = FakeBBGen(self.args, |
| 2801 | FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2802 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2803 | LUCI_MILO_CFG, |
| 2804 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2805 | fbb.check_output_file_consistency(verbose=True) |
| 2806 | self.assertFalse(fbb.printed_lines) |
| 2807 | |
| 2808 | def test_test_suite(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2809 | fbb = FakeBBGen(self.args, |
| 2810 | FOO_GTESTS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2811 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2812 | LUCI_MILO_CFG, |
| 2813 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2814 | fbb.check_output_file_consistency(verbose=True) |
| 2815 | self.assertFalse(fbb.printed_lines) |
| 2816 | |
| 2817 | def test_dimension(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2818 | fbb = FakeBBGen(self.args, |
| 2819 | FOO_GTESTS_DIMENSIONS_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2820 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2821 | LUCI_MILO_CFG, |
| 2822 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2823 | fbb.check_output_file_consistency(verbose=True) |
| 2824 | self.assertFalse(fbb.printed_lines) |
| 2825 | |
| 2826 | def test_dimension_gpu(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2827 | fbb = FakeBBGen(self.args, |
| 2828 | FOO_GPU_TELEMETRY_TEST_DIMENSIONS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2829 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2830 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2831 | mixins=SWARMING_MIXINS, |
| 2832 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2833 | fbb.check_output_file_consistency(verbose=True) |
| 2834 | self.assertFalse(fbb.printed_lines) |
| 2835 | |
| 2836 | def test_unreferenced(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2837 | fbb = FakeBBGen(self.args, |
| 2838 | FOO_GTESTS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2839 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2840 | LUCI_MILO_CFG, |
| 2841 | mixins=SWARMING_MIXINS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2842 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2843 | '.*mixins are unreferenced.*'): |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2844 | fbb.check_input_file_consistency(verbose=True) |
| 2845 | self.assertFalse(fbb.printed_lines) |
| 2846 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2847 | def test_unused(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2848 | fbb = FakeBBGen(self.args, |
| 2849 | FOO_GTESTS_INVALID_NOTFOUND_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2850 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2851 | LUCI_MILO_CFG, |
| 2852 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2853 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2854 | fbb.check_output_file_consistency(verbose=True) |
| 2855 | self.assertFalse(fbb.printed_lines) |
| 2856 | |
| 2857 | def test_list(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2858 | fbb = FakeBBGen(self.args, |
| 2859 | FOO_GTESTS_INVALID_LIST_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2860 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2861 | LUCI_MILO_CFG, |
| 2862 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2863 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2864 | fbb.check_output_file_consistency(verbose=True) |
| 2865 | self.assertFalse(fbb.printed_lines) |
| 2866 | |
| 2867 | |
| 2868 | def test_no_duplicate_keys(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2869 | fbb = FakeBBGen(self.args, |
| 2870 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2871 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2872 | LUCI_MILO_CFG, |
| 2873 | mixins=SWARMING_MIXINS_DUPLICATED) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2874 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2875 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2876 | ('The following files have invalid keys: ' + |
| 2877 | re.escape(self.args.mixins_pyl_path)), |
| 2878 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2879 | fbb.check_input_file_consistency(verbose=True) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2880 | joined_lines = '\n'.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2881 | self.assertRegex(joined_lines, r'.*\- builder_mixin') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2882 | fbb.printed_lines = [] |
| 2883 | self.assertFalse(fbb.printed_lines) |
| 2884 | |
| 2885 | def test_no_duplicate_keys_basic_test_suite(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2886 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, FOO_TEST_SUITE_NOT_SORTED, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2887 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2888 | with self.assertRaisesRegex( |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2889 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2890 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2891 | re.escape(self.args.test_suites_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2892 | ): |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2893 | fbb.check_input_file_consistency(verbose=True) |
| 2894 | joined_lines = '\n'.join(fbb.printed_lines) |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2895 | self.assertRegex(joined_lines, r'.*\- a_test') |
| 2896 | self.assertRegex(joined_lines, r'.*\+ a_test') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2897 | fbb.printed_lines = [] |
| 2898 | self.assertFalse(fbb.printed_lines) |
| 2899 | |
| 2900 | def test_type_assert_printing_help(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2901 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, TEST_SUITES_SYNTAX_ERROR, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2902 | LUCI_MILO_CFG) |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2903 | with self.assertRaisesRegex( |
| 2904 | generate_buildbot_json.BBGenErr, |
Brian Sheedy | db4416f | 2024-08-12 20:17:02 | [diff] [blame] | 2905 | f'Invalid \\.pyl file ' |
| 2906 | f"'{re.escape(self.args.test_suites_pyl_path)}'.*", |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2907 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2908 | fbb.check_input_file_consistency(verbose=True) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2909 | self.assertEqual(fbb.printed_lines, [ |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2910 | f'== {self.args.test_suites_pyl_path} ==', |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2911 | '<snip>', |
| 2912 | '1 {', |
| 2913 | "2 'basic_suites': {", |
| 2914 | '--------------------------------------------------------------------' |
| 2915 | '------------', |
| 2916 | '3 3: {', |
| 2917 | '-------^------------------------------------------------------------' |
| 2918 | '------------', |
| 2919 | "4 'suite_c': {},", |
| 2920 | '5 },', |
| 2921 | '<snip>', |
| 2922 | ]) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2923 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2924 | def test_mixin_append(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2925 | fbb = FakeBBGen(self.args, |
| 2926 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Wez | c0e835b70 | 2018-10-30 00:38:41 | [diff] [blame] | 2927 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2928 | LUCI_MILO_CFG, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2929 | mixins=MIXIN_APPEND) |
| 2930 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2931 | r'.*\$mixin_append is no longer supported.*'): |
| 2932 | fbb.check_input_file_consistency(verbose=True) |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2933 | self.assertFalse(fbb.printed_lines) |
| 2934 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2935 | def test_swarming_named_caches(self): |
| 2936 | fbb = FakeBBGen(self.args, |
| 2937 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2938 | FOO_TEST_SUITE_WITH_SWARMING_NAMED_CACHES, |
| 2939 | LUCI_MILO_CFG, |
| 2940 | mixins=SWARMING_NAMED_CACHES) |
| 2941 | fbb.check_output_file_consistency(verbose=True) |
| 2942 | self.assertFalse(fbb.printed_lines) |
| 2943 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2944 | def test_args_field_not_list(self): |
| 2945 | fbb = FakeBBGen(self.args, |
| 2946 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2947 | FOO_TEST_SUITE_WITH_ARGS, |
| 2948 | LUCI_MILO_CFG, |
| 2949 | mixins=MIXIN_ARGS_NOT_LIST) |
| 2950 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2951 | '"args" must be a list'): |
| 2952 | fbb.check_output_file_consistency(verbose=True) |
| 2953 | self.assertFalse(fbb.printed_lines) |
| 2954 | |
| 2955 | def test_args_field_merging(self): |
| 2956 | fbb = FakeBBGen(self.args, |
| 2957 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2958 | FOO_TEST_SUITE_WITH_ARGS, |
| 2959 | LUCI_MILO_CFG, |
| 2960 | mixins=MIXIN_ARGS) |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2961 | fbb.check_output_file_consistency(verbose=True) |
| 2962 | self.assertFalse(fbb.printed_lines) |
| 2963 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2964 | def test_linux_args_field_merging(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2965 | fbb = FakeBBGen(self.args, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2966 | FOO_LINUX_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2967 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2968 | LUCI_MILO_CFG, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2969 | mixins=MIXIN_LINUX_ARGS) |
| 2970 | fbb.check_output_file_consistency(verbose=True) |
Wez | c0e835b70 | 2018-10-30 00:38:41 | [diff] [blame] | 2971 | self.assertFalse(fbb.printed_lines) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2972 | |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2973 | def test_remove_mixin_test_remove_waterfall(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2974 | fbb = FakeBBGen(self.args, |
| 2975 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2976 | FOO_TEST_SUITE_WITH_REMOVE_WATERFALL_MIXIN, |
| 2977 | LUCI_MILO_CFG, |
| 2978 | mixins=SWARMING_MIXINS) |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2979 | fbb.check_output_file_consistency(verbose=True) |
| 2980 | self.assertFalse(fbb.printed_lines) |
| 2981 | |
| 2982 | def test_remove_mixin_test_remove_builder(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2983 | fbb = FakeBBGen(self.args, |
| 2984 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2985 | FOO_TEST_SUITE_WITH_REMOVE_BUILDER_MIXIN, |
| 2986 | LUCI_MILO_CFG, |
| 2987 | mixins=SWARMING_MIXINS) |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2988 | fbb.check_output_file_consistency(verbose=True) |
| 2989 | self.assertFalse(fbb.printed_lines) |
| 2990 | |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 2991 | TEST_SUITE_WITH_PARAMS = """\ |
| 2992 | { |
| 2993 | 'basic_suites': { |
| 2994 | 'bar_tests': { |
| 2995 | 'bar_test': { |
| 2996 | 'args': ['--no-xvfb'], |
| 2997 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2998 | 'dimensions': { |
| 2999 | 'device_os': 'NMF26U' |
| 3000 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3001 | }, |
| 3002 | 'should_retry_with_patch': False, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3003 | }, |
| 3004 | 'bar_test_test': { |
| 3005 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3006 | 'dimensions': { |
| 3007 | 'kvm': '1' |
| 3008 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3009 | 'hard_timeout': 1000 |
| 3010 | }, |
| 3011 | 'should_retry_with_patch': True |
| 3012 | } |
| 3013 | }, |
| 3014 | 'foo_tests': { |
| 3015 | 'foo_test_empty': {}, |
| 3016 | 'foo_test': { |
| 3017 | 'args': [ |
| 3018 | '--jobs=1', |
| 3019 | '--verbose' |
| 3020 | ], |
| 3021 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3022 | 'dimensions': { |
| 3023 | 'device_os': 'MMB29Q' |
| 3024 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3025 | 'hard_timeout': 1800 |
| 3026 | } |
| 3027 | }, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame] | 3028 | 'pls': { |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3029 | 'swarming': { |
| 3030 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3031 | }, |
| 3032 | }, |
| 3033 | }, |
| 3034 | 'compound_suites': { |
| 3035 | 'composition_tests': [ |
| 3036 | 'foo_tests', |
| 3037 | 'bar_tests', |
| 3038 | ], |
| 3039 | }, |
| 3040 | } |
| 3041 | """ |
| 3042 | TEST_QUERY_BOTS_OUTPUT = { |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3043 | 'Fake Android M Tester': { |
| 3044 | 'gtest_tests': [{ |
| 3045 | 'name': 'foo_test', |
| 3046 | 'test': 'foo_test', |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3047 | }] |
| 3048 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3049 | 'Fake Android L Tester': { |
| 3050 | 'gtest_tests': [{ |
| 3051 | 'test': |
| 3052 | 'foo_test', |
| 3053 | 'args': [ |
| 3054 | '--gs-results-bucket=chromium-result-details', |
| 3055 | '--recover-devices' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3056 | ], |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3057 | 'merge': { |
| 3058 | 'script': '//testing/merge_scripts/standard_gtest_merge.py' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3059 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3060 | 'name': |
| 3061 | 'foo_test', |
| 3062 | 'swarming': { |
| 3063 | 'dimensions': { |
| 3064 | 'device_os': 'LMY41U', |
| 3065 | 'device_os_type': 'user', |
| 3066 | 'device_type': 'hammerhead', |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3067 | 'os': 'Android' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3068 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3069 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3070 | }] |
| 3071 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3072 | 'Fake Android K Tester': { |
| 3073 | 'additional_compile_targets': ['bar_test'], |
| 3074 | 'gtest_tests': [{ |
| 3075 | 'test': |
| 3076 | 'foo_test', |
| 3077 | 'args': [ |
| 3078 | '--gs-results-bucket=chromium-result-details', |
| 3079 | '--recover-devices' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3080 | ], |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3081 | 'merge': { |
| 3082 | 'script': '//testing/merge_scripts/standard_gtest_merge.py' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3083 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3084 | 'name': |
| 3085 | 'foo_test', |
| 3086 | 'swarming': { |
| 3087 | 'dimensions': { |
| 3088 | 'device_os': 'KTU84P', |
| 3089 | 'device_os_type': 'userdebug', |
| 3090 | 'device_type': 'hammerhead', |
| 3091 | 'os': 'Android', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3092 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3093 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3094 | }] |
| 3095 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3096 | 'Android Builder': { |
| 3097 | 'additional_compile_targets': ['bar_test'] |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3098 | } |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3099 | } |
| 3100 | TEST_QUERY_BOTS_TESTS_OUTPUT = { |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3101 | 'Fake Android M Tester': [{ |
| 3102 | 'name': 'foo_test', |
| 3103 | 'test': 'foo_test', |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3104 | }], |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3105 | 'Fake Android L Tester': [{ |
| 3106 | 'test': |
| 3107 | 'foo_test', |
| 3108 | 'args': |
| 3109 | ['--gs-results-bucket=chromium-result-details', '--recover-devices'], |
| 3110 | 'merge': { |
| 3111 | 'script': '//testing/merge_scripts/standard_gtest_merge.py' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3112 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3113 | 'name': |
| 3114 | 'foo_test', |
| 3115 | 'swarming': { |
| 3116 | 'dimensions': { |
| 3117 | 'device_os': 'LMY41U', |
| 3118 | 'device_os_type': 'user', |
| 3119 | 'device_type': 'hammerhead', |
| 3120 | 'os': 'Android' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3121 | }, |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3122 | } |
| 3123 | }], |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3124 | 'Android Builder': [], |
| 3125 | 'Fake Android K Tester': [{ |
| 3126 | 'test': |
| 3127 | 'foo_test', |
| 3128 | 'args': |
| 3129 | ['--gs-results-bucket=chromium-result-details', '--recover-devices'], |
| 3130 | 'merge': { |
| 3131 | 'script': '//testing/merge_scripts/standard_gtest_merge.py' |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3132 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3133 | 'name': |
| 3134 | 'foo_test', |
| 3135 | 'swarming': { |
| 3136 | 'dimensions': { |
| 3137 | 'device_os': 'KTU84P', |
| 3138 | 'device_os_type': 'userdebug', |
| 3139 | 'device_type': 'hammerhead', |
| 3140 | 'os': 'Android' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3141 | }, |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3142 | } |
| 3143 | }] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3144 | } |
| 3145 | |
| 3146 | TEST_QUERY_BOT_OUTPUT = { |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3147 | 'additional_compile_targets': ['bar_test'], |
| 3148 | 'gtest_tests': [ |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3149 | { |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3150 | 'test': |
| 3151 | 'foo_test', |
| 3152 | 'args': [ |
| 3153 | '--gs-results-bucket=chromium-result-details', |
| 3154 | '--recover-devices', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3155 | ], |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3156 | 'merge': { |
| 3157 | 'script': '//testing/merge_scripts/standard_gtest_merge.py', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3158 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3159 | 'name': |
| 3160 | 'foo_test', |
| 3161 | 'swarming': { |
| 3162 | 'dimensions': { |
| 3163 | 'device_os': 'KTU84P', |
| 3164 | 'device_os_type': 'userdebug', |
| 3165 | 'device_type': 'hammerhead', |
| 3166 | 'os': 'Android', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3167 | }, |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3168 | }, |
| 3169 | }, |
| 3170 | ], |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3171 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3172 | TEST_QUERY_BOT_TESTS_OUTPUT = [{ |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3173 | 'test': |
| 3174 | 'foo_test', |
| 3175 | 'args': |
| 3176 | ['--gs-results-bucket=chromium-result-details', '--recover-devices'], |
| 3177 | 'merge': { |
| 3178 | 'script': '//testing/merge_scripts/standard_gtest_merge.py' |
Stephen Martinis | bc7b777 | 2019-05-01 22:01:43 | [diff] [blame] | 3179 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3180 | 'name': |
| 3181 | 'foo_test', |
| 3182 | 'swarming': { |
| 3183 | 'dimensions': { |
| 3184 | 'device_os': 'LMY41U', |
| 3185 | 'device_os_type': 'user', |
| 3186 | 'device_type': 'hammerhead', |
| 3187 | 'os': 'Android' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3188 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3189 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3190 | }] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3191 | |
| 3192 | TEST_QUERY_TESTS_OUTPUT = { |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3193 | 'bar_test': { |
Garrett Beaty | ffe83c4f | 2023-09-08 19:07:37 | [diff] [blame] | 3194 | 'name': 'bar_test', |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3195 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3196 | 'dimensions': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3197 | 'os': 'Linux' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3198 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3199 | } |
| 3200 | }, |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3201 | 'foo_test': { |
Garrett Beaty | ffe83c4f | 2023-09-08 19:07:37 | [diff] [blame] | 3202 | 'name': 'foo_test', |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3203 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3204 | 'dimensions': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3205 | 'os': 'Linux' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3206 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3207 | } |
| 3208 | } |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3209 | } |
| 3210 | |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3211 | TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT = ['foo_test'] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3212 | |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3213 | TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT = ['bar_test'] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3214 | |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3215 | TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT = ['bar_test_test'] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3216 | |
| 3217 | TEST_QUERY_TESTS_PARAMS_OUTPUT = ['bar_test_test'] |
| 3218 | |
| 3219 | TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT = ['bar_test'] |
| 3220 | |
Garrett Beaty | ffe83c4f | 2023-09-08 19:07:37 | [diff] [blame] | 3221 | TEST_QUERY_TEST_OUTPUT = { |
| 3222 | 'name': 'foo_test', |
| 3223 | 'swarming': { |
| 3224 | 'dimensions': { |
| 3225 | 'os': 'Linux', |
| 3226 | }, |
| 3227 | }, |
| 3228 | } |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3229 | |
| 3230 | TEST_QUERY_TEST_BOTS_OUTPUT = [ |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3231 | 'Fake Android K Tester', |
| 3232 | 'Fake Android L Tester', |
| 3233 | 'Fake Android M Tester', |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3234 | ] |
| 3235 | |
| 3236 | TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT = ['Fake Tester'] |
| 3237 | |
| 3238 | TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT = [] |
| 3239 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3240 | |
| 3241 | class QueryTests(TestCase): |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3242 | """Tests for the query feature.""" |
| 3243 | def test_query_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3244 | self.set_args('--query=bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3245 | fbb = FakeBBGen(self.args, |
| 3246 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3247 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3248 | LUCI_MILO_CFG, |
| 3249 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3250 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3251 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3252 | self.assertEqual(query_json, TEST_QUERY_BOTS_OUTPUT) |
| 3253 | |
| 3254 | def test_query_bots_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3255 | self.set_args('--query=bots/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3256 | fbb = FakeBBGen(self.args, |
| 3257 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3258 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3259 | LUCI_MILO_CFG, |
| 3260 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3261 | with self.assertRaises(SystemExit) as cm: |
| 3262 | fbb.query(fbb.args) |
| 3263 | self.assertEqual(cm.exception.code, 1) |
| 3264 | self.assertTrue(fbb.printed_lines) |
| 3265 | |
| 3266 | def test_query_bots_json(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3267 | self.set_args('--query=bots', '--json=result.json') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3268 | fbb = FakeBBGen(self.args, |
| 3269 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3270 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3271 | LUCI_MILO_CFG, |
| 3272 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3273 | fbb.query(fbb.args) |
| 3274 | self.assertFalse(fbb.printed_lines) |
| 3275 | |
| 3276 | def test_query_bots_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3277 | self.set_args('--query=bots/tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3278 | fbb = FakeBBGen(self.args, |
| 3279 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3280 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3281 | LUCI_MILO_CFG, |
| 3282 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3283 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3284 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3285 | self.assertEqual(query_json, TEST_QUERY_BOTS_TESTS_OUTPUT) |
| 3286 | |
| 3287 | def test_query_invalid_bots_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3288 | self.set_args('--query=bots/tdfjdk') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3289 | fbb = FakeBBGen(self.args, |
| 3290 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3291 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3292 | LUCI_MILO_CFG, |
| 3293 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3294 | with self.assertRaises(SystemExit) as cm: |
| 3295 | fbb.query(fbb.args) |
| 3296 | self.assertEqual(cm.exception.code, 1) |
| 3297 | self.assertTrue(fbb.printed_lines) |
| 3298 | |
| 3299 | def test_query_bot(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3300 | self.set_args('--query=bot/Fake Android K Tester') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3301 | fbb = FakeBBGen(self.args, |
| 3302 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3303 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3304 | LUCI_MILO_CFG, |
| 3305 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3306 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3307 | query_json = json.loads(''.join(fbb.printed_lines)) |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3308 | self.maxDiff = None # pragma pylint: disable=attribute-defined-outside-init |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3309 | self.assertEqual(query_json, TEST_QUERY_BOT_OUTPUT) |
| 3310 | |
| 3311 | def test_query_bot_invalid_id(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3312 | self.set_args('--query=bot/bot1') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3313 | fbb = FakeBBGen(self.args, |
| 3314 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3315 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3316 | LUCI_MILO_CFG, |
| 3317 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3318 | with self.assertRaises(SystemExit) as cm: |
| 3319 | fbb.query(fbb.args) |
| 3320 | self.assertEqual(cm.exception.code, 1) |
| 3321 | self.assertTrue(fbb.printed_lines) |
| 3322 | |
| 3323 | def test_query_bot_invalid_query_too_many(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3324 | self.set_args('--query=bot/Fake Android K Tester/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3325 | fbb = FakeBBGen(self.args, |
| 3326 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3327 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3328 | LUCI_MILO_CFG, |
| 3329 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3330 | with self.assertRaises(SystemExit) as cm: |
| 3331 | fbb.query(fbb.args) |
| 3332 | self.assertEqual(cm.exception.code, 1) |
| 3333 | self.assertTrue(fbb.printed_lines) |
| 3334 | |
| 3335 | def test_query_bot_invalid_query_no_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3336 | self.set_args('--query=bot/Fake Android K Tester/blahs') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3337 | fbb = FakeBBGen(self.args, |
| 3338 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3339 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3340 | LUCI_MILO_CFG, |
| 3341 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3342 | with self.assertRaises(SystemExit) as cm: |
| 3343 | fbb.query(fbb.args) |
| 3344 | self.assertEqual(cm.exception.code, 1) |
| 3345 | self.assertTrue(fbb.printed_lines) |
| 3346 | |
| 3347 | def test_query_bot_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3348 | self.set_args('--query=bot/Fake Android L Tester/tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3349 | fbb = FakeBBGen(self.args, |
| 3350 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3351 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3352 | LUCI_MILO_CFG, |
| 3353 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3354 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3355 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3356 | self.assertEqual(query_json, TEST_QUERY_BOT_TESTS_OUTPUT) |
| 3357 | |
| 3358 | def test_query_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3359 | self.set_args('--query=tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3360 | fbb = FakeBBGen(self.args, |
| 3361 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3362 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3363 | LUCI_MILO_CFG, |
| 3364 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3365 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3366 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3367 | self.assertEqual(query_json, TEST_QUERY_TESTS_OUTPUT) |
| 3368 | |
| 3369 | def test_query_tests_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3370 | self.set_args('--query=tests/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3371 | fbb = FakeBBGen(self.args, |
| 3372 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3373 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3374 | LUCI_MILO_CFG, |
| 3375 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3376 | with self.assertRaises(SystemExit) as cm: |
| 3377 | fbb.query(fbb.args) |
| 3378 | self.assertEqual(cm.exception.code, 1) |
| 3379 | self.assertTrue(fbb.printed_lines) |
| 3380 | |
| 3381 | def test_query_tests_multiple_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3382 | self.set_args('--query=tests/--jobs=1&--verbose') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3383 | fbb = FakeBBGen(self.args, |
| 3384 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3385 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3386 | LUCI_MILO_CFG, |
| 3387 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3388 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3389 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3390 | self.assertEqual(query_json, TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT) |
| 3391 | |
| 3392 | def test_query_tests_invalid_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3393 | self.set_args('--query=tests/device_os?') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3394 | fbb = FakeBBGen(self.args, |
| 3395 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3396 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3397 | LUCI_MILO_CFG, |
| 3398 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3399 | with self.assertRaises(SystemExit) as cm: |
| 3400 | fbb.query(fbb.args) |
| 3401 | self.assertEqual(cm.exception.code, 1) |
| 3402 | self.assertTrue(fbb.printed_lines) |
| 3403 | |
| 3404 | def test_query_tests_dimension_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3405 | self.set_args('--query=tests/device_os:NMF26U') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3406 | fbb = FakeBBGen(self.args, |
| 3407 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3408 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3409 | LUCI_MILO_CFG, |
| 3410 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3411 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3412 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3413 | self.assertEqual(query_json, TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT) |
| 3414 | |
| 3415 | def test_query_tests_swarming_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3416 | self.set_args('--query=tests/hard_timeout:1000') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3417 | fbb = FakeBBGen(self.args, |
| 3418 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3419 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3420 | LUCI_MILO_CFG, |
| 3421 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3422 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3423 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3424 | self.assertEqual(query_json, TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT) |
| 3425 | |
| 3426 | def test_query_tests_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3427 | self.set_args('--query=tests/should_retry_with_patch:true') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3428 | fbb = FakeBBGen(self.args, |
| 3429 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3430 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3431 | LUCI_MILO_CFG, |
| 3432 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3433 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3434 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3435 | self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_OUTPUT) |
| 3436 | |
| 3437 | def test_query_tests_params_false(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3438 | self.set_args('--query=tests/should_retry_with_patch:false') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3439 | fbb = FakeBBGen(self.args, |
| 3440 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3441 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3442 | LUCI_MILO_CFG, |
| 3443 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3444 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3445 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3446 | self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT) |
| 3447 | |
| 3448 | def test_query_test(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3449 | self.set_args('--query=test/foo_test') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3450 | fbb = FakeBBGen(self.args, |
| 3451 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3452 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3453 | LUCI_MILO_CFG, |
| 3454 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3455 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3456 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3457 | self.assertEqual(query_json, TEST_QUERY_TEST_OUTPUT) |
| 3458 | |
| 3459 | def test_query_test_invalid_id(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3460 | self.set_args('--query=test/foo_foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3461 | fbb = FakeBBGen(self.args, |
| 3462 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3463 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3464 | LUCI_MILO_CFG, |
| 3465 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3466 | with self.assertRaises(SystemExit) as cm: |
| 3467 | fbb.query(fbb.args) |
| 3468 | self.assertEqual(cm.exception.code, 1) |
| 3469 | self.assertTrue(fbb.printed_lines) |
| 3470 | |
| 3471 | def test_query_test_invalid_length(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3472 | self.set_args('--query=test/foo_tests/foo/foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3473 | fbb = FakeBBGen(self.args, |
| 3474 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3475 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3476 | LUCI_MILO_CFG, |
| 3477 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3478 | with self.assertRaises(SystemExit) as cm: |
| 3479 | fbb.query(fbb.args) |
| 3480 | self.assertEqual(cm.exception.code, 1) |
| 3481 | self.assertTrue(fbb.printed_lines) |
| 3482 | |
| 3483 | def test_query_test_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3484 | self.set_args('--query=test/foo_test/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3485 | fbb = FakeBBGen(self.args, |
| 3486 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3487 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3488 | LUCI_MILO_CFG, |
| 3489 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3490 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3491 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3492 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_OUTPUT) |
| 3493 | |
| 3494 | def test_query_test_bots_isolated_scripts(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3495 | self.set_args('--query=test/foo_test/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3496 | fbb = FakeBBGen(self.args, |
| 3497 | FOO_ISOLATED_SCRIPTS_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3498 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3499 | LUCI_MILO_CFG, |
| 3500 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3501 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3502 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3503 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT) |
| 3504 | |
| 3505 | def test_query_test_bots_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3506 | self.set_args('--query=test/foo_tests/foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3507 | fbb = FakeBBGen(self.args, |
| 3508 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3509 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3510 | LUCI_MILO_CFG, |
| 3511 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3512 | with self.assertRaises(SystemExit) as cm: |
| 3513 | fbb.query(fbb.args) |
| 3514 | self.assertEqual(cm.exception.code, 1) |
| 3515 | self.assertTrue(fbb.printed_lines) |
| 3516 | |
| 3517 | def test_query_test_bots_no_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3518 | self.set_args('--query=test/bar_tests/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3519 | fbb = FakeBBGen(self.args, |
| 3520 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3521 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3522 | LUCI_MILO_CFG, |
| 3523 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3524 | fbb.query(fbb.args) |
Brian Sheedy | 0d2300f3 | 2024-08-13 23:14:41 | [diff] [blame^] | 3525 | query_json = json.loads(''.join(fbb.printed_lines)) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3526 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT) |
| 3527 | |
| 3528 | def test_query_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3529 | self.set_args('--query=foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3530 | fbb = FakeBBGen(self.args, |
| 3531 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3532 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3533 | LUCI_MILO_CFG, |
| 3534 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3535 | with self.assertRaises(SystemExit) as cm: |
| 3536 | fbb.query(fbb.args) |
| 3537 | self.assertEqual(cm.exception.code, 1) |
| 3538 | self.assertTrue(fbb.printed_lines) |
| 3539 | |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3540 | |
| 3541 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES_SEPARATE_ENTRIES = """\ |
| 3542 | { |
| 3543 | 'basic_suites': { |
| 3544 | 'foo_tests': { |
| 3545 | 'foo_test': { |
| 3546 | 'args': [ |
| 3547 | '--enable-features', |
| 3548 | 'Foo,Bar', |
| 3549 | ], |
| 3550 | }, |
| 3551 | }, |
| 3552 | }, |
| 3553 | } |
| 3554 | """ |
| 3555 | |
| 3556 | |
| 3557 | FOO_TEST_REPLACEMENTS_REMOVE_NO_VALUE = """\ |
| 3558 | { |
| 3559 | 'foo_test': { |
| 3560 | 'replacements': { |
| 3561 | 'Fake Tester': { |
| 3562 | 'args': { |
| 3563 | '--c_arg': None, |
| 3564 | }, |
| 3565 | }, |
| 3566 | }, |
| 3567 | }, |
| 3568 | } |
| 3569 | """ |
| 3570 | |
| 3571 | |
| 3572 | FOO_TEST_REPLACEMENTS_REMOVE_VALUE = """\ |
| 3573 | { |
| 3574 | 'foo_test': { |
| 3575 | 'replacements': { |
| 3576 | 'Fake Tester': { |
| 3577 | 'args': { |
| 3578 | '--enable-features': None, |
| 3579 | }, |
| 3580 | }, |
| 3581 | }, |
| 3582 | }, |
| 3583 | } |
| 3584 | """ |
| 3585 | |
| 3586 | |
| 3587 | FOO_TEST_REPLACEMENTS_REPLACE_VALUE = """\ |
| 3588 | { |
| 3589 | 'foo_test': { |
| 3590 | 'replacements': { |
| 3591 | 'Fake Tester': { |
| 3592 | 'args': { |
| 3593 | '--enable-features': 'Bar,Baz', |
| 3594 | }, |
| 3595 | }, |
| 3596 | }, |
| 3597 | }, |
| 3598 | } |
| 3599 | """ |
| 3600 | |
| 3601 | |
| 3602 | FOO_TEST_REPLACEMENTS_INVALID_KEY = """\ |
| 3603 | { |
| 3604 | 'foo_test': { |
| 3605 | 'replacements': { |
| 3606 | 'Fake Tester': { |
| 3607 | 'invalid': { |
| 3608 | '--enable-features': 'Bar,Baz', |
| 3609 | }, |
| 3610 | }, |
| 3611 | }, |
| 3612 | }, |
| 3613 | } |
| 3614 | """ |
| 3615 | |
| 3616 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3617 | class ReplacementTests(TestCase): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3618 | """Tests for the arg replacement feature.""" |
| 3619 | def test_replacement_valid_remove_no_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3620 | fbb = FakeBBGen(self.args, |
| 3621 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3622 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3623 | LUCI_MILO_CFG, |
| 3624 | exceptions=FOO_TEST_REPLACEMENTS_REMOVE_NO_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3625 | fbb.check_output_file_consistency(verbose=True) |
| 3626 | self.assertFalse(fbb.printed_lines) |
| 3627 | |
| 3628 | def test_replacement_valid_remove_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3629 | fbb = FakeBBGen(self.args, |
| 3630 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3631 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3632 | LUCI_MILO_CFG, |
| 3633 | exceptions=FOO_TEST_REPLACEMENTS_REMOVE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3634 | fbb.check_output_file_consistency(verbose=True) |
| 3635 | self.assertFalse(fbb.printed_lines) |
| 3636 | |
| 3637 | def test_replacement_valid_replace_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3638 | fbb = FakeBBGen(self.args, |
| 3639 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3640 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3641 | LUCI_MILO_CFG, |
| 3642 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3643 | fbb.check_output_file_consistency(verbose=True) |
| 3644 | self.assertFalse(fbb.printed_lines) |
| 3645 | |
| 3646 | def test_replacement_valid_replace_value_separate_entries(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3647 | fbb = FakeBBGen(self.args, |
| 3648 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3649 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES_SEPARATE_ENTRIES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3650 | LUCI_MILO_CFG, |
| 3651 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3652 | fbb.check_output_file_consistency(verbose=True) |
| 3653 | self.assertFalse(fbb.printed_lines) |
| 3654 | |
| 3655 | def test_replacement_invalid_key_not_valid(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3656 | fbb = FakeBBGen(self.args, |
| 3657 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3658 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3659 | LUCI_MILO_CFG, |
| 3660 | exceptions=FOO_TEST_REPLACEMENTS_INVALID_KEY) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3661 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3662 | 'Given replacement key *'): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3663 | fbb.check_output_file_consistency(verbose=True) |
| 3664 | |
| 3665 | def test_replacement_invalid_key_not_found(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3666 | fbb = FakeBBGen(self.args, |
| 3667 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3668 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3669 | LUCI_MILO_CFG, |
| 3670 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3671 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3672 | 'Could not find *'): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3673 | fbb.check_output_file_consistency(verbose=True) |
| 3674 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3675 | |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3676 | FOO_TEST_SUITE_WITH_MAGIC_ARGS = """\ |
| 3677 | { |
| 3678 | 'basic_suites': { |
| 3679 | 'foo_tests': { |
| 3680 | 'foo_test': { |
| 3681 | 'args': [ |
| 3682 | '$$MAGIC_SUBSTITUTION_TestOnlySubstitution', |
| 3683 | ], |
| 3684 | }, |
| 3685 | }, |
| 3686 | }, |
| 3687 | } |
| 3688 | """ |
| 3689 | |
| 3690 | |
| 3691 | FOO_TEST_SUITE_WITH_INVALID_MAGIC_ARGS = """\ |
| 3692 | { |
| 3693 | 'basic_suites': { |
| 3694 | 'foo_tests': { |
| 3695 | 'foo_test': { |
| 3696 | 'args': [ |
| 3697 | '$$MAGIC_SUBSTITUTION_NotARealSubstitution', |
| 3698 | ], |
| 3699 | }, |
| 3700 | }, |
| 3701 | }, |
| 3702 | } |
| 3703 | """ |
| 3704 | |
| 3705 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3706 | class MagicSubstitutionTests(TestCase): |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3707 | """Tests for the magic substitution feature.""" |
| 3708 | def test_valid_function(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3709 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, |
| 3710 | FOO_TEST_SUITE_WITH_MAGIC_ARGS, LUCI_MILO_CFG) |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3711 | fbb.check_output_file_consistency(verbose=True) |
| 3712 | self.assertFalse(fbb.printed_lines) |
| 3713 | |
| 3714 | def test_invalid_function(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3715 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, |
| 3716 | FOO_TEST_SUITE_WITH_INVALID_MAGIC_ARGS, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3717 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3718 | 'Magic substitution function *'): |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3719 | fbb.check_output_file_consistency(verbose=True) |
| 3720 | |
| 3721 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3722 | # Matrix compound composition test suites |
| 3723 | |
| 3724 | MATRIX_COMPOUND_EMPTY = """\ |
| 3725 | { |
| 3726 | 'basic_suites': { |
| 3727 | 'bar_tests': { |
| 3728 | 'bar_test': {}, |
| 3729 | }, |
| 3730 | 'foo_tests': { |
| 3731 | 'foo_test': {}, |
| 3732 | }, |
| 3733 | }, |
| 3734 | 'matrix_compound_suites': { |
| 3735 | 'matrix_tests': { |
| 3736 | 'foo_tests': {}, |
| 3737 | 'bar_tests': {}, |
| 3738 | }, |
| 3739 | }, |
| 3740 | } |
| 3741 | """ |
| 3742 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 3743 | MATRIX_COMPOUND_EMPTY_WITH_DESCRIPTION = """\ |
| 3744 | { |
| 3745 | 'basic_suites': { |
| 3746 | 'bar_tests': { |
| 3747 | 'bar_test': { |
| 3748 | 'description': 'This is a bar test', |
| 3749 | }, |
| 3750 | }, |
| 3751 | 'foo_tests': { |
| 3752 | 'foo_test': {}, |
| 3753 | }, |
| 3754 | }, |
| 3755 | 'matrix_compound_suites': { |
| 3756 | 'matrix_tests': { |
| 3757 | 'foo_tests': {}, |
| 3758 | 'bar_tests': {}, |
| 3759 | }, |
| 3760 | }, |
| 3761 | } |
| 3762 | """ |
| 3763 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3764 | MATRIX_COMPOUND_MISSING_IDENTIFIER = """\ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3765 | { |
| 3766 | 'basic_suites': { |
| 3767 | 'foo_tests': { |
| 3768 | 'foo_test': {}, |
| 3769 | }, |
| 3770 | }, |
| 3771 | 'matrix_compound_suites': { |
| 3772 | 'matrix_tests': { |
| 3773 | 'foo_tests': { |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3774 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3775 | 'missing-identifier', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3776 | ], |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3777 | }, |
| 3778 | }, |
| 3779 | }, |
| 3780 | } |
| 3781 | """ |
| 3782 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3783 | VARIANTS_FILE_MISSING_IDENTIFIER = """\ |
| 3784 | { |
| 3785 | 'missing-identifier': {} |
| 3786 | } |
| 3787 | """ |
| 3788 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3789 | MATRIX_COMPOUND_EMPTY_IDENTIFIER = """\ |
| 3790 | { |
| 3791 | 'basic_suites': { |
| 3792 | 'foo_tests': { |
| 3793 | 'foo_test': {}, |
| 3794 | }, |
| 3795 | }, |
| 3796 | 'matrix_compound_suites': { |
| 3797 | 'matrix_tests': { |
| 3798 | 'foo_tests': { |
| 3799 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3800 | 'empty-identifier', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3801 | ], |
| 3802 | }, |
| 3803 | }, |
| 3804 | }, |
| 3805 | } |
| 3806 | """ |
| 3807 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3808 | EMPTY_IDENTIFIER_VARIANTS = """\ |
| 3809 | { |
| 3810 | 'empty-identifier': { |
| 3811 | 'identifier': '', |
| 3812 | 'swarming': { |
| 3813 | 'dimensions': { |
| 3814 | 'foo': 'empty identifier not allowed', |
| 3815 | }, |
| 3816 | }, |
| 3817 | }, |
| 3818 | } |
| 3819 | """ |
| 3820 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3821 | MATRIX_COMPOUND_TRAILING_IDENTIFIER = """\ |
| 3822 | { |
| 3823 | 'basic_suites': { |
| 3824 | 'foo_tests': { |
| 3825 | 'foo_test': {}, |
| 3826 | }, |
| 3827 | }, |
| 3828 | 'matrix_compound_suites': { |
| 3829 | 'matrix_tests': { |
| 3830 | 'foo_tests': { |
| 3831 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3832 | 'trailing-whitespace', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3833 | ], |
| 3834 | }, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3835 | }, |
| 3836 | }, |
| 3837 | } |
| 3838 | """ |
| 3839 | |
| 3840 | TRAILING_WHITESPACE_VARIANTS = """\ |
| 3841 | { |
| 3842 | 'trailing-whitespace': { |
| 3843 | 'identifier': 'id ', |
| 3844 | 'swarming': { |
| 3845 | 'dimensions': { |
| 3846 | 'foo': 'trailing whitespace not allowed', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3847 | }, |
| 3848 | }, |
| 3849 | }, |
| 3850 | } |
| 3851 | """ |
| 3852 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3853 | MATRIX_REF_NONEXISTENT = """\ |
| 3854 | { |
| 3855 | 'basic_suites': { |
| 3856 | 'foo_tests': { |
| 3857 | 'foo_test': {}, |
| 3858 | }, |
| 3859 | }, |
| 3860 | 'matrix_compound_suites': { |
| 3861 | 'matrix_tests': { |
| 3862 | 'bar_test': {}, |
| 3863 | }, |
| 3864 | }, |
| 3865 | } |
| 3866 | """ |
| 3867 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3868 | MATRIX_COMPOUND_REF_COMPOSITION = """\ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3869 | { |
| 3870 | 'basic_suites': { |
| 3871 | 'foo_tests': { |
| 3872 | 'foo_test': {}, |
| 3873 | }, |
| 3874 | }, |
| 3875 | 'compound_suites': { |
| 3876 | 'sample_composition': { |
| 3877 | 'foo_tests': {}, |
| 3878 | }, |
| 3879 | }, |
| 3880 | 'matrix_compound_suites': { |
| 3881 | 'matrix_tests': { |
| 3882 | 'sample_composition': {}, |
| 3883 | }, |
| 3884 | }, |
| 3885 | } |
| 3886 | """ |
| 3887 | |
| 3888 | MATRIX_COMPOSITION_REF_MATRIX = """\ |
| 3889 | { |
| 3890 | 'basic_suites': { |
| 3891 | 'foo_tests': { |
| 3892 | 'foo_test': {}, |
| 3893 | }, |
| 3894 | }, |
| 3895 | 'matrix_compound_suites': { |
| 3896 | 'a_test': { |
| 3897 | 'foo_tests': {}, |
| 3898 | }, |
| 3899 | 'matrix_tests': { |
| 3900 | 'a_test': {}, |
| 3901 | }, |
| 3902 | }, |
| 3903 | } |
| 3904 | """ |
| 3905 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3906 | MATRIX_COMPOUND_VARIANTS_MIXINS_MERGE = """\ |
| 3907 | { |
| 3908 | 'basic_suites': { |
| 3909 | 'foo_tests': { |
| 3910 | 'set': { |
| 3911 | 'mixins': [ 'test_mixin' ], |
| 3912 | }, |
| 3913 | }, |
| 3914 | }, |
| 3915 | 'matrix_compound_suites': { |
| 3916 | 'matrix_tests': { |
| 3917 | 'foo_tests': { |
| 3918 | 'variants': [ |
| 3919 | { |
| 3920 | 'mixins': [ 'dimension_mixin' ], |
| 3921 | }, |
| 3922 | ], |
| 3923 | }, |
| 3924 | }, |
| 3925 | }, |
| 3926 | } |
| 3927 | """ |
| 3928 | |
| 3929 | MATRIX_COMPOUND_VARIANTS_MIXINS = """\ |
| 3930 | { |
| 3931 | 'basic_suites': { |
| 3932 | 'foo_tests': { |
| 3933 | 'set': { |
| 3934 | 'mixins': [ 'test_mixin' ], |
| 3935 | }, |
| 3936 | }, |
| 3937 | }, |
| 3938 | 'matrix_compound_suites': { |
| 3939 | 'matrix_tests': { |
| 3940 | 'foo_tests': { |
| 3941 | 'variants': [ |
| 3942 | { |
| 3943 | 'mixins': [ |
| 3944 | 'dimension_mixin', |
| 3945 | 'waterfall_mixin', |
| 3946 | 'builder_mixin', |
| 3947 | 'random_mixin' |
| 3948 | ], |
| 3949 | }, |
| 3950 | ], |
| 3951 | }, |
| 3952 | }, |
| 3953 | }, |
| 3954 | } |
| 3955 | """ |
| 3956 | |
| 3957 | MATRIX_COMPOUND_VARIANTS_MIXINS_REMOVE = """\ |
| 3958 | { |
| 3959 | 'basic_suites': { |
| 3960 | 'foo_tests': { |
| 3961 | 'set': { |
| 3962 | 'remove_mixins': ['builder_mixin'], |
| 3963 | }, |
| 3964 | }, |
| 3965 | }, |
| 3966 | 'matrix_compound_suites': { |
| 3967 | 'matrix_tests': { |
| 3968 | 'foo_tests': { |
| 3969 | 'variants': [ |
| 3970 | { |
| 3971 | 'mixins': [ 'builder_mixin' ], |
| 3972 | } |
| 3973 | ], |
| 3974 | }, |
| 3975 | }, |
| 3976 | }, |
| 3977 | } |
| 3978 | """ |
| 3979 | |
| 3980 | MATRIX_COMPOUND_CONFLICTING_TEST_SUITES = """\ |
| 3981 | { |
| 3982 | 'basic_suites': { |
| 3983 | 'bar_tests': { |
| 3984 | 'baz_tests': { |
| 3985 | 'args': [ |
| 3986 | '--bar', |
| 3987 | ], |
| 3988 | } |
| 3989 | }, |
| 3990 | 'foo_tests': { |
| 3991 | 'baz_tests': { |
| 3992 | 'args': [ |
| 3993 | '--foo', |
| 3994 | ], |
| 3995 | } |
| 3996 | }, |
| 3997 | }, |
| 3998 | 'matrix_compound_suites': { |
| 3999 | 'matrix_tests': { |
| 4000 | 'bar_tests': { |
| 4001 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4002 | 'a_variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4003 | ], |
| 4004 | }, |
| 4005 | 'foo_tests': { |
| 4006 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4007 | 'a_variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4008 | ] |
| 4009 | } |
| 4010 | }, |
| 4011 | }, |
| 4012 | } |
| 4013 | """ |
| 4014 | |
Garrett Beaty | 60a7b2a | 2023-09-13 23:00:40 | [diff] [blame] | 4015 | MATRIX_COMPOUND_EMPTY_VARIANTS = """\ |
| 4016 | { |
| 4017 | 'basic_suites': { |
| 4018 | 'foo_tests': { |
| 4019 | 'baz_tests': { |
| 4020 | 'args': [ |
| 4021 | '--foo', |
| 4022 | ], |
| 4023 | } |
| 4024 | }, |
| 4025 | }, |
| 4026 | 'matrix_compound_suites': { |
| 4027 | 'matrix_tests': { |
| 4028 | 'foo_tests': { |
| 4029 | 'variants': [], |
| 4030 | } |
| 4031 | }, |
| 4032 | }, |
| 4033 | } |
| 4034 | """ |
| 4035 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4036 | MATRIX_COMPOUND_TARGETS_ARGS = """\ |
| 4037 | { |
| 4038 | 'basic_suites': { |
| 4039 | 'foo_tests': { |
| 4040 | 'args_test': { |
| 4041 | 'args': [ |
| 4042 | '--iam' |
| 4043 | ], |
| 4044 | }, |
| 4045 | } |
| 4046 | }, |
| 4047 | 'matrix_compound_suites': { |
| 4048 | 'matrix_tests': { |
| 4049 | 'foo_tests': { |
| 4050 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4051 | 'an-arg', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4052 | ], |
| 4053 | }, |
| 4054 | }, |
| 4055 | }, |
| 4056 | } |
| 4057 | """ |
| 4058 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4059 | ARGS_VARIANTS_FILE = """\ |
| 4060 | { |
| 4061 | 'an-arg': { |
| 4062 | 'identifier': 'args', |
| 4063 | 'args': [ |
| 4064 | '--anarg', |
| 4065 | ], |
| 4066 | }, |
| 4067 | } |
| 4068 | """ |
| 4069 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4070 | MATRIX_COMPOUND_TARGETS_MIXINS = """\ |
| 4071 | { |
| 4072 | 'basic_suites': { |
| 4073 | 'foo_tests': { |
| 4074 | 'mixins_test': { |
| 4075 | 'mixins': [ 'test_mixin' ], |
| 4076 | }, |
| 4077 | } |
| 4078 | }, |
| 4079 | 'matrix_compound_suites': { |
| 4080 | 'matrix_tests': { |
| 4081 | 'foo_tests': { |
Jeff Yoon | 85fb8df | 2020-08-20 16:47:43 | [diff] [blame] | 4082 | 'mixins': [ 'random_mixin' ], |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4083 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4084 | 'mixins', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4085 | ], |
| 4086 | }, |
| 4087 | }, |
| 4088 | }, |
| 4089 | } |
| 4090 | """ |
| 4091 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4092 | MIXINS_VARIANTS_FILE = """\ |
| 4093 | { |
| 4094 | 'mixins': { |
| 4095 | 'identifier': 'mixins', |
| 4096 | 'mixins': [ 'dimension_mixin' ], |
| 4097 | }, |
| 4098 | } |
| 4099 | """ |
| 4100 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4101 | MATRIX_COMPOUND_TARGETS_SWARMING = """\ |
| 4102 | { |
| 4103 | 'basic_suites': { |
| 4104 | 'foo_tests': { |
| 4105 | 'swarming_test': { |
| 4106 | 'swarming': { |
| 4107 | 'foo': 'bar', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4108 | 'dimensions': { |
| 4109 | 'foo': 'bar', |
| 4110 | }, |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4111 | }, |
| 4112 | }, |
| 4113 | } |
| 4114 | }, |
| 4115 | 'matrix_compound_suites': { |
| 4116 | 'matrix_tests': { |
| 4117 | 'foo_tests': { |
| 4118 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4119 | 'swarming-variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4120 | ], |
| 4121 | }, |
| 4122 | }, |
| 4123 | }, |
| 4124 | } |
| 4125 | """ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4126 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4127 | SWARMING_VARIANTS_FILE = """\ |
| 4128 | { |
| 4129 | 'swarming-variant': { |
| 4130 | 'identifier': 'swarming', |
| 4131 | 'swarming': { |
| 4132 | 'a': 'b', |
| 4133 | 'dimensions': { |
| 4134 | 'hello': 'world', |
| 4135 | }, |
| 4136 | }, |
| 4137 | }, |
| 4138 | } |
| 4139 | """ |
| 4140 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4141 | MATRIX_COMPOUND_VARIANTS_REF = """\ |
| 4142 | { |
| 4143 | 'basic_suites': { |
| 4144 | 'foo_tests': { |
| 4145 | 'swarming_test': {}, |
| 4146 | } |
| 4147 | }, |
| 4148 | 'matrix_compound_suites': { |
| 4149 | 'matrix_tests': { |
| 4150 | 'foo_tests': { |
| 4151 | 'variants': [ |
| 4152 | 'a_variant' |
| 4153 | ], |
| 4154 | }, |
| 4155 | }, |
| 4156 | }, |
| 4157 | } |
| 4158 | """ |
| 4159 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4160 | MATRIX_COMPOUND_VARIANTS_REF_WITH_DESCRIPTION = """\ |
| 4161 | { |
| 4162 | 'basic_suites': { |
| 4163 | 'foo_tests': { |
| 4164 | 'swarming_test': { |
| 4165 | 'description': 'This is a swarming test.' |
| 4166 | }, |
| 4167 | } |
| 4168 | }, |
| 4169 | 'matrix_compound_suites': { |
| 4170 | 'matrix_tests': { |
| 4171 | 'foo_tests': { |
| 4172 | 'variants': [ |
| 4173 | 'a_variant' |
| 4174 | ], |
| 4175 | }, |
| 4176 | }, |
| 4177 | }, |
| 4178 | } |
| 4179 | """ |
| 4180 | |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4181 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY = """\ |
| 4182 | { |
| 4183 | 'basic_suites': { |
| 4184 | 'foo_tests': { |
| 4185 | 'swarming_test': { |
| 4186 | 'test': 'foo_test_apk' |
| 4187 | }, |
| 4188 | } |
| 4189 | }, |
| 4190 | 'matrix_compound_suites': { |
| 4191 | 'matrix_tests': { |
| 4192 | 'foo_tests': { |
| 4193 | 'variants': [ |
| 4194 | 'a_variant', |
| 4195 | ], |
| 4196 | }, |
| 4197 | }, |
| 4198 | }, |
| 4199 | } |
| 4200 | """ |
| 4201 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4202 | MATRIX_COMPOUND_MIXED_VARIANTS_REF = """\ |
| 4203 | { |
| 4204 | 'basic_suites': { |
| 4205 | 'foo_tests': { |
| 4206 | 'swarming_test': {}, |
| 4207 | } |
| 4208 | }, |
| 4209 | 'matrix_compound_suites': { |
| 4210 | 'matrix_tests': { |
| 4211 | 'foo_tests': { |
| 4212 | 'variants': [ |
| 4213 | 'a_variant', |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4214 | 'b_variant', |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4215 | ], |
| 4216 | }, |
| 4217 | }, |
| 4218 | }, |
| 4219 | } |
| 4220 | """ |
| 4221 | |
| 4222 | VARIANTS_FILE = """\ |
| 4223 | { |
| 4224 | 'a_variant': { |
| 4225 | 'args': [ |
| 4226 | '--platform', |
| 4227 | 'device', |
| 4228 | '--version', |
| 4229 | '1' |
| 4230 | ], |
| 4231 | 'identifier': 'a_variant' |
| 4232 | } |
| 4233 | } |
| 4234 | """ |
| 4235 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4236 | VARIANTS_FILE_WITH_DESCRIPTION = """\ |
| 4237 | { |
| 4238 | 'a_variant': { |
| 4239 | 'identifier': 'a_variant', |
| 4240 | 'description': 'Variant description.' |
| 4241 | } |
| 4242 | } |
| 4243 | """ |
| 4244 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4245 | MULTI_VARIANTS_FILE = """\ |
| 4246 | { |
| 4247 | 'a_variant': { |
| 4248 | 'args': [ |
| 4249 | '--platform', |
| 4250 | 'device', |
| 4251 | '--version', |
| 4252 | '1' |
| 4253 | ], |
| 4254 | 'identifier': 'a_variant' |
| 4255 | }, |
| 4256 | 'b_variant': { |
| 4257 | 'args': [ |
| 4258 | '--platform', |
| 4259 | 'sim', |
| 4260 | '--version', |
| 4261 | '2' |
| 4262 | ], |
| 4263 | 'identifier': 'b_variant' |
| 4264 | } |
| 4265 | } |
| 4266 | """ |
| 4267 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4268 | # # Dictionary composition test suite outputs |
| 4269 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4270 | EMPTY_SKYLAB_TEST_EXCEPTIONS = """\ |
| 4271 | { |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4272 | 'tast.foo OCTOPUS_TOT': { |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4273 | 'remove_from': [ |
| 4274 | 'Fake Tester', |
| 4275 | ] |
| 4276 | }, |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4277 | 'tast.foo OCTOPUS_TOT-1': { |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4278 | 'remove_from': [ |
| 4279 | 'Fake Tester', |
| 4280 | ] |
| 4281 | } |
| 4282 | } |
| 4283 | """ |
| 4284 | |
yoshiki iguchi | d1664ef | 2024-03-28 19:16:52 | [diff] [blame] | 4285 | MATRIX_SKYLAB_WATERFALL_WITH_NO_CROS_BOARD = """\ |
| 4286 | [ |
| 4287 | { |
| 4288 | 'project': 'chromium', |
| 4289 | 'bucket': 'ci', |
| 4290 | 'name': 'chromium.test', |
| 4291 | 'machines': { |
| 4292 | 'Fake Tester': { |
| 4293 | 'test_suites': { |
| 4294 | 'skylab_tests': 'cros_skylab_basic_x86', |
| 4295 | }, |
| 4296 | }, |
| 4297 | }, |
| 4298 | }, |
| 4299 | ] |
| 4300 | """ |
| 4301 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4302 | MATRIX_SKYLAB_WATERFALL = """\ |
| 4303 | [ |
| 4304 | { |
| 4305 | 'project': 'chromium', |
| 4306 | 'bucket': 'ci', |
| 4307 | 'name': 'chromium.test', |
| 4308 | 'machines': { |
| 4309 | 'Fake Tester': { |
| 4310 | 'test_suites': { |
| 4311 | 'skylab_tests': 'cros_skylab_basic_x86', |
| 4312 | }, |
yoshiki iguchi | d1664ef | 2024-03-28 19:16:52 | [diff] [blame] | 4313 | 'cros_board': 'octopus', |
| 4314 | 'cros_dut_pool': 'chromium', |
Qijiang Fan | 107d40de | 2024-05-24 06:11:19 | [diff] [blame] | 4315 | 'run_cft': True, |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4316 | }, |
| 4317 | }, |
| 4318 | }, |
| 4319 | ] |
| 4320 | """ |
| 4321 | |
Qijiang Fan | 9032762d | 2024-06-25 06:02:24 | [diff] [blame] | 4322 | MATRIX_SKYLAB_WATERFALL_WITH_BUILD_TARGET_VARIANT = """\ |
| 4323 | [ |
| 4324 | { |
| 4325 | 'project': 'chromium', |
| 4326 | 'bucket': 'ci', |
| 4327 | 'name': 'chromium.test', |
| 4328 | 'machines': { |
| 4329 | 'Fake Tester': { |
| 4330 | 'test_suites': { |
| 4331 | 'skylab_tests': 'cros_skylab_basic_x86', |
| 4332 | }, |
| 4333 | 'cros_board': 'octopus', |
| 4334 | 'cros_build_target': 'octopus-arc-t', |
| 4335 | 'cros_dut_pool': 'chromium', |
| 4336 | 'run_cft': True, |
| 4337 | }, |
| 4338 | }, |
| 4339 | }, |
| 4340 | ] |
| 4341 | """ |
| 4342 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4343 | MATRIX_COMPOUND_SKYLAB_REF = """\ |
| 4344 | { |
| 4345 | 'basic_suites': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4346 | 'autotest_suites': { |
| 4347 | 'autotest_suite': { |
| 4348 | }, |
| 4349 | }, |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4350 | 'cros_skylab_basic': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4351 | 'benchmark_suite': { |
| 4352 | 'benchmark': 'something', |
| 4353 | }, |
| 4354 | 'chrome_all_tast_tests': { |
| 4355 | 'tast_expr': 'dummy expr', |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4356 | 'timeout': 3600, |
| 4357 | }, |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4358 | 'gtest_suite': { }, |
| 4359 | 'lacros_all_tast_tests': { |
| 4360 | 'tast_expr': 'lacros expr', |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4361 | 'timeout': 3600, |
| 4362 | }, |
| 4363 | }, |
| 4364 | }, |
| 4365 | 'compound_suites': {}, |
| 4366 | 'matrix_compound_suites': { |
| 4367 | 'cros_skylab_basic_x86': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4368 | 'autotest_suites': { |
| 4369 | 'variants': [ |
| 4370 | 'octopus-89-with-autotest-name', |
| 4371 | ], |
| 4372 | }, |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4373 | 'cros_skylab_basic': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4374 | 'tast_expr': 'dummy expr', |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4375 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4376 | 'octopus-89', |
| 4377 | 'octopus-88', |
| 4378 | ], |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4379 | }, |
| 4380 | }, |
| 4381 | }, |
| 4382 | } |
| 4383 | """ |
| 4384 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4385 | SKYLAB_VARIANTS = """\ |
| 4386 | { |
| 4387 | 'octopus-89': { |
| 4388 | 'skylab': { |
| 4389 | 'cros_board': 'octopus', |
yoshiki iguchi | d1664ef | 2024-03-28 19:16:52 | [diff] [blame] | 4390 | 'cros_model': 'casta', |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4391 | 'cros_chrome_version': '89.0.3234.0', |
| 4392 | 'cros_img': 'octopus-release/R89-13655.0.0', |
| 4393 | }, |
| 4394 | 'enabled': True, |
| 4395 | 'identifier': 'OCTOPUS_TOT', |
| 4396 | }, |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4397 | 'octopus-89-with-autotest-name': { |
| 4398 | 'skylab': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4399 | 'cros_chrome_version': '89.0.3234.0', |
| 4400 | 'cros_img': 'octopus-release/R89-13655.0.0', |
| 4401 | 'autotest_name': 'unique_autotest_name', |
| 4402 | }, |
| 4403 | 'enabled': True, |
| 4404 | 'identifier': 'OCTOPUS_TOT', |
| 4405 | }, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4406 | 'octopus-88': { |
| 4407 | 'skylab': { |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4408 | 'cros_chrome_version': '88.0.2324.0', |
| 4409 | 'cros_img': 'octopus-release/R88-13597.23.0', |
| 4410 | }, |
| 4411 | 'enabled': True, |
| 4412 | 'identifier': 'OCTOPUS_TOT-1', |
| 4413 | }, |
| 4414 | } |
| 4415 | """ |
| 4416 | |
Qijiang Fan | 9032762d | 2024-06-25 06:02:24 | [diff] [blame] | 4417 | SKYLAB_VARIANTS_WITH_BUILD_VARIANT = """\ |
| 4418 | { |
| 4419 | 'octopus-89': { |
| 4420 | 'skylab': { |
| 4421 | 'cros_board': 'octopus', |
| 4422 | 'cros_model': 'casta', |
| 4423 | 'cros_chrome_version': '89.0.3234.0', |
| 4424 | 'cros_img': 'octopus-arc-t-release/R89-13655.0.0', |
| 4425 | }, |
| 4426 | 'enabled': True, |
| 4427 | 'identifier': 'OCTOPUS_TOT', |
| 4428 | }, |
| 4429 | 'octopus-89-with-autotest-name': { |
| 4430 | 'skylab': { |
| 4431 | 'cros_chrome_version': '89.0.3234.0', |
| 4432 | 'cros_img': 'octopus-arc-t-release/R89-13655.0.0', |
| 4433 | 'autotest_name': 'unique_autotest_name', |
| 4434 | }, |
| 4435 | 'enabled': True, |
| 4436 | 'identifier': 'OCTOPUS_TOT', |
| 4437 | }, |
| 4438 | 'octopus-88': { |
| 4439 | 'skylab': { |
| 4440 | 'cros_chrome_version': '88.0.2324.0', |
| 4441 | 'cros_img': 'octopus-arc-t-release/R88-13597.23.0', |
| 4442 | }, |
| 4443 | 'enabled': True, |
| 4444 | 'identifier': 'OCTOPUS_TOT-1', |
| 4445 | }, |
| 4446 | } |
| 4447 | """ |
| 4448 | |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4449 | ENABLED_AND_DISABLED_MATRIX_COMPOUND_SKYLAB_REF = """\ |
| 4450 | { |
| 4451 | 'basic_suites': { |
| 4452 | 'cros_skylab_basic': { |
| 4453 | 'tast.basic': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4454 | 'tast_expr': 'dummy expr', |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4455 | 'suite': 'tast.basic', |
yoshiki iguchi | a5f87c7d | 2024-06-19 02:48:34 | [diff] [blame] | 4456 | 'shard_level_retries_on_ctp': 2, |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4457 | 'timeout': 3600, |
| 4458 | }, |
| 4459 | 'tast.foo': { |
Sven Zheng | 22ba631 | 2023-10-16 22:59:35 | [diff] [blame] | 4460 | 'tast_expr': 'dummy expr', |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4461 | 'suite': 'tast.foo', |
| 4462 | 'timeout': 3600, |
| 4463 | }, |
| 4464 | }, |
| 4465 | }, |
| 4466 | 'compound_suites': {}, |
| 4467 | 'matrix_compound_suites': { |
| 4468 | 'cros_skylab_basic_x86': { |
| 4469 | 'cros_skylab_basic': { |
| 4470 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4471 | 'enabled', |
| 4472 | 'disabled', |
| 4473 | ], |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4474 | }, |
| 4475 | }, |
| 4476 | }, |
| 4477 | } |
| 4478 | """ |
| 4479 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4480 | ENABLED_AND_DISABLED_VARIANTS = """\ |
| 4481 | { |
| 4482 | 'enabled': { |
| 4483 | 'skylab': { |
| 4484 | 'cros_board': 'octopus', |
| 4485 | 'cros_chrome_version': '89.0.3234.0', |
| 4486 | 'cros_img': 'octopus-release/R89-13655.0.0', |
| 4487 | }, |
| 4488 | 'enabled': True, |
| 4489 | 'identifier': 'OCTOPUS_TOT', |
| 4490 | }, |
| 4491 | 'disabled': { |
| 4492 | 'skylab': { |
| 4493 | 'cros_board': 'octopus', |
| 4494 | 'cros_chrome_version': '88.0.2324.0', |
| 4495 | 'cros_img': 'octopus-release/R88-13597.23.0', |
| 4496 | }, |
| 4497 | 'enabled': False, |
| 4498 | 'identifier': 'OCTOPUS_TOT-1', |
| 4499 | }, |
| 4500 | } |
| 4501 | """ |
| 4502 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4503 | |
| 4504 | class MatrixCompositionTests(TestCase): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4505 | |
| 4506 | def test_good_structure_no_configs(self): |
| 4507 | """ |
| 4508 | Tests matrix compound test suite structure with no configs, |
| 4509 | no conflicts and no bad references |
| 4510 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4511 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4512 | MATRIX_COMPOUND_EMPTY, LUCI_MILO_CFG) |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4513 | fbb.check_output_file_consistency(verbose=True) |
| 4514 | self.assertFalse(fbb.printed_lines) |
| 4515 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4516 | def test_good_structure_with_description(self): |
| 4517 | """ |
| 4518 | Tests matrix compound test suite structure with description. |
| 4519 | """ |
| 4520 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4521 | MATRIX_COMPOUND_EMPTY_WITH_DESCRIPTION, LUCI_MILO_CFG) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4522 | fbb.check_output_file_consistency(verbose=True) |
| 4523 | self.assertFalse(fbb.printed_lines) |
| 4524 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4525 | def test_missing_identifier(self): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4526 | """ |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4527 | Variant is missing an identifier |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4528 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4529 | fbb = FakeBBGen(self.args, |
| 4530 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4531 | MATRIX_COMPOUND_MISSING_IDENTIFIER, |
| 4532 | LUCI_MILO_CFG, |
| 4533 | variants=VARIANTS_FILE_MISSING_IDENTIFIER) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4534 | with self.assertRaisesRegex( |
| 4535 | generate_buildbot_json.BBGenErr, |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4536 | 'Missing required identifier field in matrix compound suite*'): |
| 4537 | fbb.check_output_file_consistency(verbose=True) |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4538 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4539 | def test_empty_identifier(self): |
| 4540 | """ |
| 4541 | Variant identifier is empty. |
| 4542 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4543 | fbb = FakeBBGen(self.args, |
| 4544 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4545 | MATRIX_COMPOUND_EMPTY_IDENTIFIER, |
| 4546 | LUCI_MILO_CFG, |
| 4547 | variants=EMPTY_IDENTIFIER_VARIANTS) |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4548 | with self.assertRaisesRegex( |
| 4549 | generate_buildbot_json.BBGenErr, |
| 4550 | 'Identifier field can not be "" in matrix compound suite*'): |
| 4551 | fbb.check_output_file_consistency(verbose=True) |
| 4552 | |
| 4553 | def test_trailing_identifier(self): |
| 4554 | """ |
| 4555 | Variant identifier has trailing whitespace. |
| 4556 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4557 | fbb = FakeBBGen(self.args, |
| 4558 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4559 | MATRIX_COMPOUND_TRAILING_IDENTIFIER, |
| 4560 | LUCI_MILO_CFG, |
| 4561 | variants=TRAILING_WHITESPACE_VARIANTS) |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4562 | with self.assertRaisesRegex( |
| 4563 | generate_buildbot_json.BBGenErr, |
| 4564 | 'Identifier field can not have leading and trailing whitespace in' |
| 4565 | ' matrix compound suite*'): |
| 4566 | fbb.check_output_file_consistency(verbose=True) |
| 4567 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4568 | def test_noexistent_ref(self): |
| 4569 | """ |
| 4570 | Test referencing a non-existent basic test suite |
| 4571 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4572 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4573 | MATRIX_REF_NONEXISTENT, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4574 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4575 | 'Unable to find reference to *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4576 | fbb.check_output_file_consistency(verbose=True) |
| 4577 | |
| 4578 | def test_ref_to_composition(self): |
| 4579 | """ |
| 4580 | Test referencing another composition test suite |
| 4581 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4582 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4583 | MATRIX_COMPOUND_REF_COMPOSITION, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4584 | with self.assertRaisesRegex( |
| 4585 | generate_buildbot_json.BBGenErr, |
| 4586 | 'matrix_compound_suites may not refer to other *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4587 | fbb.check_output_file_consistency(verbose=True) |
| 4588 | |
| 4589 | def test_ref_to_matrix(self): |
| 4590 | """ |
| 4591 | Test referencing another matrix test suite |
| 4592 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4593 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4594 | MATRIX_COMPOSITION_REF_MATRIX, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4595 | with self.assertRaisesRegex( |
| 4596 | generate_buildbot_json.BBGenErr, |
| 4597 | 'matrix_compound_suites may not refer to other *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4598 | fbb.check_output_file_consistency(verbose=True) |
| 4599 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4600 | def test_conflicting_names(self): |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4601 | fbb = FakeBBGen(self.args, |
| 4602 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4603 | MATRIX_COMPOUND_CONFLICTING_TEST_SUITES, |
| 4604 | LUCI_MILO_CFG, |
| 4605 | variants=VARIANTS_FILE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4606 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4607 | 'Conflicting test definitions.*'): |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4608 | fbb.check_input_file_consistency(verbose=True) |
| 4609 | self.assertFalse(fbb.printed_lines) |
| 4610 | |
Garrett Beaty | 60a7b2a | 2023-09-13 23:00:40 | [diff] [blame] | 4611 | def test_empty_variants(self): |
| 4612 | fbb = FakeBBGen(self.args, |
| 4613 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4614 | MATRIX_COMPOUND_EMPTY_VARIANTS, |
| 4615 | LUCI_MILO_CFG, |
| 4616 | mixins=SWARMING_MIXINS) |
| 4617 | fbb.check_output_file_consistency(verbose=True) |
| 4618 | self.assertFalse(fbb.printed_lines) |
| 4619 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4620 | def test_variants_swarming_dict_merge_args(self): |
| 4621 | """ |
| 4622 | Test targets with swarming dictionary defined by both basic and matrix |
| 4623 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4624 | fbb = FakeBBGen(self.args, |
| 4625 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4626 | MATRIX_COMPOUND_TARGETS_ARGS, |
| 4627 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4628 | mixins=SWARMING_MIXINS, |
| 4629 | variants=ARGS_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4630 | fbb.check_output_file_consistency(verbose=True) |
| 4631 | self.assertFalse(fbb.printed_lines) |
| 4632 | |
| 4633 | def test_variants_swarming_dict_merge_mixins(self): |
| 4634 | """ |
| 4635 | Test targets with swarming dictionary defined by both basic and matrix |
| 4636 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4637 | fbb = FakeBBGen(self.args, |
| 4638 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4639 | MATRIX_COMPOUND_TARGETS_MIXINS, |
| 4640 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4641 | mixins=SWARMING_MIXINS, |
| 4642 | variants=MIXINS_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4643 | fbb.check_output_file_consistency(verbose=True) |
| 4644 | self.assertFalse(fbb.printed_lines) |
| 4645 | |
| 4646 | def test_variants_swarming_dict_swarming(self): |
| 4647 | """ |
| 4648 | Test targets with swarming dictionary defined by both basic and matrix |
| 4649 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4650 | fbb = FakeBBGen(self.args, |
| 4651 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4652 | MATRIX_COMPOUND_TARGETS_SWARMING, |
| 4653 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4654 | variants=SWARMING_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4655 | fbb.check_output_file_consistency(verbose=True) |
| 4656 | self.assertFalse(fbb.printed_lines) |
| 4657 | |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4658 | def test_variant_test_suite_with_test_key(self): |
| 4659 | """ |
| 4660 | Test targets in matrix compound test suites with variants |
| 4661 | """ |
| 4662 | fbb = FakeBBGen(self.args, |
| 4663 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4664 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY, |
| 4665 | LUCI_MILO_CFG, |
| 4666 | variants=VARIANTS_FILE) |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4667 | fbb.check_output_file_consistency(verbose=True) |
| 4668 | self.assertFalse(fbb.printed_lines) |
| 4669 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4670 | def test_variants_with_description(self): |
| 4671 | """Test variants with description field""" |
| 4672 | fbb = FakeBBGen(self.args, |
| 4673 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4674 | MATRIX_COMPOUND_VARIANTS_REF, |
| 4675 | LUCI_MILO_CFG, |
| 4676 | variants=VARIANTS_FILE_WITH_DESCRIPTION) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4677 | fbb.check_output_file_consistency(verbose=True) |
| 4678 | self.assertFalse(fbb.printed_lines) |
| 4679 | |
| 4680 | def test_both_test_suite_and_variants_with_description(self): |
| 4681 | """Test both test suite and variants with description field""" |
| 4682 | fbb = FakeBBGen(self.args, |
| 4683 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4684 | MATRIX_COMPOUND_VARIANTS_REF_WITH_DESCRIPTION, |
| 4685 | LUCI_MILO_CFG, |
| 4686 | variants=VARIANTS_FILE_WITH_DESCRIPTION) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4687 | fbb.check_output_file_consistency(verbose=True) |
| 4688 | self.assertFalse(fbb.printed_lines) |
| 4689 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4690 | def test_variants_pyl_ref(self): |
| 4691 | """Test targets with variants string ref""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4692 | fbb = FakeBBGen(self.args, |
| 4693 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4694 | MATRIX_COMPOUND_VARIANTS_REF, |
| 4695 | LUCI_MILO_CFG, |
| 4696 | variants=VARIANTS_FILE) |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4697 | fbb.check_output_file_consistency(verbose=True) |
| 4698 | self.assertFalse(fbb.printed_lines) |
| 4699 | |
| 4700 | def test_variants_pyl_no_ref(self): |
| 4701 | """Test targets with variants string ref, not defined in variants.pyl""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4702 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4703 | MATRIX_COMPOUND_VARIANTS_REF, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4704 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4705 | 'Missing variant definition for *'): |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4706 | fbb.check_output_file_consistency(verbose=True) |
| 4707 | |
| 4708 | def test_variants_pyl_all_unreferenced(self): |
| 4709 | """Test targets with variants in variants.pyl, unreferenced in tests""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4710 | fbb = FakeBBGen(self.args, |
| 4711 | MATRIX_GTEST_SUITE_WATERFALL, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4712 | MATRIX_COMPOUND_VARIANTS_REF, |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4713 | LUCI_MILO_CFG, |
| 4714 | variants=MULTI_VARIANTS_FILE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4715 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4716 | 'The following variants were unreferenced *'): |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4717 | fbb.check_input_file_consistency(verbose=True) |
| 4718 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4719 | def test_good_skylab_matrix_with_variants(self): |
| 4720 | fbb = FakeBBGen(self.args, |
| 4721 | MATRIX_SKYLAB_WATERFALL, |
| 4722 | MATRIX_COMPOUND_SKYLAB_REF, |
| 4723 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4724 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4725 | variants=SKYLAB_VARIANTS) |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4726 | fbb.check_input_file_consistency(verbose=True) |
| 4727 | fbb.check_output_file_consistency(verbose=True) |
| 4728 | self.assertFalse(fbb.printed_lines) |
| 4729 | |
Qijiang Fan | 9032762d | 2024-06-25 06:02:24 | [diff] [blame] | 4730 | def test_good_skylab_matrix_with_build_target_variant_and_variants(self): |
| 4731 | fbb = FakeBBGen(self.args, |
| 4732 | MATRIX_SKYLAB_WATERFALL_WITH_BUILD_TARGET_VARIANT, |
| 4733 | MATRIX_COMPOUND_SKYLAB_REF, |
| 4734 | LUCI_MILO_CFG, |
| 4735 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4736 | variants=SKYLAB_VARIANTS_WITH_BUILD_VARIANT) |
| 4737 | fbb.check_input_file_consistency(verbose=True) |
| 4738 | fbb.check_output_file_consistency(verbose=True) |
| 4739 | self.assertFalse(fbb.printed_lines) |
| 4740 | |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4741 | def test_enabled_and_disabled_skylab_matrix_with_variants(self): |
| 4742 | """Test with disabled variants""" |
| 4743 | fbb = FakeBBGen(self.args, |
| 4744 | MATRIX_SKYLAB_WATERFALL, |
| 4745 | ENABLED_AND_DISABLED_MATRIX_COMPOUND_SKYLAB_REF, |
| 4746 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4747 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4748 | variants=ENABLED_AND_DISABLED_VARIANTS) |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4749 | # some skylab test variant is disabled; the corresponding skylab tests |
| 4750 | # is not generated. |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4751 | fbb.check_input_file_consistency(verbose=True) |
| 4752 | fbb.check_output_file_consistency(verbose=True) |
| 4753 | self.assertFalse(fbb.printed_lines) |
| 4754 | |
yoshiki iguchi | d1664ef | 2024-03-28 19:16:52 | [diff] [blame] | 4755 | def test_invalid_skylab_matrix_with_variants(self): |
| 4756 | fbb = FakeBBGen(self.args, |
| 4757 | MATRIX_SKYLAB_WATERFALL_WITH_NO_CROS_BOARD, |
| 4758 | MATRIX_COMPOUND_SKYLAB_REF, |
| 4759 | LUCI_MILO_CFG, |
| 4760 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4761 | variants=SKYLAB_VARIANTS) |
| 4762 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4763 | 'skylab tests must specify cros_board.'): |
| 4764 | fbb.check_output_file_consistency(verbose=True) |
| 4765 | self.assertFalse(fbb.printed_lines) |
| 4766 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4767 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4768 | MAC_TEST_SUITE = """\ |
| 4769 | { |
| 4770 | 'basic_suites': { |
| 4771 | 'foo_tests': { |
| 4772 | 'foo_test': { |
| 4773 | }, |
| 4774 | }, |
| 4775 | }, |
| 4776 | } |
| 4777 | """ |
| 4778 | |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4779 | NO_DIMENSIONS_GTESTS_WATERFALL = """\ |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4780 | [ |
| 4781 | { |
| 4782 | 'project': 'chromium', |
| 4783 | 'bucket': 'ci', |
| 4784 | 'name': 'chromium.test', |
| 4785 | 'machines': { |
| 4786 | 'Mac': { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 4787 | 'swarming': {}, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4788 | 'test_suites': { |
| 4789 | 'gtest_tests': 'foo_tests', |
| 4790 | }, |
| 4791 | }, |
| 4792 | }, |
| 4793 | }, |
| 4794 | ] |
| 4795 | """ |
| 4796 | |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4797 | NO_OS_GTESTS_WATERFALL = """\ |
| 4798 | [ |
| 4799 | { |
| 4800 | 'project': 'chromium', |
| 4801 | 'bucket': 'ci', |
| 4802 | 'name': 'chromium.test', |
| 4803 | 'machines': { |
| 4804 | 'Mac': { |
| 4805 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4806 | 'dimensions': { |
| 4807 | 'foo': 'bar', |
| 4808 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4809 | }, |
| 4810 | 'test_suites': { |
| 4811 | 'gtest_tests': 'foo_tests', |
| 4812 | }, |
| 4813 | }, |
| 4814 | }, |
| 4815 | }, |
| 4816 | ] |
| 4817 | """ |
| 4818 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4819 | MAC_ISOLATED_SCRIPTS_WATERFALL = """\ |
| 4820 | [ |
| 4821 | { |
| 4822 | 'project': 'chromium', |
| 4823 | 'bucket': 'ci', |
| 4824 | 'name': 'chromium.test', |
| 4825 | 'machines': { |
| 4826 | 'Mac': { |
| 4827 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4828 | 'dimensions': { |
| 4829 | 'os': 'Mac', |
| 4830 | }, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4831 | }, |
| 4832 | 'test_suites': { |
| 4833 | 'isolated_scripts': 'foo_tests', |
| 4834 | }, |
| 4835 | }, |
| 4836 | }, |
| 4837 | }, |
| 4838 | ] |
| 4839 | """ |
| 4840 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4841 | MAC_LUCI_MILO_CFG = """\ |
| 4842 | consoles { |
| 4843 | builders { |
| 4844 | name: "buildbucket/luci.chromium.ci/Mac" |
| 4845 | } |
| 4846 | } |
| 4847 | """ |
| 4848 | |
| 4849 | |
| 4850 | class SwarmingTests(TestCase): |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4851 | def test_builder_with_no_dimension_fails(self): |
| 4852 | fbb = FakeBBGen(self.args, NO_DIMENSIONS_GTESTS_WATERFALL, MAC_TEST_SUITE, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4853 | MAC_LUCI_MILO_CFG) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4854 | fbb.check_input_file_consistency(verbose=True) |
Tatsuhisa Yamaguchi | f1878d5 | 2023-11-06 06:02:25 | [diff] [blame] | 4855 | with self.assertRaisesRegex( |
| 4856 | generate_buildbot_json.BBGenErr, |
| 4857 | 'dimensions must be specified for all swarmed tests'): |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4858 | fbb.check_output_file_consistency(verbose=True) |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4859 | self.assertFalse(fbb.printed_lines) |
| 4860 | |
| 4861 | def test_builder_with_no_os_dimension_fails(self): |
| 4862 | fbb = FakeBBGen(self.args, NO_OS_GTESTS_WATERFALL, MAC_TEST_SUITE, |
| 4863 | MAC_LUCI_MILO_CFG) |
| 4864 | fbb.check_input_file_consistency(verbose=True) |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4865 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4866 | 'os must be specified for all swarmed tests'): |
| 4867 | fbb.check_output_file_consistency(verbose=True) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4868 | self.assertFalse(fbb.printed_lines) |
| 4869 | |
| 4870 | def test_mac_builder_with_no_cpu_dimension_in_isolated_script_fails(self): |
| 4871 | fbb = FakeBBGen(self.args, MAC_ISOLATED_SCRIPTS_WATERFALL, MAC_TEST_SUITE, |
| 4872 | MAC_LUCI_MILO_CFG) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4873 | fbb.check_input_file_consistency(verbose=True) |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4874 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4875 | 'cpu must be specified for mac'): |
| 4876 | fbb.check_output_file_consistency(verbose=True) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4877 | self.assertFalse(fbb.printed_lines) |
| 4878 | |
| 4879 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 4880 | if __name__ == '__main__': |
| 4881 | unittest.main() |