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