1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
from unittest import mock
import mozunit
import pytest
from tryselect.selectors.perf import (
Apps,
InvalidCategoryException,
PerfParser,
Platforms,
Suites,
Variants,
check_for_live_sites,
check_for_profile,
run,
)
TASKS = [
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-animometer",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-optimizing",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-webaudio",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-speedometer",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-jetstream2",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-ares6",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-optimizing",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-sunspider",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-matrix-react-bench",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-baseline",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-twitch-animation",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-assorted-dom",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-stylebench",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-baseline",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-htmlsuite",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-unity-webgl",
"test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot",
]
# The TEST_VARIANTS, and TEST_CATEGORIES are used to force
# a particular set of categories to show up in testing. Otherwise,
# every time someone adds a category, or a variant, we'll need
# to redo all the category counts. The platforms, and apps are
# not forced because they change infrequently.
TEST_VARIANTS = {
Variants.NO_FISSION.value: {
"query": "'nofis",
"negation": "!nofis",
"platforms": [Platforms.ANDROID.value],
"apps": [Apps.FENIX.value, Apps.GECKOVIEW.value],
},
Variants.BYTECODE_CACHED.value: {
"query": "'bytecode",
"negation": "!bytecode",
"platforms": [Platforms.DESKTOP.value],
"apps": [Apps.FIREFOX.value],
},
Variants.LIVE_SITES.value: {
"query": "'live",
"negation": "!live",
"restriction": check_for_live_sites,
"platforms": [Platforms.DESKTOP.value, Platforms.ANDROID.value],
"apps": list(PerfParser.apps.keys()),
},
Variants.PROFILING.value: {
"query": "'profil",
"negation": "!profil",
"restriction": check_for_profile,
"platforms": [Platforms.DESKTOP.value, Platforms.ANDROID.value],
"apps": [Apps.FIREFOX.value, Apps.GECKOVIEW.value, Apps.FENIX.value],
},
Variants.SWR.value: {
"query": "'swr",
"negation": "!swr",
"platforms": [Platforms.DESKTOP.value],
"apps": [Apps.FIREFOX.value],
},
}
TEST_CATEGORIES = {
"Pageload": {
"query": {
Suites.RAPTOR.value: ["'browsertime 'tp6"],
},
"suites": [Suites.RAPTOR.value],
"tasks": [],
},
"Pageload (essential)": {
"query": {
Suites.RAPTOR.value: ["'browsertime 'tp6 'essential"],
},
"variant-restrictions": {Suites.RAPTOR.value: [Variants.NO_FISSION.value]},
"suites": [Suites.RAPTOR.value],
"tasks": [],
},
"Responsiveness": {
"query": {
Suites.RAPTOR.value: ["'browsertime 'responsive"],
},
"suites": [Suites.RAPTOR.value],
"variant-restrictions": {Suites.RAPTOR.value: []},
"tasks": [],
},
"Benchmarks": {
"query": {
Suites.RAPTOR.value: ["'browsertime 'benchmark"],
},
"suites": [Suites.RAPTOR.value],
"variant-restrictions": {Suites.RAPTOR.value: []},
"tasks": [],
},
"DAMP (Devtools)": {
"query": {
Suites.TALOS.value: ["'talos 'damp"],
},
"suites": [Suites.TALOS.value],
"tasks": [],
},
"Talos PerfTests": {
"query": {
Suites.TALOS.value: ["'talos"],
},
"suites": [Suites.TALOS.value],
"tasks": [],
},
"Resource Usage": {
"query": {
Suites.TALOS.value: ["'talos 'xperf | 'tp5"],
Suites.RAPTOR.value: ["'power 'osx"],
Suites.AWSY.value: ["'awsy"],
},
"suites": [Suites.TALOS.value, Suites.RAPTOR.value, Suites.AWSY.value],
"platform-restrictions": [Platforms.DESKTOP.value],
"variant-restrictions": {
Suites.RAPTOR.value: [],
Suites.TALOS.value: [],
},
"app-restrictions": {
Suites.RAPTOR.value: [Apps.FIREFOX.value],
Suites.TALOS.value: [Apps.FIREFOX.value],
},
"tasks": [],
},
"Graphics, & Media Playback": {
"query": {
# XXX This might not be an exhaustive list for talos atm
Suites.TALOS.value: ["'talos 'svgr | 'bcv | 'webgl"],
Suites.RAPTOR.value: ["'browsertime 'youtube-playback"],
},
"suites": [Suites.TALOS.value, Suites.RAPTOR.value],
"variant-restrictions": {Suites.RAPTOR.value: [Variants.NO_FISSION.value]},
"tasks": [],
},
}
@pytest.mark.parametrize(
"category_options, expected_counts, unique_categories, missing",
[
# Default should show the premade live category, but no chrome or android
# The benchmark desktop category should be visible in all configurations
# except for when there are requested apps/variants/platforms
(
{},
58,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!live",
"!profil",
"!chrom",
"!safari",
]
},
"Pageload macosx": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"!bytecode",
"!live",
"!profil",
"!chrom",
"!safari",
]
},
"Resource Usage desktop": {
"awsy": ["'awsy", "!android 'shippable !-32 !clang"],
"raptor": [
"'power 'osx",
"!android 'shippable !-32 !clang",
"!bytecode",
"!live",
"!profil",
"!chrom",
"!safari",
],
"talos": [
"'talos 'xperf | 'tp5",
"!android 'shippable !-32 !clang",
"!profil",
"!swr",
],
},
},
[
"Responsiveness android-p2 geckoview",
"Benchmarks desktop chromium",
],
), # Default settings
(
{"live_sites": True},
66,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!profil",
"!chrom",
"!safari",
]
},
"Pageload macosx": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"!bytecode",
"!profil",
"!chrom",
"!safari",
]
},
"Pageload macosx live-sites": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"'live",
"!bytecode",
"!profil",
"!chrom",
"!safari",
],
},
},
[
"Responsiveness android-p2 geckoview",
"Benchmarks desktop chromium",
"Benchmarks desktop firefox profiling",
"Talos desktop live-sites",
"Talos desktop profiling+swr",
"Benchmarks desktop firefox live-sites+profiling"
"Benchmarks desktop firefox live-sites",
],
),
(
{"live_sites": True, "safari": True},
72,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!profil",
"!chrom",
]
},
"Pageload macosx safari": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"'safari",
"!bytecode",
"!profil",
]
},
"Pageload macosx safari live-sites": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"'safari",
"'live",
"!bytecode",
"!profil",
],
},
},
[
"Pageload linux safari",
"Pageload desktop safari",
],
),
(
{"live_sites": True, "chrome": True},
114,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!profil",
"!safari",
]
},
"Pageload macosx live-sites": {
"raptor": [
"'browsertime 'tp6",
"'osx 'shippable",
"'live",
"!bytecode",
"!profil",
"!safari",
],
},
"Benchmarks desktop chromium": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"'chromium",
"!bytecode",
"!profil",
],
},
},
[
"Responsiveness android-p2 geckoview",
"Firefox Pageload linux chrome",
"Talos PerfTests desktop swr",
],
),
(
{"android": True},
88,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!live",
"!profil",
"!chrom",
"!safari",
],
},
"Responsiveness android-a51 geckoview": {
"raptor": [
"'browsertime 'responsive",
"'android 'a51 'shippable 'aarch64",
"'geckoview",
"!nofis",
"!live",
"!profil",
],
},
},
[
"Responsiveness android-a51 chrome-m",
"Firefox Pageload android",
],
),
(
{"android": True, "chrome": True},
138,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!live",
"!profil",
"!safari",
],
},
"Responsiveness android-a51 chrome-m": {
"raptor": [
"'browsertime 'responsive",
"'android 'a51 'shippable 'aarch64",
"'chrome-m",
"!nofis",
"!live",
"!profil",
],
},
},
["Responsiveness android-p2 chrome-m", "Resource Usage android"],
),
(
{"android": True, "chrome": True, "profile": True},
176,
{
"Benchmarks desktop": {
"raptor": [
"'browsertime 'benchmark",
"!android 'shippable !-32 !clang",
"!bytecode",
"!live",
"!safari",
]
},
"Talos PerfTests desktop profiling": {
"talos": [
"'talos",
"!android 'shippable !-32 !clang",
"'profil",
"!swr",
]
},
},
[
"Resource Usage desktop profiling",
"DAMP (Devtools) desktop chrome",
"Resource Usage android",
"Resource Usage windows chromium",
],
),
# Show all available windows tests, no other platform should exist
# including the desktop catgeory
(
{"requested_platforms": ["windows"]},
14,
{
"Benchmarks windows firefox": {
"raptor": [
"'browsertime 'benchmark",
"!-32 'windows 'shippable",
"!chrom !geckoview !fenix !safari",
"!bytecode",
"!live",
"!profil",
]
},
},
[
"Resource Usage desktop",
"Benchmarks desktop",
"Benchmarks linux firefox bytecode-cached+profiling",
],
),
# Can't have fenix on the windows platform
(
{"requested_platforms": ["windows"], "requested_apps": ["fenix"]},
0,
{},
["Benchmarks desktop"],
),
# Android flag also needs to be supplied
(
{"requested_platforms": ["android"], "requested_apps": ["fenix"]},
0,
{},
["Benchmarks desktop"],
),
# There should be no global categories available, only fenix
(
{
"requested_platforms": ["android"],
"requested_apps": ["fenix"],
"android": True,
},
10,
{
"Pageload android fenix": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"!nofis",
"!live",
"!profil",
],
}
},
["Benchmarks desktop", "Pageload (live) android"],
),
# Test with multiple apps
(
{
"requested_platforms": ["android"],
"requested_apps": ["fenix", "geckoview"],
"android": True,
},
15,
{
"Benchmarks android geckoview": {
"raptor": [
"'browsertime 'benchmark",
"'android 'a51 'shippable 'aarch64",
"'geckoview",
"!nofis",
"!live",
"!profil",
],
},
"Pageload android fenix": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"!nofis",
"!live",
"!profil",
],
},
},
[
"Benchmarks desktop",
"Pageload android no-fission",
"Pageload android fenix live-sites",
],
),
# Variants are inclusive, so we'll see the variant alongside the
# base here for fenix
(
{
"requested_variants": ["no-fission"],
"requested_apps": ["fenix"],
"android": True,
},
32,
{
"Pageload android-a51 fenix": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"!live",
"!profil",
],
},
"Pageload android-a51 fenix no-fission": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'nofis",
"!live",
"!profil",
],
},
"Pageload (essential) android fenix no-fission": {
"raptor": [
"'browsertime 'tp6 'essential",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'nofis",
"!live",
"!profil",
],
},
},
[
"Benchmarks desktop",
"Pageload (live) android",
"Pageload android-p2 fenix live-sites",
],
),
# With multiple variants, we'll see the base variant (with no combinations)
# for each of them
(
{
"requested_variants": ["no-fission", "live-sites"],
"requested_apps": ["fenix"],
"android": True,
},
40,
{
"Pageload android-a51 fenix": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"!profil",
],
},
"Pageload android-a51 fenix no-fission": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'nofis",
"!live",
"!profil",
],
},
"Pageload android-a51 fenix live-sites": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'live",
"!nofis",
"!profil",
],
},
"Pageload (essential) android fenix no-fission": {
"raptor": [
"'browsertime 'tp6 'essential",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'nofis",
"!live",
"!profil",
],
},
"Pageload android fenix no-fission+live-sites": {
"raptor": [
"'browsertime 'tp6",
"'android 'a51 'shippable 'aarch64",
"'fenix",
"'nofis",
"'live",
"!profil",
],
},
},
[
"Benchmarks desktop",
"Pageload (live) android",
"Pageload android-p2 fenix live-sites",
"Pageload (essential) android fenix no-fission+live-sites",
],
),
# Make sure that no no-fission tasks are selected when a variant cannot
# run on a requested platform
(
{
"requested_variants": ["no-fission"],
"requested_platforms": ["windows"],
},
14,
{
"Responsiveness windows firefox": {
"raptor": [
"'browsertime 'responsive",
"!-32 'windows 'shippable",
"!chrom !geckoview !fenix !safari",
"!bytecode",
"!live",
"!profil",
],
},
},
["Benchmarks desktop", "Responsiveness windows firefox no-fisson"],
),
# We should only see the base and the live-site variants here for windows
(
{
"requested_variants": ["no-fission", "live-sites"],
"requested_platforms": ["windows"],
"android": True,
},
16,
{
"Responsiveness windows firefox": {
"raptor": [
"'browsertime 'responsive",
"!-32 'windows 'shippable",
"!chrom !geckoview !fenix !safari",
"!bytecode",
"!profil",
],
},
"Pageload windows live-sites": {
"raptor": [
"'browsertime 'tp6",
"!-32 'windows 'shippable",
"'live",
"!bytecode",
"!profil",
"!chrom",
"!safari",
],
},
"Graphics, & Media Playback windows": {
"raptor": [
"'browsertime 'youtube-playback",
"!-32 'windows 'shippable",
"!bytecode",
"!profil",
"!chrom",
"!safari",
],
"talos": [
"'talos 'svgr | 'bcv | 'webgl",
"!-32 'windows 'shippable",
"!profil",
"!swr",
],
},
},
[
"Benchmarks desktop",
"Responsiveness windows firefox no-fisson",
"Pageload (live) android",
"Talos desktop live-sites",
"Talos android",
"Graphics, & Media Playback windows live-sites",
"Graphics, & Media Playback android no-fission",
],
),
],
)
def test_category_expansion(
category_options, expected_counts, unique_categories, missing
):
# Set the categories, and variants to expand
PerfParser.categories = TEST_CATEGORIES
PerfParser.variants = TEST_VARIANTS
# Expand the categories, then either check if the unique_categories,
# exist or are missing from the categories
expanded_cats = PerfParser.get_categories(**category_options)
assert len(expanded_cats) == expected_counts
assert not any([expanded_cats.get(ucat, None) is not None for ucat in missing])
assert all(
[expanded_cats.get(ucat, None) is not None for ucat in unique_categories.keys()]
)
# Ensure that the queries are as expected
for cat_name, cat_query in unique_categories.items():
# Don't use get here because these fields should always exist
assert cat_query == expanded_cats[cat_name]["queries"]
@pytest.mark.parametrize(
"options, call_counts, log_ind, expected_log_message",
[
(
{},
[8, 2, 2, 5],
2,
(
"\n!!!NOTE!!!\n You'll be able to find a performance comparison "
"here once the tests are complete (ensure you select the right framework): "
"https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original"
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"dry_run": True},
[8, 1, 1, 5],
2,
(
"\n!!!NOTE!!!\n You'll be able to find a performance comparison "
"here once the tests are complete (ensure you select the right framework): "
"https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original"
"Revision=&newProject=try&newRevision=revision\n"
),
),
(
{"show_all": True},
[1, 2, 2, 3],
0,
(
"\n!!!NOTE!!!\n You'll be able to find a performance comparison "
"here once the tests are complete (ensure you select the right framework): "
"https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original"
"Revision=revision&newProject=try&newRevision=revision\n"
),
),
(
{"single_run": True},
[8, 1, 1, 4],
2,
(
"If you need any help, you can find us in the #perf-help Matrix channel:\n"
"https://matrix.to/#/#perf-help:mozilla.org\n"
),
),
],
)
@pytest.mark.skipif(os.name == "nt", reason="fzf not installed on host")
def test_full_run(options, call_counts, log_ind, expected_log_message):
with mock.patch("tryselect.selectors.perf.push_to_try") as ptt, mock.patch(
"tryselect.selectors.perf.run_fzf"
) as fzf, mock.patch(
"tryselect.selectors.perf.get_repository_object", new=mock.MagicMock()
), mock.patch(
"tryselect.selectors.perf.LogProcessor.revision",
new_callable=mock.PropertyMock,
return_value="revision",
) as logger, mock.patch(
"tryselect.selectors.perf.print",
) as perf_print:
fzf.side_effect = [
["", ["Benchmarks linux"]],
["", TASKS],
["", TASKS],
["", TASKS],
["", TASKS],
["", TASKS],
["", TASKS],
["", TASKS],
]
run(**options)
assert fzf.call_count == call_counts[0]
assert ptt.call_count == call_counts[1]
assert logger.call_count == call_counts[2]
assert perf_print.call_count == call_counts[3]
assert perf_print.call_args_list[log_ind][0][0] == expected_log_message
@pytest.mark.parametrize(
"query, should_fail",
[
(
{
"query": {
# Raptor has all variants available so it
# should fail on this category
"raptor": ["browsertime 'live 'no-fission"],
}
},
True,
),
(
{
"query": {
# Awsy has no variants defined so it shouldn't fail
# on a query like this
"awsy": ["browsertime 'live 'no-fission"],
}
},
False,
),
],
)
def test_category_rules(query, should_fail):
# Set the categories, and variants to expand
PerfParser.categories = {"test-live": query}
PerfParser.variants = TEST_VARIANTS
if should_fail:
with pytest.raises(InvalidCategoryException):
PerfParser.run_category_checks()
else:
assert PerfParser.run_category_checks()
if __name__ == "__main__":
mozunit.main()
|