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