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 | def test_base_generator(self): |
| 1730 | # Only needed for complete code coverage. |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 1731 | with self.assertRaises(NotImplementedError): |
| 1732 | generate_buildbot_json.BaseGenerator(None).generate( |
| 1733 | None, None, None, None) |
| 1734 | with self.assertRaises(NotImplementedError): |
| 1735 | generate_buildbot_json.BaseGenerator(None).sort(None) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1736 | |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 1737 | def test_dimension_sets_causes_error(self): |
| 1738 | fbb = FakeBBGen(self.args, FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 1739 | FOO_TEST_SUITE_WITH_SWARMING_DIMENSION_SETS, LUCI_MILO_CFG) |
| 1740 | fbb.check_input_file_consistency(verbose=True) |
| 1741 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1742 | r'.*dimension_sets is no longer supported.*'): |
| 1743 | fbb.check_output_file_consistency(verbose=True) |
| 1744 | self.assertFalse(fbb.printed_lines) |
| 1745 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 1746 | def test_name_causes_error(self): |
| 1747 | fbb = FakeBBGen(self.args, FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 1748 | FOO_TEST_SUITE_WITH_NAME, LUCI_MILO_CFG) |
| 1749 | fbb.check_input_file_consistency(verbose=True) |
| 1750 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1751 | r'.*name field is set*'): |
| 1752 | fbb.check_output_file_consistency(verbose=True) |
| 1753 | self.assertFalse(fbb.printed_lines) |
| 1754 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1755 | def test_good_test_suites_are_ok(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1756 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1757 | LUCI_MILO_CFG) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1758 | fbb.check_input_file_consistency(verbose=True) |
| 1759 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1760 | |
| 1761 | def test_good_composition_test_suites_are_ok(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1762 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1763 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1764 | fbb.check_input_file_consistency(verbose=True) |
| 1765 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1766 | |
| 1767 | def test_bad_composition_test_suites_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1768 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1769 | BAD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1770 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1771 | 'compound_suites may not refer to.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1772 | fbb.check_input_file_consistency(verbose=True) |
| 1773 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1774 | |
Andrew Luo | 0f1dee0 | 2019-09-06 16:50:47 | [diff] [blame] | 1775 | def test_composition_test_suites_no_conflicts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1776 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1777 | CONFLICTING_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1778 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1779 | 'Conflicting test definitions.*'): |
Andrew Luo | 0f1dee0 | 2019-09-06 16:50:47 | [diff] [blame] | 1780 | fbb.check_input_file_consistency(verbose=True) |
| 1781 | self.assertFalse(fbb.printed_lines) |
| 1782 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1783 | def test_composition_test_suites_no_duplicate_names(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1784 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1785 | DUPLICATES_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1786 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1787 | '.*may not duplicate basic test suite.*'): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 1788 | fbb.check_input_file_consistency(verbose=True) |
| 1789 | self.assertFalse(fbb.printed_lines) |
| 1790 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1791 | def test_unknown_test_suites_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1792 | fbb = FakeBBGen(self.args, UNKNOWN_TEST_SUITE_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1793 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1794 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1795 | 'Test suite baz_tests from machine.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1796 | fbb.check_input_file_consistency(verbose=True) |
| 1797 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1798 | |
| 1799 | def test_unknown_test_suite_types_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1800 | fbb = FakeBBGen(self.args, UNKNOWN_TEST_SUITE_TYPE_WATERFALL, |
| 1801 | FOO_TEST_SUITE, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1802 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1803 | 'Unknown test suite type foo_test_type.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1804 | fbb.check_input_file_consistency(verbose=True) |
| 1805 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1806 | |
| 1807 | def test_unrefed_test_suite_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1808 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, UNREFED_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 1809 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1810 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1811 | '.*unreferenced.*bar_tests.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1812 | fbb.check_input_file_consistency(verbose=True) |
| 1813 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1814 | |
| 1815 | def test_good_waterfall_output(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1816 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WATERFALL, |
| 1817 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1818 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1819 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1820 | |
| 1821 | def test_reusing_gtest_targets(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1822 | fbb = FakeBBGen(self.args, |
| 1823 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1824 | REUSING_TEST_WITH_DIFFERENT_NAME, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1825 | LUCI_MILO_CFG, |
| 1826 | gn_isolate_map=GN_ISOLATE_MAP) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1827 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1828 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1829 | |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1830 | def test_load_multiple_isolate_map_files_with_duplicates(self): |
| 1831 | self.args.isolate_map_files = ['gn_isolate_map.pyl'] |
| 1832 | fbb = FakeBBGen(self.args, |
| 1833 | FOO_GTESTS_WATERFALL, |
| 1834 | REUSING_TEST_WITH_DIFFERENT_NAME, |
| 1835 | LUCI_MILO_CFG, |
| 1836 | gn_isolate_map=GN_ISOLATE_MAP) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1837 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1838 | 'Duplicate targets in isolate map files.*'): |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1839 | fbb.load_configuration_files() |
| 1840 | |
| 1841 | def test_load_multiple_isolate_map_files_without_duplicates(self): |
| 1842 | self.args.isolate_map_files = ['gn_isolate_map2.pyl'] |
| 1843 | fbb = FakeBBGen(self.args, |
| 1844 | FOO_GTESTS_WATERFALL, |
| 1845 | REUSING_TEST_WITH_DIFFERENT_NAME, |
| 1846 | LUCI_MILO_CFG, |
| 1847 | gn_isolate_map=GN_ISOLATE_MAP) |
| 1848 | fbb.load_configuration_files() |
| 1849 | isolate_dict = {} |
| 1850 | isolate_map_1 = fbb.load_pyl_file('gn_isolate_map.pyl') |
| 1851 | isolate_map_2 = fbb.load_pyl_file('gn_isolate_map2.pyl') |
| 1852 | isolate_dict.update(isolate_map_1) |
| 1853 | isolate_dict.update(isolate_map_2) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1854 | self.assertEqual(isolate_dict, fbb.gn_isolate_map) |
Chong Gu | ee62224 | 2020-10-28 18:17:35 | [diff] [blame] | 1855 | |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1856 | def test_gn_isolate_map_with_label_mismatch(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1857 | fbb = FakeBBGen(self.args, |
| 1858 | FOO_GTESTS_WATERFALL, |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1859 | FOO_TEST_SUITE, |
| 1860 | LUCI_MILO_CFG, |
| 1861 | gn_isolate_map=GN_ISOLATE_MAP_KEY_LABEL_MISMATCH) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1862 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 1863 | 'key name.*foo_test.*label.*' |
| 1864 | 'foo_test_tmp.*'): |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1865 | fbb.check_input_file_consistency(verbose=True) |
| 1866 | self.assertFalse(fbb.printed_lines) |
| 1867 | |
| 1868 | def test_gn_isolate_map_using_implicit_gn_name(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1869 | fbb = FakeBBGen(self.args, |
| 1870 | FOO_GTESTS_WATERFALL, |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1871 | FOO_TEST_SUITE, |
| 1872 | LUCI_MILO_CFG, |
| 1873 | gn_isolate_map=GN_ISOLATE_MAP_USING_IMPLICIT_NAME) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1874 | with self.assertRaisesRegex( |
| 1875 | generate_buildbot_json.BBGenErr, |
| 1876 | 'Malformed.*//chrome/foo_test.*for key.*' |
| 1877 | 'foo_test.*'): |
Corentin Wallez | 55b8e77 | 2020-04-24 17:39:28 | [diff] [blame] | 1878 | fbb.check_input_file_consistency(verbose=True) |
| 1879 | self.assertFalse(fbb.printed_lines) |
| 1880 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1881 | def test_noop_exception_does_nothing(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1882 | fbb = FakeBBGen(self.args, |
| 1883 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1884 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1885 | LUCI_MILO_CFG, |
| 1886 | exceptions=EMPTY_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1887 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1888 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1889 | |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1890 | def test_test_arg_merges(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1891 | fbb = FakeBBGen(self.args, |
| 1892 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1893 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1894 | LUCI_MILO_CFG, |
| 1895 | exceptions=FOO_TEST_MODIFICATIONS) |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1896 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1897 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8ceeabf | 2017-12-11 17:53:28 | [diff] [blame] | 1898 | |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1899 | def test_enable_features_arg_merges(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1900 | fbb = FakeBBGen(self.args, FOO_GTESTS_WITH_ENABLE_FEATURES_WATERFALL, |
| 1901 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, LUCI_MILO_CFG) |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1902 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1903 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 650995a | 2018-05-03 21:17:01 | [diff] [blame] | 1904 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1905 | def test_linux_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1906 | fbb = FakeBBGen(self.args, FOO_LINUX_GTESTS_WATERFALL, |
| 1907 | FOO_TEST_SUITE_WITH_LINUX_ARGS, LUCI_MILO_CFG) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1908 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1909 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 1910 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1911 | def test_test_filtering(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1912 | fbb = FakeBBGen(self.args, |
| 1913 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1914 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1915 | LUCI_MILO_CFG, |
| 1916 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1917 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1918 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1919 | |
| 1920 | def test_test_modifications(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1921 | fbb = FakeBBGen(self.args, |
| 1922 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1923 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1924 | LUCI_MILO_CFG, |
| 1925 | exceptions=FOO_TEST_MODIFICATIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1926 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1927 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1928 | |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1929 | def test_test_with_explicit_none(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1930 | fbb = FakeBBGen(self.args, |
| 1931 | FOO_GTESTS_WATERFALL, |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1932 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1933 | LUCI_MILO_CFG, |
| 1934 | exceptions=FOO_TEST_EXPLICIT_NONE_EXCEPTIONS, |
| 1935 | mixins=SWARMING_MIXINS) |
John Budorick | 5bc387fe | 2019-05-09 20:02:53 | [diff] [blame] | 1936 | fbb.check_output_file_consistency(verbose=True) |
| 1937 | self.assertFalse(fbb.printed_lines) |
| 1938 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1939 | def test_isolated_script_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1940 | fbb = FakeBBGen(self.args, |
| 1941 | FOO_ISOLATED_SCRIPTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1942 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1943 | LUCI_MILO_CFG, |
| 1944 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1945 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1946 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1947 | |
Ben Pastene | f21cda3 | 2023-03-30 22:00:57 | [diff] [blame] | 1948 | def test_isolated_script_tests_android(self): |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1949 | fbb = FakeBBGen(self.args, |
| 1950 | FOO_ISOLATED_SCRIPTS_WATERFALL_ANDROID, |
| 1951 | GOOD_COMPOSITION_TEST_SUITES, |
| 1952 | LUCI_MILO_CFG, |
| 1953 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Dirk Pranke | 0e879b2 | 2020-07-16 23:53:56 | [diff] [blame] | 1954 | fbb.check_output_file_consistency(verbose=True) |
| 1955 | self.assertFalse(fbb.printed_lines) |
| 1956 | |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1957 | def test_script_with_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1958 | fbb = FakeBBGen(self.args, |
| 1959 | FOO_SCRIPT_WATERFALL, |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1960 | SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1961 | LUCI_MILO_CFG, |
| 1962 | exceptions=SCRIPT_WITH_ARGS_EXCEPTIONS) |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1963 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1964 | self.assertFalse(fbb.printed_lines) |
Dirk Pranke | 1b76709 | 2017-12-07 04:44:23 | [diff] [blame] | 1965 | |
| 1966 | def test_script(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1967 | fbb = FakeBBGen(self.args, |
| 1968 | FOO_SCRIPT_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1969 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1970 | LUCI_MILO_CFG, |
| 1971 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1972 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 1973 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1974 | |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 1975 | def test_script_machine_forbids_scripts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1976 | fbb = FakeBBGen(self.args, |
| 1977 | FOO_SCRIPT_WATERFALL_MACHINE_FORBIDS_SCRIPT_TESTS, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 1978 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1979 | LUCI_MILO_CFG, |
| 1980 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1981 | with self.assertRaisesRegex( |
| 1982 | generate_buildbot_json.BBGenErr, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 1983 | 'Attempted to generate a script test on tester.*'): |
| 1984 | fbb.check_output_file_consistency(verbose=True) |
| 1985 | |
| 1986 | def test_script_waterfall_forbids_scripts(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1987 | fbb = FakeBBGen(self.args, |
| 1988 | FOO_SCRIPT_WATERFALL_FORBID_SCRIPT_TESTS, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 1989 | FOO_SCRIPT_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 1990 | LUCI_MILO_CFG, |
| 1991 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 1992 | with self.assertRaisesRegex( |
| 1993 | generate_buildbot_json.BBGenErr, |
Brian Sheedy | 158cd0f | 2019-04-26 01:12:44 | [diff] [blame] | 1994 | 'Attempted to generate a script test on tester.*'): |
| 1995 | fbb.check_output_file_consistency(verbose=True) |
| 1996 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 1997 | def test_junit_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 1998 | fbb = FakeBBGen(self.args, |
| 1999 | FOO_JUNIT_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2000 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2001 | LUCI_MILO_CFG, |
| 2002 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2003 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2004 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2005 | |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2006 | def test_gpu_telemetry_test_with_invalid_name(self): |
| 2007 | fbb = FakeBBGen(self.args, |
| 2008 | FOO_GPU_TELEMETRY_TEST_WATERFALL, |
| 2009 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST_WITH_INVALID_NAME, |
| 2010 | LUCI_MILO_CFG, |
| 2011 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2012 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
| 2013 | with self.assertRaisesRegex( |
| 2014 | generate_buildbot_json.BBGenErr, |
| 2015 | 'telemetry test names must end with test or tests.*'): |
| 2016 | fbb.check_output_file_consistency(verbose=True) |
| 2017 | self.assertFalse(fbb.printed_lines) |
| 2018 | |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2019 | def test_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2020 | fbb = FakeBBGen(self.args, |
| 2021 | FOO_GPU_TELEMETRY_TEST_WATERFALL, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2022 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2023 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2024 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2025 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2026 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2027 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | 8a386d4 | 2018-06-02 09:48:01 | [diff] [blame] | 2028 | |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2029 | def test_gpu_telemetry_tests_android(self): |
| 2030 | fbb = FakeBBGen(self.args, |
| 2031 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2032 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2033 | LUCI_MILO_CFG, |
| 2034 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2035 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID) |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2036 | fbb.check_output_file_consistency(verbose=True) |
| 2037 | self.assertFalse(fbb.printed_lines) |
| 2038 | |
| 2039 | def test_gpu_telemetry_tests_android_webview(self): |
| 2040 | fbb = FakeBBGen(self.args, |
| 2041 | FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID_WEBVIEW, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2042 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2043 | LUCI_MILO_CFG, |
| 2044 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2045 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_ANDROID_WEBVIEW) |
Brian Sheedy | f74819b | 2021-06-04 01:38:38 | [diff] [blame] | 2046 | fbb.check_output_file_consistency(verbose=True) |
| 2047 | self.assertFalse(fbb.printed_lines) |
| 2048 | |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2049 | def test_gpu_telemetry_tests_fuchsia(self): |
| 2050 | fbb = FakeBBGen(self.args, |
| 2051 | FOO_GPU_TELEMETRY_TEST_WATERFALL_FUCHSIA, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2052 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2053 | LUCI_MILO_CFG, |
| 2054 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2055 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_FUCHSIA) |
Chong Gu | c2ca5d0 | 2022-01-11 19:52:17 | [diff] [blame] | 2056 | fbb.check_output_file_consistency(verbose=True) |
| 2057 | self.assertFalse(fbb.printed_lines) |
| 2058 | |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2059 | def test_gpu_telemetry_tests_cast_streaming(self): |
| 2060 | fbb = FakeBBGen(self.args, |
| 2061 | FOO_GPU_TELEMETRY_TEST_WATERFALL_CAST_STREAMING, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2062 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2063 | LUCI_MILO_CFG, |
| 2064 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2065 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP_CAST_STREAMING) |
Fabrice de Gans | cbd655f | 2022-08-04 20:15:30 | [diff] [blame] | 2066 | fbb.check_output_file_consistency(verbose=True) |
| 2067 | self.assertFalse(fbb.printed_lines) |
| 2068 | |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2069 | def test_gpu_telemetry_tests_skylab(self): |
| 2070 | fbb = FakeBBGen(self.args, |
| 2071 | FOO_GPU_TELEMETRY_TEST_WATERFALL_SKYLAB, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 2072 | COMPOSITION_SUITE_WITH_TELEMETRY_TEST, |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2073 | LUCI_MILO_CFG, |
| 2074 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2075 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Brian Sheedy | b6491ba | 2022-09-26 20:49:49 | [diff] [blame] | 2076 | fbb.check_output_file_consistency(verbose=True) |
| 2077 | self.assertFalse(fbb.printed_lines) |
| 2078 | |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2079 | def test_nvidia_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2080 | fbb = FakeBBGen(self.args, |
| 2081 | NVIDIA_GPU_TELEMETRY_TEST_WATERFALL, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2082 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2083 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2084 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2085 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2086 | fbb.check_output_file_consistency(verbose=True) |
| 2087 | self.assertFalse(fbb.printed_lines) |
| 2088 | |
| 2089 | def test_intel_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2090 | fbb = FakeBBGen(self.args, |
| 2091 | INTEL_GPU_TELEMETRY_TEST_WATERFALL, |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2092 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2093 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2094 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2095 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Kenneth Russell | 384a173 | 2019-03-16 02:36:02 | [diff] [blame] | 2096 | fbb.check_output_file_consistency(verbose=True) |
| 2097 | self.assertFalse(fbb.printed_lines) |
| 2098 | |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 2099 | def test_gpu_telemetry_tests_with_variants(self): |
| 2100 | fbb = FakeBBGen(self.args, |
| 2101 | GPU_TELEMETRY_TEST_VARIANTS_WATERFALL, |
| 2102 | MATRIX_COMPOUND_MIXED_VARIANTS_REF, |
| 2103 | LUCI_MILO_CFG, |
| 2104 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2105 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP, |
| 2106 | variants=MULTI_VARIANTS_FILE) |
Ben Pastene | 5f231cf2 | 2022-05-05 18:03:07 | [diff] [blame] | 2107 | fbb.check_output_file_consistency(verbose=True) |
| 2108 | self.assertFalse(fbb.printed_lines) |
| 2109 | |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2110 | def test_intel_uhd_gpu_telemetry_tests(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2111 | fbb = FakeBBGen(self.args, |
| 2112 | INTEL_UHD_GPU_TELEMETRY_TEST_WATERFALL, |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2113 | COMPOSITION_SUITE_WITH_GPU_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2114 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2115 | exceptions=NO_BAR_TEST_EXCEPTIONS, |
| 2116 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Brian Sheedy | f9387db7b | 2019-08-05 19:26:10 | [diff] [blame] | 2117 | fbb.check_output_file_consistency(verbose=True) |
| 2118 | self.assertFalse(fbb.printed_lines) |
| 2119 | |
Jamie Madill | a8be0d7 | 2020-10-02 05:24:04 | [diff] [blame] | 2120 | def test_gtest_as_isolated_Script(self): |
| 2121 | fbb = FakeBBGen(self.args, |
| 2122 | FOO_GTESTS_WATERFALL, |
| 2123 | GTEST_AS_ISOLATED_SCRIPT_SUITE, |
| 2124 | LUCI_MILO_CFG, |
| 2125 | gn_isolate_map=GN_ISOLATE_MAP) |
Jamie Madill | a8be0d7 | 2020-10-02 05:24:04 | [diff] [blame] | 2126 | fbb.check_output_file_consistency(verbose=True) |
| 2127 | self.assertFalse(fbb.printed_lines) |
| 2128 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2129 | def test_ungenerated_output_files_are_caught(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2130 | fbb = FakeBBGen(self.args, |
| 2131 | COMPOSITION_GTEST_SUITE_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2132 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2133 | LUCI_MILO_CFG, |
| 2134 | exceptions=NO_BAR_TEST_EXCEPTIONS) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2135 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
Kenneth Russell | 73c3bd8b | 2018-10-19 22:30:19 | [diff] [blame] | 2136 | fbb.check_output_file_consistency(verbose=True, dump=False) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2137 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2138 | self.assertRegex( |
Dirk Pranke | 6269d30 | 2020-10-01 00:14:39 | [diff] [blame] | 2139 | joined_lines, 'File chromium.test.json did not have the following' |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2140 | ' expected contents:.*') |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2141 | self.assertRegex(joined_lines, '.*--- expected.*') |
| 2142 | self.assertRegex(joined_lines, '.*\+\+\+ current.*') |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2143 | fbb.printed_lines = [] |
| 2144 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2145 | |
| 2146 | def test_android_output_options(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2147 | fbb = FakeBBGen(self.args, ANDROID_WATERFALL, FOO_TEST_SUITE, LUCI_MILO_CFG) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2148 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2149 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2150 | |
| 2151 | def test_nonexistent_removal_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2152 | fbb = FakeBBGen(self.args, |
| 2153 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2154 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2155 | LUCI_MILO_CFG, |
| 2156 | exceptions=NONEXISTENT_REMOVAL) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2157 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2158 | 'The following nonexistent machines.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2159 | fbb.check_input_file_consistency(verbose=True) |
| 2160 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2161 | |
| 2162 | def test_nonexistent_modification_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2163 | fbb = FakeBBGen(self.args, |
| 2164 | FOO_GTESTS_WATERFALL, |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2165 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2166 | LUCI_MILO_CFG, |
| 2167 | exceptions=NONEXISTENT_MODIFICATION) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2168 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2169 | 'The following nonexistent machines.*'): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2170 | fbb.check_input_file_consistency(verbose=True) |
| 2171 | self.assertFalse(fbb.printed_lines) |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 2172 | |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2173 | def test_waterfall_args(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2174 | fbb = FakeBBGen(self.args, COMPOSITION_GTEST_SUITE_WITH_ARGS_WATERFALL, |
| 2175 | GOOD_COMPOSITION_TEST_SUITES, LUCI_MILO_CFG) |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2176 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2177 | self.assertFalse(fbb.printed_lines) |
John Budorick | edfe7f87 | 2018-01-23 15:27:22 | [diff] [blame] | 2178 | |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 2179 | def test_chromeos_trigger_script_output(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2180 | fbb = FakeBBGen(self.args, FOO_CHROMEOS_TRIGGER_SCRIPT_WATERFALL, |
| 2181 | FOO_TEST_SUITE, LUCI_MILO_CFG) |
Ben Pastene | a9e583b | 2019-01-16 02:57:26 | [diff] [blame] | 2182 | fbb.check_output_file_consistency(verbose=True) |
| 2183 | self.assertFalse(fbb.printed_lines) |
| 2184 | |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2185 | def test_relative_pyl_file_dir(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2186 | self.set_args('--pyl-files-dir=relative/path') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2187 | fbb = FakeBBGen(self.args, |
| 2188 | FOO_GTESTS_WATERFALL, |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2189 | REUSING_TEST_WITH_DIFFERENT_NAME, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2190 | LUCI_MILO_CFG, |
| 2191 | gn_isolate_map=GN_ISOLATE_MAP) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2192 | fbb.check_input_file_consistency(verbose=True) |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2193 | fbb.check_output_file_consistency(verbose=True) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2194 | self.assertFalse(fbb.printed_lines) |
Zhiling Huang | be00817 | 2018-03-08 19:13:11 | [diff] [blame] | 2195 | |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2196 | def test_nonexistent_bot_raises(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2197 | fbb = FakeBBGen(self.args, UNKNOWN_BOT_GTESTS_WATERFALL, FOO_TEST_SUITE, |
Kenneth Russell | 78fd870 | 2018-05-17 01:15:52 | [diff] [blame] | 2198 | LUCI_MILO_CFG) |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2199 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2200 | fbb.check_input_file_consistency(verbose=True) |
| 2201 | self.assertFalse(fbb.printed_lines) |
Nico Weber | d18b896 | 2018-05-16 19:39:38 | [diff] [blame] | 2202 | |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 2203 | def test_nonexistent_bot_raises_when_no_project_pyl_exists(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2204 | fbb = FakeBBGen(self.args, |
| 2205 | UNKNOWN_BOT_GTESTS_WATERFALL, |
Garrett Beaty | 2a02de3c | 2020-05-15 13:57:35 | [diff] [blame] | 2206 | FOO_TEST_SUITE, |
| 2207 | LUCI_MILO_CFG, |
Garrett Beaty | 4f3e921 | 2020-06-25 20:21:49 | [diff] [blame] | 2208 | project_pyl=None) |
| 2209 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2210 | fbb.check_input_file_consistency(verbose=True) |
| 2211 | self.assertFalse(fbb.printed_lines) |
| 2212 | |
| 2213 | def test_nonexistent_bot_does_not_raise_when_validation_disabled(self): |
| 2214 | fbb = FakeBBGen( |
| 2215 | self.args, |
| 2216 | UNKNOWN_BOT_GTESTS_WATERFALL, |
| 2217 | FOO_TEST_SUITE, |
| 2218 | LUCI_MILO_CFG, |
| 2219 | project_pyl='{"validate_source_side_specs_have_builder": False}') |
Garrett Beaty | 2a02de3c | 2020-05-15 13:57:35 | [diff] [blame] | 2220 | fbb.check_input_file_consistency(verbose=True) |
| 2221 | |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2222 | def test_waterfalls_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2223 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTED_WATERFALL, TEST_SUITE_SORTED, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2224 | LUCI_MILO_CFG_WATERFALL_SORTING) |
| 2225 | fbb.check_input_file_consistency(verbose=True) |
| 2226 | self.assertFalse(fbb.printed_lines) |
| 2227 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2228 | fbb = FakeBBGen(self.args, TEST_SUITE_UNSORTED_WATERFALL_1, |
| 2229 | TEST_SUITE_SORTED, LUCI_MILO_CFG_WATERFALL_SORTING) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2230 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2231 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2232 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2233 | re.escape(self.args.waterfalls_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2234 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2235 | fbb.check_input_file_consistency(verbose=True) |
| 2236 | joined_lines = '\n'.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2237 | self.assertRegex(joined_lines, '.*\+ chromium\..*test.*') |
| 2238 | self.assertRegex(joined_lines, '.*\- chromium\..*test.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2239 | fbb.printed_lines = [] |
| 2240 | self.assertFalse(fbb.printed_lines) |
| 2241 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2242 | fbb = FakeBBGen(self.args, TEST_SUITE_UNSORTED_WATERFALL_2, |
| 2243 | TEST_SUITE_SORTED, LUCI_MILO_CFG_WATERFALL_SORTING) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2244 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2245 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2246 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2247 | re.escape(self.args.waterfalls_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2248 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2249 | fbb.check_input_file_consistency(verbose=True) |
| 2250 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2251 | self.assertRegex(joined_lines, '.*\+.*Fake Tester.*') |
| 2252 | self.assertRegex(joined_lines, '.*\-.*Fake Tester.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2253 | fbb.printed_lines = [] |
| 2254 | self.assertFalse(fbb.printed_lines) |
| 2255 | |
| 2256 | def test_test_suite_exceptions_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2257 | fbb = FakeBBGen(self.args, |
| 2258 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2259 | TEST_SUITE_SORTED, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2260 | LUCI_MILO_CFG, |
| 2261 | exceptions=EXCEPTIONS_SORTED) |
Stephen Martinis | 7eb8b61 | 2018-09-21 00:17:50 | [diff] [blame] | 2262 | fbb.check_input_file_consistency(verbose=True) |
| 2263 | self.assertFalse(fbb.printed_lines) |
Stephen Martinis | f8389372 | 2018-09-19 00:02:18 | [diff] [blame] | 2264 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2265 | fbb = FakeBBGen(self.args, |
| 2266 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2267 | TEST_SUITE_SORTED, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2268 | LUCI_MILO_CFG, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2269 | exceptions=EXCEPTIONS_DUPS_REMOVE_FROM) |
| 2270 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2271 | fbb.check_input_file_consistency(verbose=True) |
| 2272 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2273 | self.assertRegex(joined_lines, '.*\- Fake Tester.*') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2274 | fbb.printed_lines = [] |
| 2275 | self.assertFalse(fbb.printed_lines) |
| 2276 | |
| 2277 | def test_test_suite_exceptions_no_dups_remove_from(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2278 | fbb = FakeBBGen(self.args, |
| 2279 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2280 | TEST_SUITE_SORTED, |
| 2281 | LUCI_MILO_CFG, |
| 2282 | exceptions=EXCEPTIONS_SORTED) |
| 2283 | fbb.check_input_file_consistency(verbose=True) |
| 2284 | self.assertFalse(fbb.printed_lines) |
| 2285 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2286 | fbb = FakeBBGen(self.args, |
| 2287 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2288 | TEST_SUITE_SORTED, |
| 2289 | LUCI_MILO_CFG, |
| 2290 | exceptions=EXCEPTIONS_PER_TEST_UNSORTED) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2291 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2292 | fbb.check_input_file_consistency(verbose=True) |
| 2293 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2294 | self.assertRegex(joined_lines, '.*\+ Fake Tester.*') |
| 2295 | self.assertRegex(joined_lines, '.*\- Fake Tester.*') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2296 | fbb.printed_lines = [] |
| 2297 | self.assertFalse(fbb.printed_lines) |
| 2298 | |
| 2299 | def test_test_suite_exceptions_per_test_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2300 | fbb = FakeBBGen(self.args, |
| 2301 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2302 | TEST_SUITE_SORTED, |
| 2303 | LUCI_MILO_CFG, |
| 2304 | exceptions=EXCEPTIONS_SORTED) |
| 2305 | fbb.check_input_file_consistency(verbose=True) |
| 2306 | self.assertFalse(fbb.printed_lines) |
| 2307 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2308 | fbb = FakeBBGen(self.args, |
| 2309 | TEST_SUITE_SORTING_WATERFALL, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2310 | TEST_SUITE_SORTED, |
| 2311 | LUCI_MILO_CFG, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2312 | exceptions=EXCEPTIONS_UNSORTED) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2313 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2314 | fbb.check_input_file_consistency(verbose=True) |
| 2315 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2316 | self.assertRegex(joined_lines, '.*\+ suite_.*') |
| 2317 | self.assertRegex(joined_lines, '.*\- suite_.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2318 | fbb.printed_lines = [] |
| 2319 | self.assertFalse(fbb.printed_lines) |
| 2320 | |
| 2321 | def test_test_suites_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2322 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTING_WATERFALL, TEST_SUITE_SORTED, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2323 | LUCI_MILO_CFG) |
| 2324 | fbb.check_input_file_consistency(verbose=True) |
| 2325 | self.assertFalse(fbb.printed_lines) |
| 2326 | |
| 2327 | for unsorted in ( |
| 2328 | TEST_SUITE_UNSORTED_1, |
| 2329 | TEST_SUITE_UNSORTED_2, |
| 2330 | TEST_SUITE_UNSORTED_3, |
| 2331 | ): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2332 | fbb = FakeBBGen(self.args, TEST_SUITE_SORTING_WATERFALL, unsorted, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2333 | LUCI_MILO_CFG) |
| 2334 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2335 | fbb.check_input_file_consistency(verbose=True) |
| 2336 | joined_lines = ' '.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2337 | self.assertRegex(joined_lines, '.*\+ suite_.*') |
| 2338 | self.assertRegex(joined_lines, '.*\- suite_.*') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2339 | fbb.printed_lines = [] |
| 2340 | self.assertFalse(fbb.printed_lines) |
| 2341 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2342 | |
| 2343 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL = """\ |
| 2344 | [ |
| 2345 | { |
| 2346 | 'mixins': ['waterfall_mixin'], |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2347 | 'project': 'chromium', |
| 2348 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2349 | 'name': 'chromium.test', |
| 2350 | 'machines': { |
| 2351 | 'Fake Tester': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2352 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2353 | 'dimensions': { |
| 2354 | 'os': 'Linux', |
| 2355 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2356 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2357 | 'test_suites': { |
| 2358 | 'gtest_tests': 'foo_tests', |
| 2359 | }, |
| 2360 | }, |
| 2361 | }, |
| 2362 | }, |
| 2363 | ] |
| 2364 | """ |
| 2365 | |
| 2366 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL = """\ |
| 2367 | [ |
| 2368 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2369 | 'project': 'chromium', |
| 2370 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2371 | 'name': 'chromium.test', |
| 2372 | 'machines': { |
| 2373 | 'Fake Tester': { |
| 2374 | 'mixins': ['builder_mixin'], |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2375 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2376 | 'dimensions': { |
| 2377 | 'os': 'Linux', |
| 2378 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2379 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2380 | 'test_suites': { |
| 2381 | 'gtest_tests': 'foo_tests', |
| 2382 | }, |
| 2383 | }, |
| 2384 | }, |
| 2385 | }, |
| 2386 | ] |
| 2387 | """ |
| 2388 | |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2389 | FOO_LINUX_GTESTS_BUILDER_MIXIN_WATERFALL = """\ |
| 2390 | [ |
| 2391 | { |
| 2392 | 'project': 'chromium', |
| 2393 | 'bucket': 'ci', |
| 2394 | 'name': 'chromium.test', |
| 2395 | 'machines': { |
| 2396 | 'Fake Tester': { |
| 2397 | 'os_type': 'linux', |
| 2398 | 'mixins': ['builder_mixin'], |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2399 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2400 | 'dimensions': { |
| 2401 | 'os': 'Linux', |
| 2402 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 2403 | }, |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2404 | 'test_suites': { |
| 2405 | 'gtest_tests': 'foo_tests', |
| 2406 | }, |
| 2407 | }, |
| 2408 | }, |
| 2409 | }, |
| 2410 | ] |
| 2411 | """ |
| 2412 | |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2413 | FOO_GTESTS_WATERFALL_MIXIN_BUILDER_REMOVE_MIXIN_WATERFALL = """\ |
| 2414 | [ |
| 2415 | { |
| 2416 | 'mixins': ['waterfall_mixin'], |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2417 | 'project': 'chromium', |
| 2418 | 'bucket': 'ci', |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2419 | 'name': 'chromium.test', |
| 2420 | 'machines': { |
| 2421 | 'Fake Tester': { |
| 2422 | 'remove_mixins': ['waterfall_mixin'], |
| 2423 | 'swarming': {}, |
| 2424 | 'test_suites': { |
| 2425 | 'gtest_tests': 'foo_tests', |
| 2426 | }, |
| 2427 | }, |
| 2428 | }, |
| 2429 | }, |
| 2430 | ] |
| 2431 | """ |
| 2432 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2433 | FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL = """\ |
| 2434 | [ |
| 2435 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2436 | 'project': 'chromium', |
| 2437 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2438 | 'name': 'chromium.test', |
| 2439 | 'machines': { |
| 2440 | 'Fake Tester': { |
| 2441 | 'mixins': ['random_mixin'], |
| 2442 | 'swarming': {}, |
| 2443 | 'test_suites': { |
| 2444 | 'gtest_tests': 'foo_tests', |
| 2445 | }, |
| 2446 | }, |
| 2447 | }, |
| 2448 | }, |
| 2449 | ] |
| 2450 | """ |
| 2451 | |
| 2452 | FOO_GTESTS_DIMENSIONS_MIXIN_WATERFALL = """\ |
| 2453 | [ |
| 2454 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2455 | 'project': 'chromium', |
| 2456 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2457 | 'name': 'chromium.test', |
| 2458 | 'machines': { |
| 2459 | 'Fake Tester': { |
| 2460 | 'mixins': ['dimension_mixin'], |
| 2461 | 'swarming': {}, |
| 2462 | 'test_suites': { |
| 2463 | 'gtest_tests': 'foo_tests', |
| 2464 | }, |
| 2465 | }, |
| 2466 | }, |
| 2467 | }, |
| 2468 | ] |
| 2469 | """ |
| 2470 | |
| 2471 | FOO_GPU_TELEMETRY_TEST_DIMENSIONS_WATERFALL = """\ |
| 2472 | [ |
| 2473 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2474 | 'project': 'chromium', |
| 2475 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2476 | 'name': 'chromium.test', |
| 2477 | 'machines': { |
| 2478 | 'Fake Tester': { |
| 2479 | 'mixins': ['dimension_mixin'], |
| 2480 | 'os_type': 'win', |
| 2481 | 'browser_config': 'release', |
| 2482 | 'test_suites': { |
| 2483 | 'gpu_telemetry_tests': 'foo_tests', |
| 2484 | }, |
| 2485 | }, |
| 2486 | }, |
| 2487 | }, |
| 2488 | ] |
| 2489 | """ |
| 2490 | |
| 2491 | # Swarming mixins must be a list, a single string is not allowed. |
| 2492 | FOO_GTESTS_INVALID_LIST_MIXIN_WATERFALL = """\ |
| 2493 | [ |
| 2494 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2495 | 'project': 'chromium', |
| 2496 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2497 | 'name': 'chromium.test', |
| 2498 | 'machines': { |
| 2499 | 'Fake Tester': { |
| 2500 | 'mixins': 'dimension_mixin', |
| 2501 | 'swarming': {}, |
| 2502 | 'test_suites': { |
| 2503 | 'gtest_tests': 'foo_tests', |
| 2504 | }, |
| 2505 | }, |
| 2506 | }, |
| 2507 | }, |
| 2508 | ] |
| 2509 | """ |
| 2510 | FOO_GTESTS_INVALID_NOTFOUND_MIXIN_WATERFALL = """\ |
| 2511 | [ |
| 2512 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2513 | 'project': 'chromium', |
| 2514 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2515 | 'name': 'chromium.test', |
| 2516 | 'machines': { |
| 2517 | 'Fake Tester': { |
| 2518 | 'mixins': ['nonexistant'], |
| 2519 | 'swarming': {}, |
| 2520 | 'test_suites': { |
| 2521 | 'gtest_tests': 'foo_tests', |
| 2522 | }, |
| 2523 | }, |
| 2524 | }, |
| 2525 | }, |
| 2526 | ] |
| 2527 | """ |
| 2528 | |
| 2529 | FOO_GTESTS_TEST_MIXIN_WATERFALL = """\ |
| 2530 | [ |
| 2531 | { |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2532 | 'project': 'chromium', |
| 2533 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2534 | 'name': 'chromium.test', |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2535 | 'mixins': ['waterfall_mixin'], |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2536 | 'machines': { |
| 2537 | 'Fake Tester': { |
| 2538 | 'swarming': {}, |
| 2539 | 'test_suites': { |
| 2540 | 'gtest_tests': 'foo_tests', |
| 2541 | }, |
| 2542 | }, |
| 2543 | }, |
| 2544 | }, |
| 2545 | ] |
| 2546 | """ |
| 2547 | |
| 2548 | FOO_GTESTS_SORTING_MIXINS_WATERFALL = """\ |
| 2549 | [ |
| 2550 | { |
| 2551 | 'mixins': ['a_mixin', 'b_mixin', 'c_mixin'], |
Greg Guterman | f60eb05 | 2020-03-12 17:40:01 | [diff] [blame] | 2552 | 'project': 'chromium', |
| 2553 | 'bucket': 'ci', |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2554 | 'name': 'chromium.test', |
| 2555 | 'machines': { |
| 2556 | 'Fake Tester': { |
| 2557 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2558 | 'dimensions': { |
| 2559 | 'kvm': '1', |
| 2560 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2561 | }, |
| 2562 | 'test_suites': { |
| 2563 | 'gtest_tests': 'foo_tests', |
| 2564 | }, |
| 2565 | }, |
| 2566 | }, |
| 2567 | }, |
| 2568 | ] |
| 2569 | """ |
| 2570 | |
| 2571 | FOO_TEST_SUITE_WITH_MIXIN = """\ |
| 2572 | { |
| 2573 | 'basic_suites': { |
| 2574 | 'foo_tests': { |
| 2575 | 'foo_test': { |
| 2576 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2577 | 'dimensions': { |
| 2578 | 'integrity': 'high', |
| 2579 | 'os': 'Linux', |
| 2580 | }, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2581 | 'expiration': 120, |
| 2582 | }, |
| 2583 | 'mixins': ['test_mixin'], |
| 2584 | }, |
| 2585 | }, |
| 2586 | }, |
| 2587 | } |
| 2588 | """ |
| 2589 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2590 | MIXIN_ARGS = """\ |
| 2591 | { |
| 2592 | 'builder_mixin': { |
| 2593 | 'args': [], |
| 2594 | }, |
| 2595 | } |
| 2596 | """ |
| 2597 | |
| 2598 | MIXIN_ARGS_NOT_LIST = """\ |
| 2599 | { |
| 2600 | 'builder_mixin': { |
| 2601 | 'args': 'I am not a list', |
| 2602 | }, |
| 2603 | } |
| 2604 | """ |
| 2605 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2606 | MIXIN_LINUX_ARGS = """\ |
| 2607 | { |
| 2608 | 'builder_mixin': { |
| 2609 | 'args': [ '--mixin-argument' ], |
| 2610 | 'linux_args': [ '--linux-mixin-argument' ], |
| 2611 | }, |
| 2612 | } |
| 2613 | """ |
| 2614 | |
| 2615 | MIXIN_APPEND = """\ |
| 2616 | { |
| 2617 | 'builder_mixin': { |
| 2618 | '$mixin_append': { |
| 2619 | 'args': [ '--mixin-argument' ], |
| 2620 | }, |
| 2621 | }, |
| 2622 | } |
| 2623 | """ |
| 2624 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2625 | # These mixins are invalid; if passed to check_input_file_consistency, they will |
| 2626 | # fail. These are used for output file consistency checks. |
| 2627 | SWARMING_MIXINS = """\ |
| 2628 | { |
| 2629 | 'builder_mixin': { |
| 2630 | 'swarming': { |
| 2631 | 'value': 'builder', |
| 2632 | }, |
| 2633 | }, |
| 2634 | 'dimension_mixin': { |
| 2635 | 'swarming': { |
| 2636 | 'dimensions': { |
| 2637 | 'iama': 'mixin', |
| 2638 | }, |
| 2639 | }, |
| 2640 | }, |
| 2641 | 'random_mixin': { |
| 2642 | 'value': 'random', |
| 2643 | }, |
| 2644 | 'test_mixin': { |
| 2645 | 'swarming': { |
| 2646 | 'value': 'test', |
| 2647 | }, |
| 2648 | }, |
| 2649 | 'waterfall_mixin': { |
| 2650 | 'swarming': { |
| 2651 | 'value': 'waterfall', |
| 2652 | }, |
| 2653 | }, |
| 2654 | } |
| 2655 | """ |
| 2656 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2657 | SWARMING_NAMED_CACHES = """\ |
| 2658 | { |
| 2659 | 'builder_mixin': { |
| 2660 | 'swarming': { |
| 2661 | 'named_caches': [ |
| 2662 | { |
| 2663 | 'name': 'cache', |
| 2664 | 'file': 'cache_file', |
| 2665 | }, |
| 2666 | ], |
| 2667 | }, |
| 2668 | }, |
| 2669 | } |
| 2670 | """ |
| 2671 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2672 | SWARMING_MIXINS_DUPLICATED = """\ |
| 2673 | { |
| 2674 | 'builder_mixin': { |
| 2675 | 'value': 'builder', |
| 2676 | }, |
| 2677 | 'builder_mixin': { |
| 2678 | 'value': 'builder', |
| 2679 | }, |
| 2680 | } |
| 2681 | """ |
| 2682 | |
| 2683 | SWARMING_MIXINS_UNSORTED = """\ |
| 2684 | { |
| 2685 | 'b_mixin': { |
| 2686 | 'b': 'b', |
| 2687 | }, |
| 2688 | 'a_mixin': { |
| 2689 | 'a': 'a', |
| 2690 | }, |
| 2691 | 'c_mixin': { |
| 2692 | 'c': 'c', |
| 2693 | }, |
| 2694 | } |
| 2695 | """ |
| 2696 | |
| 2697 | SWARMING_MIXINS_SORTED = """\ |
| 2698 | { |
| 2699 | 'a_mixin': { |
| 2700 | 'a': 'a', |
| 2701 | }, |
| 2702 | 'b_mixin': { |
| 2703 | 'b': 'b', |
| 2704 | }, |
| 2705 | 'c_mixin': { |
| 2706 | 'c': 'c', |
| 2707 | }, |
| 2708 | } |
| 2709 | """ |
| 2710 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2711 | |
| 2712 | class MixinTests(TestCase): |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2713 | """Tests for the mixins feature.""" |
| 2714 | def test_mixins_must_be_sorted(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2715 | fbb = FakeBBGen(self.args, |
| 2716 | FOO_GTESTS_SORTING_MIXINS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2717 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2718 | LUCI_MILO_CFG, |
| 2719 | mixins=SWARMING_MIXINS_SORTED) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2720 | fbb.check_input_file_consistency(verbose=True) |
| 2721 | self.assertFalse(fbb.printed_lines) |
| 2722 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2723 | fbb = FakeBBGen(self.args, |
| 2724 | FOO_GTESTS_SORTING_MIXINS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2725 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2726 | LUCI_MILO_CFG, |
| 2727 | mixins=SWARMING_MIXINS_UNSORTED) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2728 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2729 | fbb.check_input_file_consistency(verbose=True) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2730 | joined_lines = '\n'.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2731 | self.assertRegex(joined_lines, '.*\+ ._mixin.*') |
| 2732 | self.assertRegex(joined_lines, '.*\- ._mixin.*') |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2733 | fbb.printed_lines = [] |
| 2734 | self.assertFalse(fbb.printed_lines) |
| 2735 | |
| 2736 | def test_waterfall(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2737 | fbb = FakeBBGen(self.args, |
| 2738 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2739 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2740 | LUCI_MILO_CFG, |
| 2741 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2742 | fbb.check_output_file_consistency(verbose=True) |
| 2743 | self.assertFalse(fbb.printed_lines) |
| 2744 | |
| 2745 | def test_waterfall_exception_overrides(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2746 | fbb = FakeBBGen(self.args, |
| 2747 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2748 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2749 | LUCI_MILO_CFG, |
| 2750 | exceptions=SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS, |
| 2751 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2752 | fbb.check_output_file_consistency(verbose=True) |
| 2753 | self.assertFalse(fbb.printed_lines) |
| 2754 | |
Stephanie Kim | 572b43c0 | 2023-04-13 14:24:13 | [diff] [blame] | 2755 | def test_autoshard_exceptions(self): |
| 2756 | fbb = FakeBBGen(self.args, |
| 2757 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
| 2758 | FOO_TEST_SUITE, |
| 2759 | LUCI_MILO_CFG, |
| 2760 | exceptions=SCRIPT_WITH_ARGS_SWARMING_EXCEPTIONS, |
| 2761 | autoshard_exceptions=AUTOSHARD_EXCEPTIONS, |
| 2762 | mixins=SWARMING_MIXINS) |
| 2763 | fbb.check_output_file_consistency(verbose=True) |
| 2764 | self.assertFalse(fbb.printed_lines) |
| 2765 | |
| 2766 | def test_autoshard_exceptions_variant_names(self): |
| 2767 | fbb = FakeBBGen(self.args, |
| 2768 | MATRIX_GTEST_SUITE_WATERFALL, |
| 2769 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY, |
| 2770 | LUCI_MILO_CFG, |
| 2771 | autoshard_exceptions=AUTOSHARD_EXCEPTIONS, |
| 2772 | variants=VARIANTS_FILE) |
| 2773 | fbb.check_output_file_consistency(verbose=True) |
| 2774 | self.assertFalse(fbb.printed_lines) |
| 2775 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2776 | def test_builder(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2777 | fbb = FakeBBGen(self.args, |
| 2778 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2779 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2780 | LUCI_MILO_CFG, |
| 2781 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2782 | fbb.check_output_file_consistency(verbose=True) |
| 2783 | self.assertFalse(fbb.printed_lines) |
| 2784 | |
| 2785 | def test_builder_non_swarming(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2786 | fbb = FakeBBGen(self.args, |
| 2787 | FOO_GTESTS_BUILDER_MIXIN_NON_SWARMING_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2788 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2789 | LUCI_MILO_CFG, |
| 2790 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2791 | fbb.check_output_file_consistency(verbose=True) |
| 2792 | self.assertFalse(fbb.printed_lines) |
| 2793 | |
| 2794 | def test_test_suite(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2795 | fbb = FakeBBGen(self.args, |
| 2796 | FOO_GTESTS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2797 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2798 | LUCI_MILO_CFG, |
| 2799 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2800 | fbb.check_output_file_consistency(verbose=True) |
| 2801 | self.assertFalse(fbb.printed_lines) |
| 2802 | |
| 2803 | def test_dimension(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2804 | fbb = FakeBBGen(self.args, |
| 2805 | FOO_GTESTS_DIMENSIONS_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2806 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2807 | LUCI_MILO_CFG, |
| 2808 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2809 | fbb.check_output_file_consistency(verbose=True) |
| 2810 | self.assertFalse(fbb.printed_lines) |
| 2811 | |
| 2812 | def test_dimension_gpu(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2813 | fbb = FakeBBGen(self.args, |
| 2814 | FOO_GPU_TELEMETRY_TEST_DIMENSIONS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2815 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2816 | LUCI_MILO_CFG, |
Chan Li | ab7d8dd8 | 2020-04-24 23:42:19 | [diff] [blame] | 2817 | mixins=SWARMING_MIXINS, |
| 2818 | gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2819 | fbb.check_output_file_consistency(verbose=True) |
| 2820 | self.assertFalse(fbb.printed_lines) |
| 2821 | |
| 2822 | def test_unreferenced(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2823 | fbb = FakeBBGen(self.args, |
| 2824 | FOO_GTESTS_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2825 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2826 | LUCI_MILO_CFG, |
| 2827 | mixins=SWARMING_MIXINS) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2828 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2829 | '.*mixins are unreferenced.*'): |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2830 | fbb.check_input_file_consistency(verbose=True) |
| 2831 | self.assertFalse(fbb.printed_lines) |
| 2832 | |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2833 | def test_unused(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2834 | fbb = FakeBBGen(self.args, |
| 2835 | FOO_GTESTS_INVALID_NOTFOUND_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2836 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2837 | LUCI_MILO_CFG, |
| 2838 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2839 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2840 | fbb.check_output_file_consistency(verbose=True) |
| 2841 | self.assertFalse(fbb.printed_lines) |
| 2842 | |
| 2843 | def test_list(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2844 | fbb = FakeBBGen(self.args, |
| 2845 | FOO_GTESTS_INVALID_LIST_MIXIN_WATERFALL, |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2846 | FOO_TEST_SUITE_WITH_MIXIN, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2847 | LUCI_MILO_CFG, |
| 2848 | mixins=SWARMING_MIXINS) |
Stephen Martinis | 1167254 | 2018-10-29 18:17:21 | [diff] [blame] | 2849 | with self.assertRaises(generate_buildbot_json.BBGenErr): |
| 2850 | fbb.check_output_file_consistency(verbose=True) |
| 2851 | self.assertFalse(fbb.printed_lines) |
| 2852 | |
| 2853 | |
| 2854 | def test_no_duplicate_keys(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2855 | fbb = FakeBBGen(self.args, |
| 2856 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2857 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2858 | LUCI_MILO_CFG, |
| 2859 | mixins=SWARMING_MIXINS_DUPLICATED) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2860 | with self.assertRaisesRegex( |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2861 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2862 | ('The following files have invalid keys: ' + |
| 2863 | re.escape(self.args.mixins_pyl_path)), |
| 2864 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2865 | fbb.check_input_file_consistency(verbose=True) |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2866 | joined_lines = '\n'.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2867 | self.assertRegex(joined_lines, '.*\- builder_mixin') |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2868 | fbb.printed_lines = [] |
| 2869 | self.assertFalse(fbb.printed_lines) |
| 2870 | |
| 2871 | def test_no_duplicate_keys_basic_test_suite(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2872 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, FOO_TEST_SUITE_NOT_SORTED, |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2873 | LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2874 | with self.assertRaisesRegex( |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2875 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2876 | ('The following files have invalid keys: ' + |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2877 | re.escape(self.args.test_suites_pyl_path)), |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2878 | ): |
Stephen Martinis | 5bef0fc | 2020-01-06 22:47:53 | [diff] [blame] | 2879 | fbb.check_input_file_consistency(verbose=True) |
| 2880 | joined_lines = '\n'.join(fbb.printed_lines) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2881 | self.assertRegex(joined_lines, '.*\- a_test') |
| 2882 | self.assertRegex(joined_lines, '.*\+ a_test') |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2883 | fbb.printed_lines = [] |
| 2884 | self.assertFalse(fbb.printed_lines) |
| 2885 | |
| 2886 | def test_type_assert_printing_help(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2887 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, TEST_SUITES_SYNTAX_ERROR, |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2888 | LUCI_MILO_CFG) |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2889 | with self.assertRaisesRegex( |
| 2890 | generate_buildbot_json.BBGenErr, |
Garrett Beaty | 807011ab | 2023-04-12 00:52:39 | [diff] [blame] | 2891 | f'Invalid \.pyl file \'{re.escape(self.args.test_suites_pyl_path)}\'.*', |
| 2892 | ): |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2893 | fbb.check_input_file_consistency(verbose=True) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2894 | self.assertEqual(fbb.printed_lines, [ |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 2895 | f'== {self.args.test_suites_pyl_path} ==', |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 2896 | '<snip>', |
| 2897 | '1 {', |
| 2898 | "2 'basic_suites': {", |
| 2899 | '--------------------------------------------------------------------' |
| 2900 | '------------', |
| 2901 | '3 3: {', |
| 2902 | '-------^------------------------------------------------------------' |
| 2903 | '------------', |
| 2904 | "4 'suite_c': {},", |
| 2905 | '5 },', |
| 2906 | '<snip>', |
| 2907 | ]) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2908 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2909 | def test_mixin_append(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2910 | fbb = FakeBBGen(self.args, |
| 2911 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Wez | c0e835b70 | 2018-10-30 00:38:41 | [diff] [blame] | 2912 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2913 | LUCI_MILO_CFG, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2914 | mixins=MIXIN_APPEND) |
| 2915 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2916 | r'.*\$mixin_append is no longer supported.*'): |
| 2917 | fbb.check_input_file_consistency(verbose=True) |
Austin Eng | 148d9f0f | 2022-02-08 19:18:53 | [diff] [blame] | 2918 | self.assertFalse(fbb.printed_lines) |
| 2919 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2920 | def test_swarming_named_caches(self): |
| 2921 | fbb = FakeBBGen(self.args, |
| 2922 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2923 | FOO_TEST_SUITE_WITH_SWARMING_NAMED_CACHES, |
| 2924 | LUCI_MILO_CFG, |
| 2925 | mixins=SWARMING_NAMED_CACHES) |
| 2926 | fbb.check_output_file_consistency(verbose=True) |
| 2927 | self.assertFalse(fbb.printed_lines) |
| 2928 | |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2929 | def test_args_field_not_list(self): |
| 2930 | fbb = FakeBBGen(self.args, |
| 2931 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2932 | FOO_TEST_SUITE_WITH_ARGS, |
| 2933 | LUCI_MILO_CFG, |
| 2934 | mixins=MIXIN_ARGS_NOT_LIST) |
| 2935 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 2936 | '"args" must be a list'): |
| 2937 | fbb.check_output_file_consistency(verbose=True) |
| 2938 | self.assertFalse(fbb.printed_lines) |
| 2939 | |
| 2940 | def test_args_field_merging(self): |
| 2941 | fbb = FakeBBGen(self.args, |
| 2942 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2943 | FOO_TEST_SUITE_WITH_ARGS, |
| 2944 | LUCI_MILO_CFG, |
| 2945 | mixins=MIXIN_ARGS) |
Garrett Beaty | 4c35b14 | 2023-06-23 21:01:23 | [diff] [blame] | 2946 | fbb.check_output_file_consistency(verbose=True) |
| 2947 | self.assertFalse(fbb.printed_lines) |
| 2948 | |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2949 | def test_linux_args_field_merging(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2950 | fbb = FakeBBGen(self.args, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2951 | FOO_LINUX_GTESTS_BUILDER_MIXIN_WATERFALL, |
| 2952 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 2953 | LUCI_MILO_CFG, |
Garrett Beaty | b061e69d | 2023-06-27 16:15:35 | [diff] [blame] | 2954 | mixins=MIXIN_LINUX_ARGS) |
| 2955 | fbb.check_output_file_consistency(verbose=True) |
Wez | c0e835b70 | 2018-10-30 00:38:41 | [diff] [blame] | 2956 | self.assertFalse(fbb.printed_lines) |
Stephen Martinis | 54d64ad | 2018-09-21 22:16:20 | [diff] [blame] | 2957 | |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2958 | def test_remove_mixin_builder_remove_waterfall(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2959 | fbb = FakeBBGen(self.args, |
| 2960 | FOO_GTESTS_WATERFALL_MIXIN_BUILDER_REMOVE_MIXIN_WATERFALL, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2961 | FOO_TEST_SUITE, |
| 2962 | LUCI_MILO_CFG, |
| 2963 | mixins=SWARMING_MIXINS) |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2964 | fbb.check_output_file_consistency(verbose=True) |
| 2965 | self.assertFalse(fbb.printed_lines) |
| 2966 | |
| 2967 | def test_remove_mixin_test_remove_waterfall(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2968 | fbb = FakeBBGen(self.args, |
| 2969 | FOO_GTESTS_WATERFALL_MIXIN_WATERFALL, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2970 | FOO_TEST_SUITE_WITH_REMOVE_WATERFALL_MIXIN, |
| 2971 | LUCI_MILO_CFG, |
| 2972 | mixins=SWARMING_MIXINS) |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2973 | fbb.check_output_file_consistency(verbose=True) |
| 2974 | self.assertFalse(fbb.printed_lines) |
| 2975 | |
| 2976 | def test_remove_mixin_test_remove_builder(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 2977 | fbb = FakeBBGen(self.args, |
| 2978 | FOO_GTESTS_BUILDER_MIXIN_WATERFALL, |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2979 | FOO_TEST_SUITE_WITH_REMOVE_BUILDER_MIXIN, |
| 2980 | LUCI_MILO_CFG, |
| 2981 | mixins=SWARMING_MIXINS) |
Brian Sheedy | 7658c98 | 2020-01-08 02:27:58 | [diff] [blame] | 2982 | fbb.check_output_file_consistency(verbose=True) |
| 2983 | self.assertFalse(fbb.printed_lines) |
| 2984 | |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 2985 | TEST_SUITE_WITH_PARAMS = """\ |
| 2986 | { |
| 2987 | 'basic_suites': { |
| 2988 | 'bar_tests': { |
| 2989 | 'bar_test': { |
| 2990 | 'args': ['--no-xvfb'], |
| 2991 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 2992 | 'dimensions': { |
| 2993 | 'device_os': 'NMF26U' |
| 2994 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 2995 | }, |
| 2996 | 'should_retry_with_patch': False, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 2997 | }, |
| 2998 | 'bar_test_test': { |
| 2999 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3000 | 'dimensions': { |
| 3001 | 'kvm': '1' |
| 3002 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3003 | 'hard_timeout': 1000 |
| 3004 | }, |
| 3005 | 'should_retry_with_patch': True |
| 3006 | } |
| 3007 | }, |
| 3008 | 'foo_tests': { |
| 3009 | 'foo_test_empty': {}, |
| 3010 | 'foo_test': { |
| 3011 | 'args': [ |
| 3012 | '--jobs=1', |
| 3013 | '--verbose' |
| 3014 | ], |
| 3015 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3016 | 'dimensions': { |
| 3017 | 'device_os': 'MMB29Q' |
| 3018 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3019 | 'hard_timeout': 1800 |
| 3020 | } |
| 3021 | }, |
Garrett Beaty | 235c141 | 2023-08-29 20:26:29 | [diff] [blame^] | 3022 | 'pls': { |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3023 | 'swarming': { |
| 3024 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3025 | }, |
| 3026 | }, |
| 3027 | }, |
| 3028 | 'compound_suites': { |
| 3029 | 'composition_tests': [ |
| 3030 | 'foo_tests', |
| 3031 | 'bar_tests', |
| 3032 | ], |
| 3033 | }, |
| 3034 | } |
| 3035 | """ |
| 3036 | TEST_QUERY_BOTS_OUTPUT = { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3037 | "Fake Android M Tester": { |
| 3038 | "gtest_tests": [{ |
| 3039 | "test": "foo_test", |
| 3040 | }] |
| 3041 | }, |
| 3042 | "Fake Android L Tester": { |
| 3043 | "gtest_tests": [{ |
| 3044 | "test": |
| 3045 | "foo_test", |
| 3046 | "args": [ |
| 3047 | "--gs-results-bucket=chromium-result-details", |
| 3048 | "--recover-devices" |
| 3049 | ], |
| 3050 | "merge": { |
| 3051 | "script": "//testing/merge_scripts/standard_gtest_merge.py" |
| 3052 | }, |
| 3053 | "swarming": { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3054 | "dimensions": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3055 | "device_os": "LMY41U", |
| 3056 | "device_os_type": "user", |
| 3057 | "device_type": "hammerhead", |
| 3058 | 'os': 'Android' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3059 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3060 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3061 | }] |
| 3062 | }, |
| 3063 | "Fake Android K Tester": { |
| 3064 | "additional_compile_targets": ["bar_test"], |
| 3065 | "gtest_tests": [{ |
| 3066 | "test": |
| 3067 | "foo_test", |
| 3068 | "args": [ |
| 3069 | "--gs-results-bucket=chromium-result-details", |
| 3070 | "--recover-devices" |
| 3071 | ], |
| 3072 | "merge": { |
| 3073 | "script": "//testing/merge_scripts/standard_gtest_merge.py" |
| 3074 | }, |
| 3075 | "swarming": { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3076 | "dimensions": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3077 | "device_os": "KTU84P", |
| 3078 | "device_os_type": "userdebug", |
| 3079 | "device_type": "hammerhead", |
| 3080 | "os": "Android", |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3081 | }, |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3082 | "output_links": [{ |
| 3083 | "link": [ |
| 3084 | "https://luci-logdog.appspot.com/v/?s", |
| 3085 | "=android%2Fswarming%2Flogcats%2F", |
| 3086 | "${TASK_ID}%2F%2B%2Funified_logcats" |
| 3087 | ], |
| 3088 | "name": |
| 3089 | "shard #${SHARD_INDEX} logcats" |
| 3090 | }] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3091 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3092 | }] |
| 3093 | }, |
| 3094 | "Android Builder": { |
| 3095 | "additional_compile_targets": ["bar_test"] |
| 3096 | } |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3097 | } |
| 3098 | TEST_QUERY_BOTS_TESTS_OUTPUT = { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3099 | "Fake Android M Tester": [{ |
| 3100 | "test": "foo_test", |
| 3101 | }], |
| 3102 | "Fake Android L Tester": [{ |
| 3103 | "test": |
| 3104 | "foo_test", |
| 3105 | "args": |
| 3106 | ["--gs-results-bucket=chromium-result-details", "--recover-devices"], |
| 3107 | "merge": { |
| 3108 | "script": "//testing/merge_scripts/standard_gtest_merge.py" |
| 3109 | }, |
| 3110 | "swarming": { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3111 | "dimensions": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3112 | "device_os": "LMY41U", |
| 3113 | "device_os_type": "user", |
| 3114 | "device_type": "hammerhead", |
| 3115 | "os": "Android" |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3116 | }, |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3117 | } |
| 3118 | }], |
| 3119 | "Android Builder": [], |
| 3120 | "Fake Android K Tester": [{ |
| 3121 | "test": |
| 3122 | "foo_test", |
| 3123 | "args": |
| 3124 | ["--gs-results-bucket=chromium-result-details", "--recover-devices"], |
| 3125 | "merge": { |
| 3126 | "script": "//testing/merge_scripts/standard_gtest_merge.py" |
| 3127 | }, |
| 3128 | "swarming": { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3129 | "dimensions": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3130 | "device_os": "KTU84P", |
| 3131 | "device_os_type": "userdebug", |
| 3132 | "device_type": "hammerhead", |
| 3133 | "os": "Android" |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3134 | }, |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3135 | "output_links": [{ |
| 3136 | "link": [ |
| 3137 | "https://luci-logdog.appspot.com/v/?s", |
| 3138 | "=android%2Fswarming%2Flogcats%2F", |
| 3139 | "${TASK_ID}%2F%2B%2Funified_logcats" |
| 3140 | ], |
| 3141 | "name": |
| 3142 | "shard #${SHARD_INDEX} logcats" |
| 3143 | }] |
| 3144 | } |
| 3145 | }] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3146 | } |
| 3147 | |
| 3148 | TEST_QUERY_BOT_OUTPUT = { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3149 | "additional_compile_targets": ["bar_test"], |
| 3150 | "gtest_tests": [ |
| 3151 | { |
| 3152 | "test": |
| 3153 | "foo_test", |
| 3154 | "args": [ |
| 3155 | "--gs-results-bucket=chromium-result-details", |
| 3156 | "--recover-devices", |
| 3157 | ], |
| 3158 | "merge": { |
| 3159 | "script": "//testing/merge_scripts/standard_gtest_merge.py", |
| 3160 | }, |
| 3161 | "swarming": { |
| 3162 | "dimensions": { |
| 3163 | "device_os": "KTU84P", |
| 3164 | "device_os_type": "userdebug", |
| 3165 | "device_type": "hammerhead", |
| 3166 | "os": "Android", |
| 3167 | }, |
| 3168 | "output_links": [ |
| 3169 | { |
| 3170 | "link": [ |
| 3171 | "https://luci-logdog.appspot.com/v/?s", |
| 3172 | "=android%2Fswarming%2Flogcats%2F", |
| 3173 | "${TASK_ID}%2F%2B%2Funified_logcats" |
| 3174 | ], |
| 3175 | "name": |
| 3176 | "shard #${SHARD_INDEX} logcats", |
| 3177 | }, |
| 3178 | ], |
| 3179 | }, |
| 3180 | }, |
| 3181 | ], |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3182 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3183 | TEST_QUERY_BOT_TESTS_OUTPUT = [{ |
| 3184 | "test": |
| 3185 | "foo_test", |
| 3186 | "args": |
| 3187 | ["--gs-results-bucket=chromium-result-details", "--recover-devices"], |
Stephen Martinis | bc7b777 | 2019-05-01 22:01:43 | [diff] [blame] | 3188 | "merge": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3189 | "script": "//testing/merge_scripts/standard_gtest_merge.py" |
Stephen Martinis | bc7b777 | 2019-05-01 22:01:43 | [diff] [blame] | 3190 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3191 | "swarming": { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3192 | "dimensions": { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3193 | "device_os": "LMY41U", |
| 3194 | "device_os_type": "user", |
| 3195 | "device_type": "hammerhead", |
| 3196 | "os": "Android" |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3197 | }, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3198 | } |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 3199 | }] |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3200 | |
| 3201 | TEST_QUERY_TESTS_OUTPUT = { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3202 | "bar_test": { |
| 3203 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3204 | 'dimensions': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3205 | 'os': 'Linux' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3206 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3207 | } |
| 3208 | }, |
| 3209 | "foo_test": { |
| 3210 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3211 | 'dimensions': { |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3212 | 'os': 'Linux' |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3213 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 3214 | } |
| 3215 | } |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3216 | } |
| 3217 | |
| 3218 | TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT = ["foo_test"] |
| 3219 | |
| 3220 | TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT = ["bar_test"] |
| 3221 | |
| 3222 | TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT = ["bar_test_test"] |
| 3223 | |
| 3224 | TEST_QUERY_TESTS_PARAMS_OUTPUT = ['bar_test_test'] |
| 3225 | |
| 3226 | TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT = ['bar_test'] |
| 3227 | |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 3228 | TEST_QUERY_TEST_OUTPUT = {'swarming': {'dimensions': {'os': 'Linux'}}} |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3229 | |
| 3230 | TEST_QUERY_TEST_BOTS_OUTPUT = [ |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3231 | "Fake Android K Tester", |
| 3232 | "Fake Android L Tester", |
| 3233 | "Fake Android M Tester", |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3234 | ] |
| 3235 | |
| 3236 | TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT = ['Fake Tester'] |
| 3237 | |
| 3238 | TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT = [] |
| 3239 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3240 | |
| 3241 | class QueryTests(TestCase): |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3242 | """Tests for the query feature.""" |
| 3243 | def test_query_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3244 | self.set_args('--query=bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3245 | fbb = FakeBBGen(self.args, |
| 3246 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3247 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3248 | LUCI_MILO_CFG, |
| 3249 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3250 | fbb.query(fbb.args) |
| 3251 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3252 | self.assertEqual(query_json, TEST_QUERY_BOTS_OUTPUT) |
| 3253 | |
| 3254 | def test_query_bots_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3255 | self.set_args('--query=bots/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3256 | fbb = FakeBBGen(self.args, |
| 3257 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3258 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3259 | LUCI_MILO_CFG, |
| 3260 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3261 | with self.assertRaises(SystemExit) as cm: |
| 3262 | fbb.query(fbb.args) |
| 3263 | self.assertEqual(cm.exception.code, 1) |
| 3264 | self.assertTrue(fbb.printed_lines) |
| 3265 | |
| 3266 | def test_query_bots_json(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3267 | self.set_args('--query=bots', '--json=result.json') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3268 | fbb = FakeBBGen(self.args, |
| 3269 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3270 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3271 | LUCI_MILO_CFG, |
| 3272 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3273 | fbb.query(fbb.args) |
| 3274 | self.assertFalse(fbb.printed_lines) |
| 3275 | |
| 3276 | def test_query_bots_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3277 | self.set_args('--query=bots/tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3278 | fbb = FakeBBGen(self.args, |
| 3279 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3280 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3281 | LUCI_MILO_CFG, |
| 3282 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3283 | fbb.query(fbb.args) |
| 3284 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3285 | self.assertEqual(query_json, TEST_QUERY_BOTS_TESTS_OUTPUT) |
| 3286 | |
| 3287 | def test_query_invalid_bots_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3288 | self.set_args('--query=bots/tdfjdk') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3289 | fbb = FakeBBGen(self.args, |
| 3290 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3291 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3292 | LUCI_MILO_CFG, |
| 3293 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3294 | with self.assertRaises(SystemExit) as cm: |
| 3295 | fbb.query(fbb.args) |
| 3296 | self.assertEqual(cm.exception.code, 1) |
| 3297 | self.assertTrue(fbb.printed_lines) |
| 3298 | |
| 3299 | def test_query_bot(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3300 | self.set_args('--query=bot/Fake Android K Tester') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3301 | fbb = FakeBBGen(self.args, |
| 3302 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3303 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3304 | LUCI_MILO_CFG, |
| 3305 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3306 | fbb.query(fbb.args) |
| 3307 | query_json = json.loads("".join(fbb.printed_lines)) |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3308 | self.maxDiff = None # pragma pylint: disable=attribute-defined-outside-init |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3309 | self.assertEqual(query_json, TEST_QUERY_BOT_OUTPUT) |
| 3310 | |
| 3311 | def test_query_bot_invalid_id(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3312 | self.set_args('--query=bot/bot1') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3313 | fbb = FakeBBGen(self.args, |
| 3314 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3315 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3316 | LUCI_MILO_CFG, |
| 3317 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3318 | with self.assertRaises(SystemExit) as cm: |
| 3319 | fbb.query(fbb.args) |
| 3320 | self.assertEqual(cm.exception.code, 1) |
| 3321 | self.assertTrue(fbb.printed_lines) |
| 3322 | |
| 3323 | def test_query_bot_invalid_query_too_many(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3324 | self.set_args('--query=bot/Fake Android K Tester/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3325 | fbb = FakeBBGen(self.args, |
| 3326 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3327 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3328 | LUCI_MILO_CFG, |
| 3329 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3330 | with self.assertRaises(SystemExit) as cm: |
| 3331 | fbb.query(fbb.args) |
| 3332 | self.assertEqual(cm.exception.code, 1) |
| 3333 | self.assertTrue(fbb.printed_lines) |
| 3334 | |
| 3335 | def test_query_bot_invalid_query_no_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3336 | self.set_args('--query=bot/Fake Android K Tester/blahs') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3337 | fbb = FakeBBGen(self.args, |
| 3338 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3339 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3340 | LUCI_MILO_CFG, |
| 3341 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3342 | with self.assertRaises(SystemExit) as cm: |
| 3343 | fbb.query(fbb.args) |
| 3344 | self.assertEqual(cm.exception.code, 1) |
| 3345 | self.assertTrue(fbb.printed_lines) |
| 3346 | |
| 3347 | def test_query_bot_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3348 | self.set_args('--query=bot/Fake Android L Tester/tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3349 | fbb = FakeBBGen(self.args, |
| 3350 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3351 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3352 | LUCI_MILO_CFG, |
| 3353 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3354 | fbb.query(fbb.args) |
| 3355 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3356 | self.assertEqual(query_json, TEST_QUERY_BOT_TESTS_OUTPUT) |
| 3357 | |
| 3358 | def test_query_tests(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3359 | self.set_args('--query=tests') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3360 | fbb = FakeBBGen(self.args, |
| 3361 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3362 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3363 | LUCI_MILO_CFG, |
| 3364 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3365 | fbb.query(fbb.args) |
| 3366 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3367 | self.assertEqual(query_json, TEST_QUERY_TESTS_OUTPUT) |
| 3368 | |
| 3369 | def test_query_tests_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3370 | self.set_args('--query=tests/blah/blah') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3371 | fbb = FakeBBGen(self.args, |
| 3372 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3373 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3374 | LUCI_MILO_CFG, |
| 3375 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3376 | with self.assertRaises(SystemExit) as cm: |
| 3377 | fbb.query(fbb.args) |
| 3378 | self.assertEqual(cm.exception.code, 1) |
| 3379 | self.assertTrue(fbb.printed_lines) |
| 3380 | |
| 3381 | def test_query_tests_multiple_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3382 | self.set_args('--query=tests/--jobs=1&--verbose') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3383 | fbb = FakeBBGen(self.args, |
| 3384 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3385 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3386 | LUCI_MILO_CFG, |
| 3387 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3388 | fbb.query(fbb.args) |
| 3389 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3390 | self.assertEqual(query_json, TEST_QUERY_TESTS_MULTIPLE_PARAMS_OUTPUT) |
| 3391 | |
| 3392 | def test_query_tests_invalid_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3393 | self.set_args('--query=tests/device_os?') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3394 | fbb = FakeBBGen(self.args, |
| 3395 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3396 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3397 | LUCI_MILO_CFG, |
| 3398 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3399 | with self.assertRaises(SystemExit) as cm: |
| 3400 | fbb.query(fbb.args) |
| 3401 | self.assertEqual(cm.exception.code, 1) |
| 3402 | self.assertTrue(fbb.printed_lines) |
| 3403 | |
| 3404 | def test_query_tests_dimension_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3405 | self.set_args('--query=tests/device_os:NMF26U') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3406 | fbb = FakeBBGen(self.args, |
| 3407 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3408 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3409 | LUCI_MILO_CFG, |
| 3410 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3411 | fbb.query(fbb.args) |
| 3412 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3413 | self.assertEqual(query_json, TEST_QUERY_TESTS_DIMENSION_PARAMS_OUTPUT) |
| 3414 | |
| 3415 | def test_query_tests_swarming_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3416 | self.set_args('--query=tests/hard_timeout:1000') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3417 | fbb = FakeBBGen(self.args, |
| 3418 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3419 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3420 | LUCI_MILO_CFG, |
| 3421 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3422 | fbb.query(fbb.args) |
| 3423 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3424 | self.assertEqual(query_json, TEST_QUERY_TESTS_SWARMING_PARAMS_OUTPUT) |
| 3425 | |
| 3426 | def test_query_tests_params(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3427 | self.set_args('--query=tests/should_retry_with_patch:true') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3428 | fbb = FakeBBGen(self.args, |
| 3429 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3430 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3431 | LUCI_MILO_CFG, |
| 3432 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3433 | fbb.query(fbb.args) |
| 3434 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3435 | self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_OUTPUT) |
| 3436 | |
| 3437 | def test_query_tests_params_false(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3438 | self.set_args('--query=tests/should_retry_with_patch:false') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3439 | fbb = FakeBBGen(self.args, |
| 3440 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3441 | TEST_SUITE_WITH_PARAMS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3442 | LUCI_MILO_CFG, |
| 3443 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3444 | fbb.query(fbb.args) |
| 3445 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3446 | self.assertEqual(query_json, TEST_QUERY_TESTS_PARAMS_FALSE_OUTPUT) |
| 3447 | |
| 3448 | def test_query_test(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3449 | self.set_args('--query=test/foo_test') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3450 | fbb = FakeBBGen(self.args, |
| 3451 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3452 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3453 | LUCI_MILO_CFG, |
| 3454 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3455 | fbb.query(fbb.args) |
| 3456 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3457 | self.assertEqual(query_json, TEST_QUERY_TEST_OUTPUT) |
| 3458 | |
| 3459 | def test_query_test_invalid_id(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3460 | self.set_args('--query=test/foo_foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3461 | fbb = FakeBBGen(self.args, |
| 3462 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3463 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3464 | LUCI_MILO_CFG, |
| 3465 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3466 | with self.assertRaises(SystemExit) as cm: |
| 3467 | fbb.query(fbb.args) |
| 3468 | self.assertEqual(cm.exception.code, 1) |
| 3469 | self.assertTrue(fbb.printed_lines) |
| 3470 | |
| 3471 | def test_query_test_invalid_length(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3472 | self.set_args('--query=test/foo_tests/foo/foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3473 | fbb = FakeBBGen(self.args, |
| 3474 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3475 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3476 | LUCI_MILO_CFG, |
| 3477 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3478 | with self.assertRaises(SystemExit) as cm: |
| 3479 | fbb.query(fbb.args) |
| 3480 | self.assertEqual(cm.exception.code, 1) |
| 3481 | self.assertTrue(fbb.printed_lines) |
| 3482 | |
| 3483 | def test_query_test_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3484 | self.set_args('--query=test/foo_test/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3485 | fbb = FakeBBGen(self.args, |
| 3486 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3487 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3488 | LUCI_MILO_CFG, |
| 3489 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3490 | fbb.query(fbb.args) |
| 3491 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3492 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_OUTPUT) |
| 3493 | |
| 3494 | def test_query_test_bots_isolated_scripts(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3495 | self.set_args('--query=test/foo_test/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3496 | fbb = FakeBBGen(self.args, |
| 3497 | FOO_ISOLATED_SCRIPTS_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3498 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3499 | LUCI_MILO_CFG, |
| 3500 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3501 | fbb.query(fbb.args) |
| 3502 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3503 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_ISOLATED_SCRIPTS_OUTPUT) |
| 3504 | |
| 3505 | def test_query_test_bots_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3506 | self.set_args('--query=test/foo_tests/foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3507 | fbb = FakeBBGen(self.args, |
| 3508 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3509 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3510 | LUCI_MILO_CFG, |
| 3511 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3512 | with self.assertRaises(SystemExit) as cm: |
| 3513 | fbb.query(fbb.args) |
| 3514 | self.assertEqual(cm.exception.code, 1) |
| 3515 | self.assertTrue(fbb.printed_lines) |
| 3516 | |
| 3517 | def test_query_test_bots_no_bots(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3518 | self.set_args('--query=test/bar_tests/bots') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3519 | fbb = FakeBBGen(self.args, |
| 3520 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3521 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3522 | LUCI_MILO_CFG, |
| 3523 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3524 | fbb.query(fbb.args) |
| 3525 | query_json = json.loads("".join(fbb.printed_lines)) |
| 3526 | self.assertEqual(query_json, TEST_QUERY_TEST_BOTS_NO_BOTS_OUTPUT) |
| 3527 | |
| 3528 | def test_query_invalid(self): |
Garrett Beaty | 79339e18 | 2023-04-10 20:45:47 | [diff] [blame] | 3529 | self.set_args('--query=foo') |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3530 | fbb = FakeBBGen(self.args, |
| 3531 | ANDROID_WATERFALL, |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3532 | GOOD_COMPOSITION_TEST_SUITES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3533 | LUCI_MILO_CFG, |
| 3534 | mixins=SWARMING_MIXINS_SORTED) |
Karen Qian | e24b7ee | 2019-02-12 23:37:06 | [diff] [blame] | 3535 | with self.assertRaises(SystemExit) as cm: |
| 3536 | fbb.query(fbb.args) |
| 3537 | self.assertEqual(cm.exception.code, 1) |
| 3538 | self.assertTrue(fbb.printed_lines) |
| 3539 | |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3540 | |
| 3541 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES_SEPARATE_ENTRIES = """\ |
| 3542 | { |
| 3543 | 'basic_suites': { |
| 3544 | 'foo_tests': { |
| 3545 | 'foo_test': { |
| 3546 | 'args': [ |
| 3547 | '--enable-features', |
| 3548 | 'Foo,Bar', |
| 3549 | ], |
| 3550 | }, |
| 3551 | }, |
| 3552 | }, |
| 3553 | } |
| 3554 | """ |
| 3555 | |
| 3556 | |
| 3557 | FOO_TEST_REPLACEMENTS_REMOVE_NO_VALUE = """\ |
| 3558 | { |
| 3559 | 'foo_test': { |
| 3560 | 'replacements': { |
| 3561 | 'Fake Tester': { |
| 3562 | 'args': { |
| 3563 | '--c_arg': None, |
| 3564 | }, |
| 3565 | }, |
| 3566 | }, |
| 3567 | }, |
| 3568 | } |
| 3569 | """ |
| 3570 | |
| 3571 | |
| 3572 | FOO_TEST_REPLACEMENTS_REMOVE_VALUE = """\ |
| 3573 | { |
| 3574 | 'foo_test': { |
| 3575 | 'replacements': { |
| 3576 | 'Fake Tester': { |
| 3577 | 'args': { |
| 3578 | '--enable-features': None, |
| 3579 | }, |
| 3580 | }, |
| 3581 | }, |
| 3582 | }, |
| 3583 | } |
| 3584 | """ |
| 3585 | |
| 3586 | |
| 3587 | FOO_TEST_REPLACEMENTS_REPLACE_VALUE = """\ |
| 3588 | { |
| 3589 | 'foo_test': { |
| 3590 | 'replacements': { |
| 3591 | 'Fake Tester': { |
| 3592 | 'args': { |
| 3593 | '--enable-features': 'Bar,Baz', |
| 3594 | }, |
| 3595 | }, |
| 3596 | }, |
| 3597 | }, |
| 3598 | } |
| 3599 | """ |
| 3600 | |
| 3601 | |
| 3602 | FOO_TEST_REPLACEMENTS_INVALID_KEY = """\ |
| 3603 | { |
| 3604 | 'foo_test': { |
| 3605 | 'replacements': { |
| 3606 | 'Fake Tester': { |
| 3607 | 'invalid': { |
| 3608 | '--enable-features': 'Bar,Baz', |
| 3609 | }, |
| 3610 | }, |
| 3611 | }, |
| 3612 | }, |
| 3613 | } |
| 3614 | """ |
| 3615 | |
| 3616 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3617 | class ReplacementTests(TestCase): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3618 | """Tests for the arg replacement feature.""" |
| 3619 | def test_replacement_valid_remove_no_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3620 | fbb = FakeBBGen(self.args, |
| 3621 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3622 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3623 | LUCI_MILO_CFG, |
| 3624 | exceptions=FOO_TEST_REPLACEMENTS_REMOVE_NO_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3625 | fbb.check_output_file_consistency(verbose=True) |
| 3626 | self.assertFalse(fbb.printed_lines) |
| 3627 | |
| 3628 | def test_replacement_valid_remove_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3629 | fbb = FakeBBGen(self.args, |
| 3630 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3631 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3632 | LUCI_MILO_CFG, |
| 3633 | exceptions=FOO_TEST_REPLACEMENTS_REMOVE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3634 | fbb.check_output_file_consistency(verbose=True) |
| 3635 | self.assertFalse(fbb.printed_lines) |
| 3636 | |
| 3637 | def test_replacement_valid_replace_value(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3638 | fbb = FakeBBGen(self.args, |
| 3639 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3640 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3641 | LUCI_MILO_CFG, |
| 3642 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3643 | fbb.check_output_file_consistency(verbose=True) |
| 3644 | self.assertFalse(fbb.printed_lines) |
| 3645 | |
| 3646 | def test_replacement_valid_replace_value_separate_entries(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3647 | fbb = FakeBBGen(self.args, |
| 3648 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3649 | FOO_TEST_SUITE_WITH_ENABLE_FEATURES_SEPARATE_ENTRIES, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3650 | LUCI_MILO_CFG, |
| 3651 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3652 | fbb.check_output_file_consistency(verbose=True) |
| 3653 | self.assertFalse(fbb.printed_lines) |
| 3654 | |
| 3655 | def test_replacement_invalid_key_not_valid(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3656 | fbb = FakeBBGen(self.args, |
| 3657 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3658 | FOO_TEST_SUITE, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3659 | LUCI_MILO_CFG, |
| 3660 | exceptions=FOO_TEST_REPLACEMENTS_INVALID_KEY) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3661 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3662 | 'Given replacement key *'): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3663 | fbb.check_output_file_consistency(verbose=True) |
| 3664 | |
| 3665 | def test_replacement_invalid_key_not_found(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3666 | fbb = FakeBBGen(self.args, |
| 3667 | FOO_GTESTS_WATERFALL, |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3668 | FOO_TEST_SUITE_WITH_ARGS, |
Nodir Turakulov | fce3429 | 2019-12-18 17:05:41 | [diff] [blame] | 3669 | LUCI_MILO_CFG, |
| 3670 | exceptions=FOO_TEST_REPLACEMENTS_REPLACE_VALUE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3671 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3672 | 'Could not find *'): |
Brian Sheedy | e6ea0ee | 2019-07-11 02:54:37 | [diff] [blame] | 3673 | fbb.check_output_file_consistency(verbose=True) |
| 3674 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3675 | |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3676 | FOO_TEST_SUITE_WITH_MAGIC_ARGS = """\ |
| 3677 | { |
| 3678 | 'basic_suites': { |
| 3679 | 'foo_tests': { |
| 3680 | 'foo_test': { |
| 3681 | 'args': [ |
| 3682 | '$$MAGIC_SUBSTITUTION_TestOnlySubstitution', |
| 3683 | ], |
| 3684 | }, |
| 3685 | }, |
| 3686 | }, |
| 3687 | } |
| 3688 | """ |
| 3689 | |
| 3690 | |
| 3691 | FOO_TEST_SUITE_WITH_INVALID_MAGIC_ARGS = """\ |
| 3692 | { |
| 3693 | 'basic_suites': { |
| 3694 | 'foo_tests': { |
| 3695 | 'foo_test': { |
| 3696 | 'args': [ |
| 3697 | '$$MAGIC_SUBSTITUTION_NotARealSubstitution', |
| 3698 | ], |
| 3699 | }, |
| 3700 | }, |
| 3701 | }, |
| 3702 | } |
| 3703 | """ |
| 3704 | |
| 3705 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3706 | class MagicSubstitutionTests(TestCase): |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3707 | """Tests for the magic substitution feature.""" |
| 3708 | def test_valid_function(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3709 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, |
| 3710 | FOO_TEST_SUITE_WITH_MAGIC_ARGS, LUCI_MILO_CFG) |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3711 | fbb.check_output_file_consistency(verbose=True) |
| 3712 | self.assertFalse(fbb.printed_lines) |
| 3713 | |
| 3714 | def test_invalid_function(self): |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 3715 | fbb = FakeBBGen(self.args, FOO_GTESTS_WATERFALL, |
| 3716 | FOO_TEST_SUITE_WITH_INVALID_MAGIC_ARGS, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 3717 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 3718 | 'Magic substitution function *'): |
Brian Sheedy | a31578e | 2020-05-18 20:24:36 | [diff] [blame] | 3719 | fbb.check_output_file_consistency(verbose=True) |
| 3720 | |
| 3721 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3722 | # Matrix compound composition test suites |
| 3723 | |
| 3724 | MATRIX_COMPOUND_EMPTY = """\ |
| 3725 | { |
| 3726 | 'basic_suites': { |
| 3727 | 'bar_tests': { |
| 3728 | 'bar_test': {}, |
| 3729 | }, |
| 3730 | 'foo_tests': { |
| 3731 | 'foo_test': {}, |
| 3732 | }, |
| 3733 | }, |
| 3734 | 'matrix_compound_suites': { |
| 3735 | 'matrix_tests': { |
| 3736 | 'foo_tests': {}, |
| 3737 | 'bar_tests': {}, |
| 3738 | }, |
| 3739 | }, |
| 3740 | } |
| 3741 | """ |
| 3742 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 3743 | MATRIX_COMPOUND_EMPTY_WITH_DESCRIPTION = """\ |
| 3744 | { |
| 3745 | 'basic_suites': { |
| 3746 | 'bar_tests': { |
| 3747 | 'bar_test': { |
| 3748 | 'description': 'This is a bar test', |
| 3749 | }, |
| 3750 | }, |
| 3751 | 'foo_tests': { |
| 3752 | 'foo_test': {}, |
| 3753 | }, |
| 3754 | }, |
| 3755 | 'matrix_compound_suites': { |
| 3756 | 'matrix_tests': { |
| 3757 | 'foo_tests': {}, |
| 3758 | 'bar_tests': {}, |
| 3759 | }, |
| 3760 | }, |
| 3761 | } |
| 3762 | """ |
| 3763 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3764 | MATRIX_COMPOUND_MISSING_IDENTIFIER = """\ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3765 | { |
| 3766 | 'basic_suites': { |
| 3767 | 'foo_tests': { |
| 3768 | 'foo_test': {}, |
| 3769 | }, |
| 3770 | }, |
| 3771 | 'matrix_compound_suites': { |
| 3772 | 'matrix_tests': { |
| 3773 | 'foo_tests': { |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3774 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3775 | 'missing-identifier', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3776 | ], |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3777 | }, |
| 3778 | }, |
| 3779 | }, |
| 3780 | } |
| 3781 | """ |
| 3782 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3783 | VARIANTS_FILE_MISSING_IDENTIFIER = """\ |
| 3784 | { |
| 3785 | 'missing-identifier': {} |
| 3786 | } |
| 3787 | """ |
| 3788 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3789 | MATRIX_COMPOUND_EMPTY_IDENTIFIER = """\ |
| 3790 | { |
| 3791 | 'basic_suites': { |
| 3792 | 'foo_tests': { |
| 3793 | 'foo_test': {}, |
| 3794 | }, |
| 3795 | }, |
| 3796 | 'matrix_compound_suites': { |
| 3797 | 'matrix_tests': { |
| 3798 | 'foo_tests': { |
| 3799 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3800 | 'empty-identifier', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3801 | ], |
| 3802 | }, |
| 3803 | }, |
| 3804 | }, |
| 3805 | } |
| 3806 | """ |
| 3807 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3808 | EMPTY_IDENTIFIER_VARIANTS = """\ |
| 3809 | { |
| 3810 | 'empty-identifier': { |
| 3811 | 'identifier': '', |
| 3812 | 'swarming': { |
| 3813 | 'dimensions': { |
| 3814 | 'foo': 'empty identifier not allowed', |
| 3815 | }, |
| 3816 | }, |
| 3817 | }, |
| 3818 | } |
| 3819 | """ |
| 3820 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3821 | MATRIX_COMPOUND_TRAILING_IDENTIFIER = """\ |
| 3822 | { |
| 3823 | 'basic_suites': { |
| 3824 | 'foo_tests': { |
| 3825 | 'foo_test': {}, |
| 3826 | }, |
| 3827 | }, |
| 3828 | 'matrix_compound_suites': { |
| 3829 | 'matrix_tests': { |
| 3830 | 'foo_tests': { |
| 3831 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3832 | 'trailing-whitespace', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3833 | ], |
| 3834 | }, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 3835 | }, |
| 3836 | }, |
| 3837 | } |
| 3838 | """ |
| 3839 | |
| 3840 | TRAILING_WHITESPACE_VARIANTS = """\ |
| 3841 | { |
| 3842 | 'trailing-whitespace': { |
| 3843 | 'identifier': 'id ', |
| 3844 | 'swarming': { |
| 3845 | 'dimensions': { |
| 3846 | 'foo': 'trailing whitespace not allowed', |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 3847 | }, |
| 3848 | }, |
| 3849 | }, |
| 3850 | } |
| 3851 | """ |
| 3852 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3853 | MATRIX_REF_NONEXISTENT = """\ |
| 3854 | { |
| 3855 | 'basic_suites': { |
| 3856 | 'foo_tests': { |
| 3857 | 'foo_test': {}, |
| 3858 | }, |
| 3859 | }, |
| 3860 | 'matrix_compound_suites': { |
| 3861 | 'matrix_tests': { |
| 3862 | 'bar_test': {}, |
| 3863 | }, |
| 3864 | }, |
| 3865 | } |
| 3866 | """ |
| 3867 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3868 | MATRIX_COMPOUND_REF_COMPOSITION = """\ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 3869 | { |
| 3870 | 'basic_suites': { |
| 3871 | 'foo_tests': { |
| 3872 | 'foo_test': {}, |
| 3873 | }, |
| 3874 | }, |
| 3875 | 'compound_suites': { |
| 3876 | 'sample_composition': { |
| 3877 | 'foo_tests': {}, |
| 3878 | }, |
| 3879 | }, |
| 3880 | 'matrix_compound_suites': { |
| 3881 | 'matrix_tests': { |
| 3882 | 'sample_composition': {}, |
| 3883 | }, |
| 3884 | }, |
| 3885 | } |
| 3886 | """ |
| 3887 | |
| 3888 | MATRIX_COMPOSITION_REF_MATRIX = """\ |
| 3889 | { |
| 3890 | 'basic_suites': { |
| 3891 | 'foo_tests': { |
| 3892 | 'foo_test': {}, |
| 3893 | }, |
| 3894 | }, |
| 3895 | 'matrix_compound_suites': { |
| 3896 | 'a_test': { |
| 3897 | 'foo_tests': {}, |
| 3898 | }, |
| 3899 | 'matrix_tests': { |
| 3900 | 'a_test': {}, |
| 3901 | }, |
| 3902 | }, |
| 3903 | } |
| 3904 | """ |
| 3905 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 3906 | MATRIX_COMPOUND_VARIANTS_MIXINS_MERGE = """\ |
| 3907 | { |
| 3908 | 'basic_suites': { |
| 3909 | 'foo_tests': { |
| 3910 | 'set': { |
| 3911 | 'mixins': [ 'test_mixin' ], |
| 3912 | }, |
| 3913 | }, |
| 3914 | }, |
| 3915 | 'matrix_compound_suites': { |
| 3916 | 'matrix_tests': { |
| 3917 | 'foo_tests': { |
| 3918 | 'variants': [ |
| 3919 | { |
| 3920 | 'mixins': [ 'dimension_mixin' ], |
| 3921 | }, |
| 3922 | ], |
| 3923 | }, |
| 3924 | }, |
| 3925 | }, |
| 3926 | } |
| 3927 | """ |
| 3928 | |
| 3929 | MATRIX_COMPOUND_VARIANTS_MIXINS = """\ |
| 3930 | { |
| 3931 | 'basic_suites': { |
| 3932 | 'foo_tests': { |
| 3933 | 'set': { |
| 3934 | 'mixins': [ 'test_mixin' ], |
| 3935 | }, |
| 3936 | }, |
| 3937 | }, |
| 3938 | 'matrix_compound_suites': { |
| 3939 | 'matrix_tests': { |
| 3940 | 'foo_tests': { |
| 3941 | 'variants': [ |
| 3942 | { |
| 3943 | 'mixins': [ |
| 3944 | 'dimension_mixin', |
| 3945 | 'waterfall_mixin', |
| 3946 | 'builder_mixin', |
| 3947 | 'random_mixin' |
| 3948 | ], |
| 3949 | }, |
| 3950 | ], |
| 3951 | }, |
| 3952 | }, |
| 3953 | }, |
| 3954 | } |
| 3955 | """ |
| 3956 | |
| 3957 | MATRIX_COMPOUND_VARIANTS_MIXINS_REMOVE = """\ |
| 3958 | { |
| 3959 | 'basic_suites': { |
| 3960 | 'foo_tests': { |
| 3961 | 'set': { |
| 3962 | 'remove_mixins': ['builder_mixin'], |
| 3963 | }, |
| 3964 | }, |
| 3965 | }, |
| 3966 | 'matrix_compound_suites': { |
| 3967 | 'matrix_tests': { |
| 3968 | 'foo_tests': { |
| 3969 | 'variants': [ |
| 3970 | { |
| 3971 | 'mixins': [ 'builder_mixin' ], |
| 3972 | } |
| 3973 | ], |
| 3974 | }, |
| 3975 | }, |
| 3976 | }, |
| 3977 | } |
| 3978 | """ |
| 3979 | |
| 3980 | MATRIX_COMPOUND_CONFLICTING_TEST_SUITES = """\ |
| 3981 | { |
| 3982 | 'basic_suites': { |
| 3983 | 'bar_tests': { |
| 3984 | 'baz_tests': { |
| 3985 | 'args': [ |
| 3986 | '--bar', |
| 3987 | ], |
| 3988 | } |
| 3989 | }, |
| 3990 | 'foo_tests': { |
| 3991 | 'baz_tests': { |
| 3992 | 'args': [ |
| 3993 | '--foo', |
| 3994 | ], |
| 3995 | } |
| 3996 | }, |
| 3997 | }, |
| 3998 | 'matrix_compound_suites': { |
| 3999 | 'matrix_tests': { |
| 4000 | 'bar_tests': { |
| 4001 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4002 | 'a_variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4003 | ], |
| 4004 | }, |
| 4005 | 'foo_tests': { |
| 4006 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4007 | 'a_variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4008 | ] |
| 4009 | } |
| 4010 | }, |
| 4011 | }, |
| 4012 | } |
| 4013 | """ |
| 4014 | |
| 4015 | MATRIX_COMPOUND_TARGETS_ARGS = """\ |
| 4016 | { |
| 4017 | 'basic_suites': { |
| 4018 | 'foo_tests': { |
| 4019 | 'args_test': { |
| 4020 | 'args': [ |
| 4021 | '--iam' |
| 4022 | ], |
| 4023 | }, |
| 4024 | } |
| 4025 | }, |
| 4026 | 'matrix_compound_suites': { |
| 4027 | 'matrix_tests': { |
| 4028 | 'foo_tests': { |
| 4029 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4030 | 'an-arg', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4031 | ], |
| 4032 | }, |
| 4033 | }, |
| 4034 | }, |
| 4035 | } |
| 4036 | """ |
| 4037 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4038 | ARGS_VARIANTS_FILE = """\ |
| 4039 | { |
| 4040 | 'an-arg': { |
| 4041 | 'identifier': 'args', |
| 4042 | 'args': [ |
| 4043 | '--anarg', |
| 4044 | ], |
| 4045 | }, |
| 4046 | } |
| 4047 | """ |
| 4048 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4049 | MATRIX_COMPOUND_TARGETS_MIXINS = """\ |
| 4050 | { |
| 4051 | 'basic_suites': { |
| 4052 | 'foo_tests': { |
| 4053 | 'mixins_test': { |
| 4054 | 'mixins': [ 'test_mixin' ], |
| 4055 | }, |
| 4056 | } |
| 4057 | }, |
| 4058 | 'matrix_compound_suites': { |
| 4059 | 'matrix_tests': { |
| 4060 | 'foo_tests': { |
Jeff Yoon | 85fb8df | 2020-08-20 16:47:43 | [diff] [blame] | 4061 | 'mixins': [ 'random_mixin' ], |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4062 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4063 | 'mixins', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4064 | ], |
| 4065 | }, |
| 4066 | }, |
| 4067 | }, |
| 4068 | } |
| 4069 | """ |
| 4070 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4071 | MIXINS_VARIANTS_FILE = """\ |
| 4072 | { |
| 4073 | 'mixins': { |
| 4074 | 'identifier': 'mixins', |
| 4075 | 'mixins': [ 'dimension_mixin' ], |
| 4076 | }, |
| 4077 | } |
| 4078 | """ |
| 4079 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4080 | MATRIX_COMPOUND_TARGETS_SWARMING = """\ |
| 4081 | { |
| 4082 | 'basic_suites': { |
| 4083 | 'foo_tests': { |
| 4084 | 'swarming_test': { |
| 4085 | 'swarming': { |
| 4086 | 'foo': 'bar', |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4087 | 'dimensions': { |
| 4088 | 'foo': 'bar', |
| 4089 | }, |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4090 | }, |
| 4091 | }, |
| 4092 | } |
| 4093 | }, |
| 4094 | 'matrix_compound_suites': { |
| 4095 | 'matrix_tests': { |
| 4096 | 'foo_tests': { |
| 4097 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4098 | 'swarming-variant', |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4099 | ], |
| 4100 | }, |
| 4101 | }, |
| 4102 | }, |
| 4103 | } |
| 4104 | """ |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4105 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4106 | SWARMING_VARIANTS_FILE = """\ |
| 4107 | { |
| 4108 | 'swarming-variant': { |
| 4109 | 'identifier': 'swarming', |
| 4110 | 'swarming': { |
| 4111 | 'a': 'b', |
| 4112 | 'dimensions': { |
| 4113 | 'hello': 'world', |
| 4114 | }, |
| 4115 | }, |
| 4116 | }, |
| 4117 | } |
| 4118 | """ |
| 4119 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4120 | MATRIX_COMPOUND_VARIANTS_REF = """\ |
| 4121 | { |
| 4122 | 'basic_suites': { |
| 4123 | 'foo_tests': { |
| 4124 | 'swarming_test': {}, |
| 4125 | } |
| 4126 | }, |
| 4127 | 'matrix_compound_suites': { |
| 4128 | 'matrix_tests': { |
| 4129 | 'foo_tests': { |
| 4130 | 'variants': [ |
| 4131 | 'a_variant' |
| 4132 | ], |
| 4133 | }, |
| 4134 | }, |
| 4135 | }, |
| 4136 | } |
| 4137 | """ |
| 4138 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4139 | MATRIX_COMPOUND_VARIANTS_REF_WITH_DESCRIPTION = """\ |
| 4140 | { |
| 4141 | 'basic_suites': { |
| 4142 | 'foo_tests': { |
| 4143 | 'swarming_test': { |
| 4144 | 'description': 'This is a swarming test.' |
| 4145 | }, |
| 4146 | } |
| 4147 | }, |
| 4148 | 'matrix_compound_suites': { |
| 4149 | 'matrix_tests': { |
| 4150 | 'foo_tests': { |
| 4151 | 'variants': [ |
| 4152 | 'a_variant' |
| 4153 | ], |
| 4154 | }, |
| 4155 | }, |
| 4156 | }, |
| 4157 | } |
| 4158 | """ |
| 4159 | |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4160 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY = """\ |
| 4161 | { |
| 4162 | 'basic_suites': { |
| 4163 | 'foo_tests': { |
| 4164 | 'swarming_test': { |
| 4165 | 'test': 'foo_test_apk' |
| 4166 | }, |
| 4167 | } |
| 4168 | }, |
| 4169 | 'matrix_compound_suites': { |
| 4170 | 'matrix_tests': { |
| 4171 | 'foo_tests': { |
| 4172 | 'variants': [ |
| 4173 | 'a_variant', |
| 4174 | ], |
| 4175 | }, |
| 4176 | }, |
| 4177 | }, |
| 4178 | } |
| 4179 | """ |
| 4180 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4181 | MATRIX_COMPOUND_MIXED_VARIANTS_REF = """\ |
| 4182 | { |
| 4183 | 'basic_suites': { |
| 4184 | 'foo_tests': { |
| 4185 | 'swarming_test': {}, |
| 4186 | } |
| 4187 | }, |
| 4188 | 'matrix_compound_suites': { |
| 4189 | 'matrix_tests': { |
| 4190 | 'foo_tests': { |
| 4191 | 'variants': [ |
| 4192 | 'a_variant', |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4193 | 'b_variant', |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4194 | ], |
| 4195 | }, |
| 4196 | }, |
| 4197 | }, |
| 4198 | } |
| 4199 | """ |
| 4200 | |
| 4201 | VARIANTS_FILE = """\ |
| 4202 | { |
| 4203 | 'a_variant': { |
| 4204 | 'args': [ |
| 4205 | '--platform', |
| 4206 | 'device', |
| 4207 | '--version', |
| 4208 | '1' |
| 4209 | ], |
| 4210 | 'identifier': 'a_variant' |
| 4211 | } |
| 4212 | } |
| 4213 | """ |
| 4214 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4215 | VARIANTS_FILE_WITH_DESCRIPTION = """\ |
| 4216 | { |
| 4217 | 'a_variant': { |
| 4218 | 'identifier': 'a_variant', |
| 4219 | 'description': 'Variant description.' |
| 4220 | } |
| 4221 | } |
| 4222 | """ |
| 4223 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4224 | MULTI_VARIANTS_FILE = """\ |
| 4225 | { |
| 4226 | 'a_variant': { |
| 4227 | 'args': [ |
| 4228 | '--platform', |
| 4229 | 'device', |
| 4230 | '--version', |
| 4231 | '1' |
| 4232 | ], |
| 4233 | 'identifier': 'a_variant' |
| 4234 | }, |
| 4235 | 'b_variant': { |
| 4236 | 'args': [ |
| 4237 | '--platform', |
| 4238 | 'sim', |
| 4239 | '--version', |
| 4240 | '2' |
| 4241 | ], |
| 4242 | 'identifier': 'b_variant' |
| 4243 | } |
| 4244 | } |
| 4245 | """ |
| 4246 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4247 | # # Dictionary composition test suite outputs |
| 4248 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4249 | EMPTY_SKYLAB_TEST_EXCEPTIONS = """\ |
| 4250 | { |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4251 | 'tast.foo OCTOPUS_TOT': { |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4252 | 'remove_from': [ |
| 4253 | 'Fake Tester', |
| 4254 | ] |
| 4255 | }, |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4256 | 'tast.foo OCTOPUS_TOT-1': { |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4257 | 'remove_from': [ |
| 4258 | 'Fake Tester', |
| 4259 | ] |
| 4260 | } |
| 4261 | } |
| 4262 | """ |
| 4263 | |
| 4264 | MATRIX_SKYLAB_WATERFALL = """\ |
| 4265 | [ |
| 4266 | { |
| 4267 | 'project': 'chromium', |
| 4268 | 'bucket': 'ci', |
| 4269 | 'name': 'chromium.test', |
| 4270 | 'machines': { |
| 4271 | 'Fake Tester': { |
| 4272 | 'test_suites': { |
| 4273 | 'skylab_tests': 'cros_skylab_basic_x86', |
| 4274 | }, |
| 4275 | }, |
| 4276 | }, |
| 4277 | }, |
| 4278 | ] |
| 4279 | """ |
| 4280 | |
| 4281 | MATRIX_COMPOUND_SKYLAB_REF = """\ |
| 4282 | { |
| 4283 | 'basic_suites': { |
| 4284 | 'cros_skylab_basic': { |
| 4285 | 'tast.basic': { |
| 4286 | 'suite': 'tast.basic', |
| 4287 | 'timeout': 3600, |
| 4288 | }, |
| 4289 | 'tast.foo': { |
| 4290 | 'suite': 'tast.foo', |
| 4291 | 'timeout': 3600, |
| 4292 | }, |
| 4293 | }, |
| 4294 | }, |
| 4295 | 'compound_suites': {}, |
| 4296 | 'matrix_compound_suites': { |
| 4297 | 'cros_skylab_basic_x86': { |
| 4298 | 'cros_skylab_basic': { |
| 4299 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4300 | 'octopus-89', |
| 4301 | 'octopus-88', |
| 4302 | ], |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4303 | }, |
| 4304 | }, |
| 4305 | }, |
| 4306 | } |
| 4307 | """ |
| 4308 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4309 | SKYLAB_VARIANTS = """\ |
| 4310 | { |
| 4311 | 'octopus-89': { |
| 4312 | 'skylab': { |
| 4313 | 'cros_board': 'octopus', |
| 4314 | 'cros_chrome_version': '89.0.3234.0', |
| 4315 | 'cros_img': 'octopus-release/R89-13655.0.0', |
| 4316 | }, |
| 4317 | 'enabled': True, |
| 4318 | 'identifier': 'OCTOPUS_TOT', |
| 4319 | }, |
| 4320 | 'octopus-88': { |
| 4321 | 'skylab': { |
| 4322 | 'cros_board': 'octopus', |
| 4323 | 'cros_chrome_version': '88.0.2324.0', |
| 4324 | 'cros_img': 'octopus-release/R88-13597.23.0', |
| 4325 | }, |
| 4326 | 'enabled': True, |
| 4327 | 'identifier': 'OCTOPUS_TOT-1', |
| 4328 | }, |
| 4329 | } |
| 4330 | """ |
| 4331 | |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4332 | ENABLED_AND_DISABLED_MATRIX_COMPOUND_SKYLAB_REF = """\ |
| 4333 | { |
| 4334 | 'basic_suites': { |
| 4335 | 'cros_skylab_basic': { |
| 4336 | 'tast.basic': { |
| 4337 | 'suite': 'tast.basic', |
| 4338 | 'timeout': 3600, |
| 4339 | }, |
| 4340 | 'tast.foo': { |
| 4341 | 'suite': 'tast.foo', |
| 4342 | 'timeout': 3600, |
| 4343 | }, |
| 4344 | }, |
| 4345 | }, |
| 4346 | 'compound_suites': {}, |
| 4347 | 'matrix_compound_suites': { |
| 4348 | 'cros_skylab_basic_x86': { |
| 4349 | 'cros_skylab_basic': { |
| 4350 | 'variants': [ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4351 | 'enabled', |
| 4352 | 'disabled', |
| 4353 | ], |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4354 | }, |
| 4355 | }, |
| 4356 | }, |
| 4357 | } |
| 4358 | """ |
| 4359 | |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4360 | ENABLED_AND_DISABLED_VARIANTS = """\ |
| 4361 | { |
| 4362 | 'enabled': { |
| 4363 | 'skylab': { |
| 4364 | 'cros_board': 'octopus', |
| 4365 | 'cros_chrome_version': '89.0.3234.0', |
| 4366 | 'cros_img': 'octopus-release/R89-13655.0.0', |
| 4367 | }, |
| 4368 | 'enabled': True, |
| 4369 | 'identifier': 'OCTOPUS_TOT', |
| 4370 | }, |
| 4371 | 'disabled': { |
| 4372 | 'skylab': { |
| 4373 | 'cros_board': 'octopus', |
| 4374 | 'cros_chrome_version': '88.0.2324.0', |
| 4375 | 'cros_img': 'octopus-release/R88-13597.23.0', |
| 4376 | }, |
| 4377 | 'enabled': False, |
| 4378 | 'identifier': 'OCTOPUS_TOT-1', |
| 4379 | }, |
| 4380 | } |
| 4381 | """ |
| 4382 | |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4383 | |
| 4384 | class MatrixCompositionTests(TestCase): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4385 | |
| 4386 | def test_good_structure_no_configs(self): |
| 4387 | """ |
| 4388 | Tests matrix compound test suite structure with no configs, |
| 4389 | no conflicts and no bad references |
| 4390 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4391 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4392 | MATRIX_COMPOUND_EMPTY, LUCI_MILO_CFG) |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4393 | fbb.check_output_file_consistency(verbose=True) |
| 4394 | self.assertFalse(fbb.printed_lines) |
| 4395 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4396 | def test_good_structure_with_description(self): |
| 4397 | """ |
| 4398 | Tests matrix compound test suite structure with description. |
| 4399 | """ |
| 4400 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4401 | MATRIX_COMPOUND_EMPTY_WITH_DESCRIPTION, LUCI_MILO_CFG) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4402 | fbb.check_output_file_consistency(verbose=True) |
| 4403 | self.assertFalse(fbb.printed_lines) |
| 4404 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4405 | def test_missing_identifier(self): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4406 | """ |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4407 | Variant is missing an identifier |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4408 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4409 | fbb = FakeBBGen(self.args, |
| 4410 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4411 | MATRIX_COMPOUND_MISSING_IDENTIFIER, |
| 4412 | LUCI_MILO_CFG, |
| 4413 | variants=VARIANTS_FILE_MISSING_IDENTIFIER) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4414 | with self.assertRaisesRegex( |
| 4415 | generate_buildbot_json.BBGenErr, |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4416 | 'Missing required identifier field in matrix compound suite*'): |
| 4417 | fbb.check_output_file_consistency(verbose=True) |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4418 | |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4419 | def test_empty_identifier(self): |
| 4420 | """ |
| 4421 | Variant identifier is empty. |
| 4422 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4423 | fbb = FakeBBGen(self.args, |
| 4424 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4425 | MATRIX_COMPOUND_EMPTY_IDENTIFIER, |
| 4426 | LUCI_MILO_CFG, |
| 4427 | variants=EMPTY_IDENTIFIER_VARIANTS) |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4428 | with self.assertRaisesRegex( |
| 4429 | generate_buildbot_json.BBGenErr, |
| 4430 | 'Identifier field can not be "" in matrix compound suite*'): |
| 4431 | fbb.check_output_file_consistency(verbose=True) |
| 4432 | |
| 4433 | def test_trailing_identifier(self): |
| 4434 | """ |
| 4435 | Variant identifier has trailing whitespace. |
| 4436 | """ |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4437 | fbb = FakeBBGen(self.args, |
| 4438 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4439 | MATRIX_COMPOUND_TRAILING_IDENTIFIER, |
| 4440 | LUCI_MILO_CFG, |
| 4441 | variants=TRAILING_WHITESPACE_VARIANTS) |
Sven Zheng | ef0d087 | 2022-04-04 22:13:29 | [diff] [blame] | 4442 | with self.assertRaisesRegex( |
| 4443 | generate_buildbot_json.BBGenErr, |
| 4444 | 'Identifier field can not have leading and trailing whitespace in' |
| 4445 | ' matrix compound suite*'): |
| 4446 | fbb.check_output_file_consistency(verbose=True) |
| 4447 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4448 | def test_noexistent_ref(self): |
| 4449 | """ |
| 4450 | Test referencing a non-existent basic test suite |
| 4451 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4452 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4453 | MATRIX_REF_NONEXISTENT, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4454 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4455 | 'Unable to find reference to *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4456 | fbb.check_output_file_consistency(verbose=True) |
| 4457 | |
| 4458 | def test_ref_to_composition(self): |
| 4459 | """ |
| 4460 | Test referencing another composition test suite |
| 4461 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4462 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4463 | MATRIX_COMPOUND_REF_COMPOSITION, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4464 | with self.assertRaisesRegex( |
| 4465 | generate_buildbot_json.BBGenErr, |
| 4466 | 'matrix_compound_suites may not refer to other *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4467 | fbb.check_output_file_consistency(verbose=True) |
| 4468 | |
| 4469 | def test_ref_to_matrix(self): |
| 4470 | """ |
| 4471 | Test referencing another matrix test suite |
| 4472 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4473 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4474 | MATRIX_COMPOSITION_REF_MATRIX, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4475 | with self.assertRaisesRegex( |
| 4476 | generate_buildbot_json.BBGenErr, |
| 4477 | 'matrix_compound_suites may not refer to other *'): |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4478 | fbb.check_output_file_consistency(verbose=True) |
| 4479 | |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4480 | def test_conflicting_names(self): |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4481 | fbb = FakeBBGen(self.args, |
| 4482 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4483 | MATRIX_COMPOUND_CONFLICTING_TEST_SUITES, |
| 4484 | LUCI_MILO_CFG, |
| 4485 | variants=VARIANTS_FILE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4486 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4487 | 'Conflicting test definitions.*'): |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4488 | fbb.check_input_file_consistency(verbose=True) |
| 4489 | self.assertFalse(fbb.printed_lines) |
| 4490 | |
| 4491 | def test_variants_swarming_dict_merge_args(self): |
| 4492 | """ |
| 4493 | Test targets with swarming dictionary defined by both basic and matrix |
| 4494 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4495 | fbb = FakeBBGen(self.args, |
| 4496 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4497 | MATRIX_COMPOUND_TARGETS_ARGS, |
| 4498 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4499 | mixins=SWARMING_MIXINS, |
| 4500 | variants=ARGS_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4501 | fbb.check_output_file_consistency(verbose=True) |
| 4502 | self.assertFalse(fbb.printed_lines) |
| 4503 | |
| 4504 | def test_variants_swarming_dict_merge_mixins(self): |
| 4505 | """ |
| 4506 | Test targets with swarming dictionary defined by both basic and matrix |
| 4507 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4508 | fbb = FakeBBGen(self.args, |
| 4509 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4510 | MATRIX_COMPOUND_TARGETS_MIXINS, |
| 4511 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4512 | mixins=SWARMING_MIXINS, |
| 4513 | variants=MIXINS_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4514 | fbb.check_output_file_consistency(verbose=True) |
| 4515 | self.assertFalse(fbb.printed_lines) |
| 4516 | |
| 4517 | def test_variants_swarming_dict_swarming(self): |
| 4518 | """ |
| 4519 | Test targets with swarming dictionary defined by both basic and matrix |
| 4520 | """ |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4521 | fbb = FakeBBGen(self.args, |
| 4522 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4523 | MATRIX_COMPOUND_TARGETS_SWARMING, |
| 4524 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4525 | variants=SWARMING_VARIANTS_FILE) |
Jeff Yoon | 67c3e83 | 2020-02-08 07:39:38 | [diff] [blame] | 4526 | fbb.check_output_file_consistency(verbose=True) |
| 4527 | self.assertFalse(fbb.printed_lines) |
| 4528 | |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4529 | def test_variant_test_suite_with_test_key(self): |
| 4530 | """ |
| 4531 | Test targets in matrix compound test suites with variants |
| 4532 | """ |
| 4533 | fbb = FakeBBGen(self.args, |
| 4534 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4535 | MATRIX_COMPOUND_TEST_WITH_TEST_KEY, |
| 4536 | LUCI_MILO_CFG, |
| 4537 | variants=VARIANTS_FILE) |
Rakib M. Hasan | c9e01c6 | 2020-07-27 22:48:12 | [diff] [blame] | 4538 | fbb.check_output_file_consistency(verbose=True) |
| 4539 | self.assertFalse(fbb.printed_lines) |
| 4540 | |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4541 | def test_variants_with_description(self): |
| 4542 | """Test variants with description field""" |
| 4543 | fbb = FakeBBGen(self.args, |
| 4544 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4545 | MATRIX_COMPOUND_VARIANTS_REF, |
| 4546 | LUCI_MILO_CFG, |
| 4547 | variants=VARIANTS_FILE_WITH_DESCRIPTION) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4548 | fbb.check_output_file_consistency(verbose=True) |
| 4549 | self.assertFalse(fbb.printed_lines) |
| 4550 | |
| 4551 | def test_both_test_suite_and_variants_with_description(self): |
| 4552 | """Test both test suite and variants with description field""" |
| 4553 | fbb = FakeBBGen(self.args, |
| 4554 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4555 | MATRIX_COMPOUND_VARIANTS_REF_WITH_DESCRIPTION, |
| 4556 | LUCI_MILO_CFG, |
| 4557 | variants=VARIANTS_FILE_WITH_DESCRIPTION) |
Sven Zheng | b51bd048 | 2022-08-26 18:26:25 | [diff] [blame] | 4558 | fbb.check_output_file_consistency(verbose=True) |
| 4559 | self.assertFalse(fbb.printed_lines) |
| 4560 | |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4561 | def test_variants_pyl_ref(self): |
| 4562 | """Test targets with variants string ref""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4563 | fbb = FakeBBGen(self.args, |
| 4564 | MATRIX_GTEST_SUITE_WATERFALL, |
| 4565 | MATRIX_COMPOUND_VARIANTS_REF, |
| 4566 | LUCI_MILO_CFG, |
| 4567 | variants=VARIANTS_FILE) |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4568 | fbb.check_output_file_consistency(verbose=True) |
| 4569 | self.assertFalse(fbb.printed_lines) |
| 4570 | |
| 4571 | def test_variants_pyl_no_ref(self): |
| 4572 | """Test targets with variants string ref, not defined in variants.pyl""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4573 | fbb = FakeBBGen(self.args, MATRIX_GTEST_SUITE_WATERFALL, |
| 4574 | MATRIX_COMPOUND_VARIANTS_REF, LUCI_MILO_CFG) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4575 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4576 | 'Missing variant definition for *'): |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4577 | fbb.check_output_file_consistency(verbose=True) |
| 4578 | |
| 4579 | def test_variants_pyl_all_unreferenced(self): |
| 4580 | """Test targets with variants in variants.pyl, unreferenced in tests""" |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4581 | fbb = FakeBBGen(self.args, |
| 4582 | MATRIX_GTEST_SUITE_WATERFALL, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4583 | MATRIX_COMPOUND_VARIANTS_REF, |
Garrett Beaty | 1afaccc | 2020-06-25 19:58:15 | [diff] [blame] | 4584 | LUCI_MILO_CFG, |
| 4585 | variants=MULTI_VARIANTS_FILE) |
Jamie Madill | cf4f8c7 | 2021-05-20 19:24:23 | [diff] [blame] | 4586 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4587 | 'The following variants were unreferenced *'): |
Jeff Yoon | da581c3 | 2020-03-06 03:56:05 | [diff] [blame] | 4588 | fbb.check_input_file_consistency(verbose=True) |
| 4589 | |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4590 | def test_good_skylab_matrix_with_variants(self): |
| 4591 | fbb = FakeBBGen(self.args, |
| 4592 | MATRIX_SKYLAB_WATERFALL, |
| 4593 | MATRIX_COMPOUND_SKYLAB_REF, |
| 4594 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4595 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4596 | variants=SKYLAB_VARIANTS) |
Xinan Lin | 05fb9c175 | 2020-12-17 00:15:52 | [diff] [blame] | 4597 | fbb.check_input_file_consistency(verbose=True) |
| 4598 | fbb.check_output_file_consistency(verbose=True) |
| 4599 | self.assertFalse(fbb.printed_lines) |
| 4600 | |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4601 | def test_enabled_and_disabled_skylab_matrix_with_variants(self): |
| 4602 | """Test with disabled variants""" |
| 4603 | fbb = FakeBBGen(self.args, |
| 4604 | MATRIX_SKYLAB_WATERFALL, |
| 4605 | ENABLED_AND_DISABLED_MATRIX_COMPOUND_SKYLAB_REF, |
| 4606 | LUCI_MILO_CFG, |
Garrett Beaty | 2022db4 | 2023-08-29 17:22:40 | [diff] [blame] | 4607 | exceptions=EMPTY_SKYLAB_TEST_EXCEPTIONS, |
| 4608 | variants=ENABLED_AND_DISABLED_VARIANTS) |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4609 | # some skylab test variant is disabled; the corresponding skylab tests |
| 4610 | # is not generated. |
Jieting Yang | ef6b104 | 2021-11-30 21:33:48 | [diff] [blame] | 4611 | fbb.check_input_file_consistency(verbose=True) |
| 4612 | fbb.check_output_file_consistency(verbose=True) |
| 4613 | self.assertFalse(fbb.printed_lines) |
| 4614 | |
Jeff Yoon | 8154e58 | 2019-12-03 23:30:01 | [diff] [blame] | 4615 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4616 | MAC_TEST_SUITE = """\ |
| 4617 | { |
| 4618 | 'basic_suites': { |
| 4619 | 'foo_tests': { |
| 4620 | 'foo_test': { |
| 4621 | }, |
| 4622 | }, |
| 4623 | }, |
| 4624 | } |
| 4625 | """ |
| 4626 | |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4627 | NO_DIMENSIONS_GTESTS_WATERFALL = """\ |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4628 | [ |
| 4629 | { |
| 4630 | 'project': 'chromium', |
| 4631 | 'bucket': 'ci', |
| 4632 | 'name': 'chromium.test', |
| 4633 | 'machines': { |
| 4634 | 'Mac': { |
Garrett Beaty | bb18d53 | 2023-06-26 22:16:33 | [diff] [blame] | 4635 | 'swarming': {}, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4636 | 'test_suites': { |
| 4637 | 'gtest_tests': 'foo_tests', |
| 4638 | }, |
| 4639 | }, |
| 4640 | }, |
| 4641 | }, |
| 4642 | ] |
| 4643 | """ |
| 4644 | |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4645 | NO_OS_GTESTS_WATERFALL = """\ |
| 4646 | [ |
| 4647 | { |
| 4648 | 'project': 'chromium', |
| 4649 | 'bucket': 'ci', |
| 4650 | 'name': 'chromium.test', |
| 4651 | 'machines': { |
| 4652 | 'Mac': { |
| 4653 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4654 | 'dimensions': { |
| 4655 | 'foo': 'bar', |
| 4656 | }, |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4657 | }, |
| 4658 | 'test_suites': { |
| 4659 | 'gtest_tests': 'foo_tests', |
| 4660 | }, |
| 4661 | }, |
| 4662 | }, |
| 4663 | }, |
| 4664 | ] |
| 4665 | """ |
| 4666 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4667 | MAC_ISOLATED_SCRIPTS_WATERFALL = """\ |
| 4668 | [ |
| 4669 | { |
| 4670 | 'project': 'chromium', |
| 4671 | 'bucket': 'ci', |
| 4672 | 'name': 'chromium.test', |
| 4673 | 'machines': { |
| 4674 | 'Mac': { |
| 4675 | 'swarming': { |
Garrett Beaty | ade673d | 2023-08-04 22:00:25 | [diff] [blame] | 4676 | 'dimensions': { |
| 4677 | 'os': 'Mac', |
| 4678 | }, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4679 | }, |
| 4680 | 'test_suites': { |
| 4681 | 'isolated_scripts': 'foo_tests', |
| 4682 | }, |
| 4683 | }, |
| 4684 | }, |
| 4685 | }, |
| 4686 | ] |
| 4687 | """ |
| 4688 | |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4689 | MAC_LUCI_MILO_CFG = """\ |
| 4690 | consoles { |
| 4691 | builders { |
| 4692 | name: "buildbucket/luci.chromium.ci/Mac" |
| 4693 | } |
| 4694 | } |
| 4695 | """ |
| 4696 | |
| 4697 | |
| 4698 | class SwarmingTests(TestCase): |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4699 | def test_builder_with_no_dimension_fails(self): |
| 4700 | fbb = FakeBBGen(self.args, NO_DIMENSIONS_GTESTS_WATERFALL, MAC_TEST_SUITE, |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4701 | MAC_LUCI_MILO_CFG) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4702 | fbb.check_input_file_consistency(verbose=True) |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4703 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4704 | 'os must be specified for all swarmed tests'): |
| 4705 | fbb.check_output_file_consistency(verbose=True) |
Ben Pastene | 338f56b | 2023-03-31 21:24:45 | [diff] [blame] | 4706 | self.assertFalse(fbb.printed_lines) |
| 4707 | |
| 4708 | def test_builder_with_no_os_dimension_fails(self): |
| 4709 | fbb = FakeBBGen(self.args, NO_OS_GTESTS_WATERFALL, MAC_TEST_SUITE, |
| 4710 | MAC_LUCI_MILO_CFG) |
| 4711 | fbb.check_input_file_consistency(verbose=True) |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4712 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4713 | 'os must be specified for all swarmed tests'): |
| 4714 | fbb.check_output_file_consistency(verbose=True) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4715 | self.assertFalse(fbb.printed_lines) |
| 4716 | |
| 4717 | def test_mac_builder_with_no_cpu_dimension_in_isolated_script_fails(self): |
| 4718 | fbb = FakeBBGen(self.args, MAC_ISOLATED_SCRIPTS_WATERFALL, MAC_TEST_SUITE, |
| 4719 | MAC_LUCI_MILO_CFG) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4720 | fbb.check_input_file_consistency(verbose=True) |
Garrett Beaty | 992342df | 2023-06-23 17:38:01 | [diff] [blame] | 4721 | with self.assertRaisesRegex(generate_buildbot_json.BBGenErr, |
| 4722 | 'cpu must be specified for mac'): |
| 4723 | fbb.check_output_file_consistency(verbose=True) |
Dirk Pranke | 772f55f | 2021-04-28 04:51:16 | [diff] [blame] | 4724 | self.assertFalse(fbb.printed_lines) |
| 4725 | |
| 4726 | |
Kenneth Russell | eb60cbd2 | 2017-12-05 07:54:28 | [diff] [blame] | 4727 | if __name__ == '__main__': |
| 4728 | unittest.main() |