This repository has been archived by the owner on Jun 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
test_try_parser.py
643 lines (563 loc) · 30.4 KB
/
test_try_parser.py
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
from buildbotcustom.try_parser import TryParser, processMessage
import unittest
def base_platform(platform):
return platform.replace(' try-nondefault', '')
###### TEST CASES #####
BUILDER_PRETTY_NAMES = {'macosx64': 'OS X 10.6.2 try build',
'macosx64-debug': 'OS X 10.6.2 try leak test build',
'macosx-debug': 'OS X 10.5.2 try leak test build',
'win32': 'WINNT 5.2 try build',
'win32-debug': 'WINNT 5.2 try leak test build',
'win64': 'WINNT 6.1 try try-nondefault build',
'linux64': 'Linux x86-64 try build',
'linux64-debug': 'Linux x86-64 try leak test build',
'linux': 'Linux try build',
'linux-debug': 'Linux try leak test build',
'android-r7': 'Android R7 try build',
'maemo5-gtk': 'Maemo 5 GTK try build',
}
# TODO -- need to check on how to separate out the two win32 prettynames
TESTER_PRETTY_NAMES = {'macosx': ['Rev3 MacOSX Leopard 10.5.8'],
'macosx64': ['Rev3 MacOSX Snow Leopard 10.6.2',
'Rev3 MacOSX Leopard 9.0 try-nondefault'],
'win32': ['Rev3 WINNT 5.1',
'Rev3 WINNT 6.1'],
'linux64': ['Rev3 Fedora 12x64'],
'linux': ['Rev3 Fedora 12'],
}
TESTER_PRETTY_TB_NAMES = {'linux': ['TB Rev3 Fedora 12']}
UNITTEST_PRETTY_NAMES = {'win32-debug': 'WINNT 5.2 try debug test'}
BUILDER_PRETTY_B2G_NAMES = {
'ics_armv7a_gecko': 'b2g_try_ics_armv7a_gecko build',
'ics_armv7a_gecko-debug': 'b2g_try_ics_armv7a_gecko-debug build'}
TALOS_SUITES = ['tp4', 'chrome']
UNITTEST_SUITES = ['reftest',
'crashtest',
'mochitest-1',
'mochitest-3',
'mochitest-browser-chrome',
'mochitest-other']
UNITTEST_SUITES_TB = ['xpcshell', 'mozmill']
MOBILE_UNITTEST_SUITES = ['reftest-1', 'reftest-3'] + UNITTEST_SUITES[1:]
VALID_UPN = ['WINNT 5.2 try debug test mochitest-1',
'WINNT 5.2 try debug test mochitest-3',
'WINNT 5.2 try debug test mochitest-browser-chrome',
'WINNT 5.2 try debug test mochitest-other',
'WINNT 5.2 try debug test reftest',
'WINNT 5.2 try debug test crashtest']
VALID_REFTEST_NAMES = ['WINNT 5.2 try debug test reftest',
'WINNT 5.2 try debug test reftest-1',
'WINNT 5.2 try debug test reftest-3']
VALID_BUILDER_NAMES = [base_platform(b)
for b in BUILDER_PRETTY_NAMES.values()]
VALID_TESTER_NAMES = ['Rev3 Fedora 12 try opt test mochitest-1',
'Rev3 Fedora 12 try opt test mochitest-browser-chrome',
'Rev3 Fedora 12 try opt test mochitest-other',
'Rev3 Fedora 12 try opt test crashtest',
'Rev3 Fedora 12 try debug test mochitest-1',
'Rev3 Fedora 12 try debug test mochitest-browser-chrome',
'Rev3 Fedora 12 try debug test mochitest-other',
'Rev3 WINNT 5.1 try opt test reftest',
'Rev3 WINNT 5.1 try opt test crashtest',
'Rev3 WINNT 6.1 try opt test crashtest',
'Rev3 WINNT 6.1 try debug test crashtest',
'Rev3 WINNT 6.1 try debug test mochitest-browser-chrome',
'Rev3 WINNT 6.1 try debug test mochitest-other',
'Rev3 WINNT 6.1 try debug test mochitest-3',
'Rev3 MacOSX Snow Leopard 10.6.2 try debug test crashtest',
'Rev3 MacOSX Leopard 9.0 try debug test crashtest',
'Rev3 MacOSX Leopard 9.0 try talos tp4',
'Rev3 WINNT 5.1 try talos chrome',
'Rev3 WINNT 6.1 try talos tp4',
'Rev3 WINNT 5.1 try talos tp4',
'Rev3 WINNT 6.1 try talos chrome']
VALID_TESTER_TB_NAMES = ['TB Rev3 Fedora 12 try-comm-central opt test mozmill',
'TB Rev3 Fedora 12 try-comm-central opt test xpcshell']
VALID_BUILDER_B2G_NAMES = ['b2g_try_ics_armv7a_gecko-debug build',
'b2g_try_ics_armv7a_gecko build']
def dictslice(d, keys, default=None):
if hasattr(keys, '__call__'):
return dict([(k, v) for k, v in d.items() if keys(k)])
else:
return dict([(k, d.get(k, default)) for k in keys])
class TestTryParser(unittest.TestCase):
def setUp(self):
builders = self.filterTesters(['win32'])
builders = [t for t in builders if 'crashtest' in t or 'reftest' in t]
self.baselineBuilders = builders
def removeNondefaults(self, builders, pretties):
platform_names = pretties.values()
if isinstance(platform_names[0], list):
platform_names = reduce(lambda a, b: a + b, platform_names)
nondefaults = [base_platform(n)
for n in platform_names
if 'try-nondefault' in n]
nondefault_builders = set(
[b for b in builders for nd in nondefaults if nd in b])
return set(builders) - nondefault_builders
def filterBuilders(self, platforms,
pretties=BUILDER_PRETTY_NAMES,
valid=VALID_BUILDER_NAMES):
chosen = set()
assert isinstance(platforms, list)
for platform in platforms:
arch = pretties[platform]
assert not isinstance(arch, list)
chosen.update([builder for builder in valid if arch in builder])
return list(chosen)
def filterTesters(self, platforms,
pretties=TESTER_PRETTY_NAMES,
valid=VALID_TESTER_NAMES):
chosen = set()
assert isinstance(platforms, list)
for platform in platforms:
slave_platforms = pretties.get(platform, [])
assert isinstance(slave_platforms, list)
for slave_platform in slave_platforms:
base = base_platform(slave_platform)
chosen.update(
[builder for builder in valid if base in builder])
return list(chosen)
def test_BlankMessage(self):
# Should get default set with blank input
tm = ""
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = self.removeNondefaults(
VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_JunkMessageBuilders(self):
# Should get default set with junk input
tm = "try: junk"
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = self.removeNondefaults(
VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_JunkMessageTesters(self):
# Should get default set with junk input to the test masters
tm = "try: junk"
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [b for b in VALID_TESTER_NAMES if 'talos' not in b]
builders = self.removeNondefaults(builders, TESTER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_JunkBuildMessage(self):
# Should get default set with junk input for --build
tm = "try: -b k -p linux"
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = dictslice(
BUILDER_PRETTY_NAMES, ['linux', 'linux-debug']).values()
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_DebugOnlyBuild(self):
tm = "try: -b d -p linux64,linux"
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [BUILDER_PRETTY_NAMES[p] for p in [
'linux64-debug', 'linux-debug']]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_OptOnlyBuild(self):
tm = "try: -b o -p macosx64,linux"
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [BUILDER_PRETTY_NAMES[p] for p in ['macosx64', 'linux']]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_BothBuildTypes(self):
# User can send 'do' or 'od' for both
tm = ['try: -b od -p win32', 'try: -b do -p win32']
for m in tm:
self.customBuilders = TryParser(
m, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [BUILDER_PRETTY_NAMES[p] for p in [
'win32', 'win32-debug']]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_SpecificPlatform(self):
# Testing a specific platform, eg: mac only
# should specify macosx and macosx64 to get opt and debug
tm = 'try: -b od -p macosx64,macosx'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [BUILDER_PRETTY_NAMES[p] for p in ['macosx64',
'macosx64-debug', 'macosx-debug']]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_B2GPlatform(self):
tm = 'try: -b od -p ics_armv7a_gecko'
self.customBuilders = TryParser(
tm, VALID_BUILDER_B2G_NAMES, BUILDER_PRETTY_B2G_NAMES)
builders = self.filterBuilders(
['ics_armv7a_gecko', 'ics_armv7a_gecko-debug'],
pretties=BUILDER_PRETTY_B2G_NAMES,
valid=VALID_BUILDER_B2G_NAMES)
self.assertEquals(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b o -p ics_armv7a_gecko'
self.customBuilders = TryParser(
tm, VALID_BUILDER_B2G_NAMES, BUILDER_PRETTY_B2G_NAMES)
builders = ['b2g_try_ics_armv7a_gecko build']
builders = self.filterBuilders(['ics_armv7a_gecko'],
pretties=BUILDER_PRETTY_B2G_NAMES,
valid=VALID_BUILDER_B2G_NAMES)
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_AllPlatformsBoth(self):
tm = 'try: -b od -p all'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [b for b in BUILDER_PRETTY_NAMES.values(
) if 'nondefault' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_FullPlatformsBoth(self):
tm = 'try: -b od -p full'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = VALID_BUILDER_NAMES
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_FullPlatformsOpt(self):
tm = 'try: -b o -p full'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = dictslice(
BUILDER_PRETTY_NAMES, lambda p: 'debug' not in p).values()
builders = [base_platform(b) for b in builders]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_FullPlatformsDebug(self):
tm = 'try: -b d -p full'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = dictslice(
BUILDER_PRETTY_NAMES, lambda p: 'debug' in p).values()
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllPlatformsBoth(self):
tm = 'try: -b od -p all'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = [b for b in BUILDER_PRETTY_NAMES.values(
) if 'nondefault' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllPlatformsOpt(self):
tm = 'try: -b o -p all'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = dictslice(
BUILDER_PRETTY_NAMES, lambda p: 'debug' not in p).values()
builders = [b for b in builders if 'nondefault' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllPlatformsDebug(self):
tm = 'try: -b d -p all'
self.customBuilders = TryParser(
tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES)
builders = dictslice(
BUILDER_PRETTY_NAMES, lambda p: 'debug' in p).values()
builders = [b for b in builders if 'nondefault' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_NoNondefaultTests(self):
tm = 'try: -b d -p macosx64 -u all'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['macosx64'])
builders = self.removeNondefaults(builders, TESTER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_NondefaultsTest(self):
tm = 'try: -b d -p macosx64 -u all[]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['macosx64'])
builders = [b for b in builders if 'talos' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllOnTestMaster(self):
tm = 'try: -a'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [n for n in VALID_TESTER_NAMES if 'talos' not in n]
builders = self.removeNondefaults(builders, TESTER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllOnTestMasterCC(self):
tm = 'try: -a'
self.customBuilders = TryParser(tm, VALID_TESTER_TB_NAMES, TESTER_PRETTY_TB_NAMES, None, UNITTEST_SUITES_TB, None, "try-comm-central")
builders = VALID_TESTER_TB_NAMES
builders = self.removeNondefaults(builders, TESTER_PRETTY_TB_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_MochitestAliasesOnBuilderMaster(self):
tm = 'try: -b od -p win32 -u mochitests'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, BUILDER_PRETTY_NAMES, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES[p] for p in ['win32', 'win32-debug']]
builders += [t for t in VALID_UPN if 'mochitest' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b od -p win32 -u mochitest-bc'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, BUILDER_PRETTY_NAMES, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES[p] for p in ['win32', 'win32-debug']]
builders += [t for t in VALID_UPN if 'mochitest-browser-chrome' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b od -p win32 -u mochitest-o'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, BUILDER_PRETTY_NAMES, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES[p] for p in ['win32', 'win32-debug']]
builders += [t for t in VALID_UPN if 'mochitest-other' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_MochitestAliasesOnTestMaster(self):
tm = 'try: -b od -p all -u mochitests'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [t for t in VALID_TESTER_NAMES if 'mochitest' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b od -p win32 -u mochitest-bc'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [t for t in self.filterTesters(['win32'])
if 'mochitest-browser-chrome' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b od -p win32 -u mochitest-o'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [t for t in self.filterTesters(['win32'])
if 'mochitest-other' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_MochitestAliasesOnTestMasterDebugOnly(self):
tm = 'try: -b d -p all -u mochitests'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [t for t in VALID_TESTER_NAMES if 'mochitest' in t and 'debug' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_BuildMasterDebugWin32Tests(self):
tm = 'try: -b d -p win32 -u mochitests'
# test in the getBuilders (for local builder_master unittests)
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, {}, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = self.filterBuilders(['win32-debug'],
valid=VALID_BUILDER_NAMES + VALID_UPN,
pretties=UNITTEST_PRETTY_NAMES)
builders = [t for t in builders if 'mochitest' in t and 'debug' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_ReftestAliases(self):
tm = 'try: -b d -p win32 -u reftests'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, {}, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = self.filterBuilders(['win32-debug'],
valid=VALID_BUILDER_NAMES + VALID_UPN,
pretties=UNITTEST_PRETTY_NAMES)
builders = [t for t in builders if 'reftest' in t]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b d -p win32 -u reftest'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, {}, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_ReftestMobileAliases(self):
tm = 'try: -b d -p win32 -u reftests'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_REFTEST_NAMES, {}, UNITTEST_PRETTY_NAMES, MOBILE_UNITTEST_SUITES)
builders = self.filterBuilders(['win32-debug'],
valid=VALID_BUILDER_NAMES +
VALID_REFTEST_NAMES,
pretties=UNITTEST_PRETTY_NAMES)
# MOBILE_UNITTEST_SUITES only has 'reftest-1' and 'reftest-3', not
# 'reftest', and the builder names are constructed through string
# concatenation, so there's no straightforward way to exclude the plain
# 'reftest' element of VALID_REFTEST_NAMES. I'll sidestep the issue for
# now by only accepting the substring 'reftest-'.
builders = [t for t in builders if 'reftest-' in t]
self.assertEquals(sorted(self.customBuilders), sorted(builders))
tm = 'try: -b d -p win32 -u reftest'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_REFTEST_NAMES, {}, UNITTEST_PRETTY_NAMES, MOBILE_UNITTEST_SUITES)
self.assertEquals(sorted(self.customBuilders), sorted(builders))
def test_SelectTests(self):
tm = 'try: -b od -p win32 -u crashtest,mochitest-other'
# test in the getBuilders (for local builder_master unittests)
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, BUILDER_PRETTY_NAMES, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES['win32'],
BUILDER_PRETTY_NAMES['win32-debug']]
testers = self.filterBuilders(['win32-debug'],
valid=VALID_BUILDER_NAMES + VALID_UPN,
pretties=UNITTEST_PRETTY_NAMES)
builders += [
t for t in testers if 'crashtest' in t or 'mochitest-other' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
# test in the getTestBuilders (for local builder_master unittests)
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['win32'])
builders = [
t for t in builders if 'crashtest' in t or 'mochitest-other' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_NoTests(self):
tm = 'try: -b od -p linux,win32 -u none'
# test in getBuilders
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = self.filterBuilders(
['linux', 'linux-debug', 'win32', 'win32-debug'])
self.assertEqual(sorted(self.customBuilders), sorted(builders))
# test in getTestBuilders
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = []
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_AllTalos(self):
# should get all unittests too since that's the default set
tm = 'try: -b od -t all'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES, TALOS_SUITES)
builders = self.removeNondefaults(
VALID_TESTER_NAMES, TESTER_PRETTY_NAMES)
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_SelecTalos(self):
tm = 'try: -b od -p win32 -t tp4'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, None, TALOS_SUITES)
builders = self.filterTesters(['win32'])
builders = [t for t in builders if 'tp4' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_SelecTalosWithNoTalosPlatforms(self):
tm = 'try: -b od -p win32,android-r7 -t tp4'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, None, TALOS_SUITES)
builders = self.filterTesters(['win32', 'android-r7'])
builders = [t for t in builders if 'tp4' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_NoTalos(self):
tm = 'try: -b od -p linux,win32 -t none'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES, TESTER_PRETTY_NAMES, None, None, TALOS_SUITES)
builders = []
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_DebugWin32OnTestMaster(self):
tm = 'try: -b do -p win32 -u crashtest'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['win32'])
builders = [t for t in builders if 'crashtest' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_RestrictionBaseline(self):
# This isn't really a test of anything. It's mostly to make reading the
# following tests easier by giving the full set of possible builds
# without any filtering.
tm = 'try: -b do -p win32 -u crashtest,reftest'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['win32'])
builders = [t for t in builders if 'crashtest' in t or 'reftest' in t]
self.assertEqual(sorted(self.baselineBuilders), sorted(builders))
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_Include5_1(self):
tm = 'try: -b do -p win32 -u crashtest[5.1]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [b for b in self.baselineBuilders if 'crashtest' in b and '5.1' in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_IncludeExclude(self):
tm = 'try: -b do -p win32 -u crashtest[-5.1,debug]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [b for b in self.baselineBuilders
if 'crashtest' in b
and '5.1' not in b
and 'debug' in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_IncludeExcludeEmpty(self):
tm = 'try: -b do -p win32 -u crashtest[-5.1,5.1]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = []
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_IncludeDummyExclude(self):
tm = 'try: -b do -p win32 -u crashtest[5.1,-notfound]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [b for b in self.baselineBuilders
if 'crashtest' in b
and '5.1' in b
and 'notfound' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_Exclude5_1(self):
tm = 'try: -b do -p win32 -u crashtest[-5.1]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [b for b in self.baselineBuilders
if 'crashtest' in b
and '5.1' not in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_MultipleInclusions(self):
tm = 'try: -b do -p win32 -u all[5.1,crash]'
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [
b for b in self.baselineBuilders if '5.1' in b or 'crash' in b]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_HiddenCharactersAndOldSyntax(self):
tm = 'attributes\ntry: -b o -p linux64 -m none -u reftest -t none'
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES['linux64']]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def test_NoBuildTypeSelected(self):
tm = 'try: -m none -u crashtest -p win32'
# should get both build types for the selected platform
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES, BUILDER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = [BUILDER_PRETTY_NAMES['win32'],
BUILDER_PRETTY_NAMES['win32-debug']]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
# should get debug win32 in the builder_master test builders
self.customBuilders = TryParser(tm, VALID_BUILDER_NAMES + VALID_UPN, {}, UNITTEST_PRETTY_NAMES, UNITTEST_SUITES)
builders = self.filterBuilders(['win32-debug'],
pretties=UNITTEST_PRETTY_NAMES,
valid=VALID_BUILDER_NAMES + VALID_UPN)
builders = [t for t in builders if 'crashtest' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
# should get both build types in test_builders
self.customBuilders = TryParser(tm, VALID_TESTER_NAMES, TESTER_PRETTY_NAMES, None, UNITTEST_SUITES)
builders = self.filterTesters(['win32', 'win32-debug'])
builders = [t for t in builders if 'crashtest' in t]
self.assertEqual(sorted(self.customBuilders), sorted(builders))
def _testNewLineProcessMessage(self, message, value=None):
if not value:
value = ['-a', '-b', '-c']
self.assertEqual(processMessage(message), value)
def test_SingleLine(self):
self._testNewLineProcessMessage("""try: -a -b -c""")
def test_SingleLineSpace(self):
self._testNewLineProcessMessage("""try: -a -b -c """)
def test_CommentSingleLine(self):
self._testNewLineProcessMessage("""blah blah try: -a -b -c""")
def test_CommentSingleLineSpace(self):
self._testNewLineProcessMessage("""blah blah try: -a -b -c """)
def test_FirstLineNewLine(self):
self._testNewLineProcessMessage("""try: -a -b -c
some other comment
lines
blah""")
def test_FirstLineSpaceNewLine(self):
self._testNewLineProcessMessage("""try: -a -b -c
some other comment
lines
blah""")
def test_CommentFirstLineNewLine(self):
self._testNewLineProcessMessage("""blah blah try: -a -b -c
some other comment
lines
blah""")
def test_CommentFirstLineSpaceNewLine(self):
self._testNewLineProcessMessage("""blah blah try: -a -b -c
some other comment
lines
blah""")
def test_MiddleLineNewLine(self):
self._testNewLineProcessMessage("""blah blah
try: -a -b -c
some other comment
lines
blah""")
def test_MiddleLineSpaceNewLine(self):
self._testNewLineProcessMessage("""blah blah
try: -a -b -c
some other comment
lines
blah""")
def test_CommentMiddleLineNewLine(self):
self._testNewLineProcessMessage("""blah blah
blah blah try: -a -b -c
some other comment
lines
blah""")
def test_CommentMiddleLineSpaceNewLine(self):
self._testNewLineProcessMessage("""blah blah
blah blah try: -a -b -c
some other comment
lines
blah""")
def test_LastLine(self):
self._testNewLineProcessMessage("""blah blah
some other comment
lines
try: -a -b -c""")
def test_LastLineSpace(self):
self._testNewLineProcessMessage("""blah blah
some other comment
lines
try: -a -b -c """)
def test_CommentLastLine(self):
self._testNewLineProcessMessage("""blah blah
some other comment
lines
blah blah try: -a -b -c""")
def test_CommentLastLineSpace(self):
self._testNewLineProcessMessage("""blah blah
some other comment
lines
blah blah try: -a -b -c """)
def test_DuplicateTryLines(self):
self._testNewLineProcessMessage("""try: -a -b -c
try: -this -should -be -ignored""")
def test_IgnoreTryColonNoSpace(self):
self._testNewLineProcessMessage("""Should ignore this try:
try: -a -b -c""")
if __name__ == '__main__':
unittest.main()