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
/
misc.py
1844 lines (1714 loc) · 83.6 KB
/
misc.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
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
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from urlparse import urljoin
try:
import json
except:
import simplejson as json
import collections
import random
import re
from twisted.python import log
from buildbot.scheduler import Nightly, Scheduler
from buildbot.status.tinderbox import TinderboxMailNotifier
from buildbot.steps.shell import WithProperties
import buildbotcustom.changes.hgpoller
import buildbotcustom.process.factory
import buildbotcustom.log
import buildbotcustom.l10n
import buildbotcustom.scheduler
import buildbotcustom.status.mail
import buildbotcustom.status.generators
reload(buildbotcustom.changes.hgpoller)
reload(buildbotcustom.process.factory)
reload(buildbotcustom.log)
reload(buildbotcustom.l10n)
reload(buildbotcustom.scheduler)
reload(buildbotcustom.status.mail)
reload(buildbotcustom.status.generators)
from buildbotcustom.changes.hgpoller import HgPoller, HgAllLocalesPoller
from buildbotcustom.process.factory import NightlyBuildFactory, \
NightlyRepackFactory, UnittestBuildFactory, CodeCoverageFactory, \
UnittestPackagedBuildFactory, TalosFactory, CCNightlyBuildFactory, \
CCNightlyRepackFactory, CCUnittestBuildFactory, TryBuildFactory, \
TryUnittestBuildFactory
from buildbotcustom.scheduler import MozScheduler, NoMergeScheduler, \
MultiScheduler, NoMergeMultiScheduler
from buildbotcustom.l10n import NightlyL10n
from buildbotcustom.status.mail import MercurialEmailLookup
from buildbot.status.mail import MailNotifier
from buildbotcustom.status.generators import buildTryCompleteMessage
# This file contains misc. helper function that don't make sense to put in
# other files. For example, functions that are called in a master.cfg
def get_l10n_repositories(file, l10nRepoPath, relbranch):
"""Reads in a list of locale names and revisions for their associated
repository from 'file'.
"""
if not l10nRepoPath.endswith('/'):
l10nRepoPath = l10nRepoPath + '/'
repositories = {}
for localeLine in open(file).readlines():
locale, revision = localeLine.rstrip().split()
if revision == 'FIXME':
raise Exception('Found FIXME in %s for locale "%s"' % \
(file, locale))
locale = urljoin(l10nRepoPath, locale)
repositories[locale] = {
'revision': revision,
'relbranchOverride': relbranch,
'bumpFiles': []
}
return repositories
def get_locales_from_json(jsonFile, l10nRepoPath, relbranch):
if not l10nRepoPath.endswith('/'):
l10nRepoPath = l10nRepoPath + '/'
l10nRepositories = {}
platformLocales = collections.defaultdict(dict)
file = open(jsonFile)
localesJson = json.load(file)
for locale in localesJson.keys():
revision = localesJson[locale]['revision']
if revision == 'FIXME':
raise Exception('Found FIXME in %s for locale "%s"' % \
(jsonFile, locale))
localeUrl = urljoin(l10nRepoPath, locale)
l10nRepositories[localeUrl] = {
'revision': revision,
'relbranchOverride': relbranch,
'bumpFiles': []
}
for platform in localesJson[locale]['platforms']:
platformLocales[platform][locale] = localesJson[locale]['platforms']
return (l10nRepositories, platformLocales)
# This function is used as fileIsImportant parameter for Buildbots that do both
# dep/nightlies and release builds. Because they build the same "branch" this
# allows us to have the release builder ignore HgPoller triggered changse
# and the dep builders only obey HgPoller/Force Build triggered ones.
def isHgPollerTriggered(change, hgUrl):
if change.comments.find(hgUrl) > -1:
return True
return False
def generateTestBuilderNames(name_prefix, suites_name, suites):
test_builders = []
if isinstance(suites, dict) and "totalChunks" in suites:
totalChunks = suites['totalChunks']
for i in range(totalChunks):
test_builders.append('%s %s-%i/%i' % \
(name_prefix, suites_name, i+1, totalChunks))
else:
test_builders.append('%s %s' % (name_prefix, suites_name))
return test_builders
fastRegexes = []
def _partitionSlaves(slaves):
"""Partitions the list of slaves into 'fast' and 'slow' slaves, according to
fastRegexes.
Returns two lists, 'fast' and 'slow'."""
fast = []
slow = []
for s in slaves:
name = s.slave.slavename
for e in fastRegexes:
if re.search(e, name):
fast.append(s)
break
else:
slow.append(s)
return fast, slow
def _getLastTimeOnBuilder(builder, slavename):
# New builds are at the end of the buildCache, so
# examine it backwards
for build in reversed(builder.builder_status.buildCache):
if build.slavename == slavename:
return build.finished
return None
def _recentSort(builder):
def sortfunc(s1, s2):
t1 = _getLastTimeOnBuilder(builder, s1.slave.slavename)
t2 = _getLastTimeOnBuilder(builder, s2.slave.slavename)
return cmp(t1, t2)
return sortfunc
def _nextSlowSlave(builder, available_slaves):
try:
fast, slow = _partitionSlaves(available_slaves)
# Choose the slow slave that was most recently on this builder
# If there aren't any slow slaves, choose the slow slave that was most
# recently on this builder
if slow:
return sorted(slow, _recentSort(builder))[-1]
elif fast:
return sorted(fast, _recentSort(builder))[-1]
else:
log.msg("No fast or slow slaves found for builder '%s', choosing randomly instead" % builder.name)
return random.choice(available_slaves)
except:
log.msg("Error choosing next slow slave for builder '%s', choosing randomly instead" % builder.name)
log.err()
return random.choice(available_slaves)
def _nextFastSlave(builder, available_slaves):
try:
fast, slow = _partitionSlaves(available_slaves)
# Choose the fast slave that was most recently on this builder
# If there aren't any fast slaves, choose the slow slave that was most
# recently on this builder
if fast:
return sorted(fast, _recentSort(builder))[-1]
elif slow:
return sorted(slow, _recentSort(builder))[-1]
else:
log.msg("No fast or slow slaves found for builder '%s', choosing randomly instead" % builder.name)
return random.choice(available_slaves)
except:
log.msg("Error choosing next fast slave for builder '%s', choosing randomly instead" % builder.name)
log.err()
return random.choice(available_slaves)
def generateTestBuilder(config, branch_name, platform, name_prefix, build_dir_prefix,
suites_name, suites, mochitestLeakThreshold, crashtestLeakThreshold, slaves=None):
builders = []
pf = config['platforms'].get(platform, {})
if slaves == None:
slavenames = config['platforms'][platform]['slaves']
else:
slavenames = slaves
if isinstance(suites, dict) and "totalChunks" in suites:
totalChunks = suites['totalChunks']
for i in range(totalChunks):
factory = UnittestPackagedBuildFactory(
platform=platform,
test_suites=[suites['suite']],
mochitest_leak_threshold=mochitestLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=1.0,
buildsBeforeReboot=config['platforms'][platform]['builds_before_reboot'],
totalChunks=totalChunks,
thisChunk=i+1,
chunkByDir=suites.get('chunkByDir'),
env=pf.get('unittest-env', {}),
downloadSymbols=pf.get('download_symbols', True),
)
builder = {
'name': '%s %s-%i/%i' % (name_prefix, suites_name, i+1, totalChunks),
'slavenames': slavenames,
'builddir': '%s-%s-%i' % (build_dir_prefix, suites_name, i+1),
'factory': factory,
'category': branch_name,
'nextSlave': _nextSlowSlave,
}
builders.append(builder)
else:
factory = UnittestPackagedBuildFactory(
platform=platform,
test_suites=suites,
mochitest_leak_threshold=mochitestLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=1.0,
buildsBeforeReboot=config['platforms'][platform]['builds_before_reboot'],
downloadSymbols=pf.get('download_symbols', True),
env=pf.get('unittest-env', {}),
)
builder = {
'name': '%s %s' % (name_prefix, suites_name),
'slavenames': slavenames,
'builddir': '%s-%s' % (build_dir_prefix, suites_name),
'factory': factory,
'category': branch_name,
}
builders.append(builder)
return builders
def generateCCTestBuilder(config, branch_name, platform, name_prefix, build_dir_prefix,
suites_name, suites, mochitestLeakThreshold, mochichromeLeakThreshold,
mochibrowserLeakThreshold, crashtestLeakThreshold):
builders = []
pf = config['platforms'].get(platform, {})
if isinstance(suites, dict) and "totalChunks" in suites:
totalChunks = suites['totalChunks']
for i in range(totalChunks):
factory = UnittestPackagedBuildFactory(
platform=platform,
test_suites=[suites['suite']],
mochitest_leak_threshold=mochitestLeakThreshold,
#mochichrome_leak_threshold=mochichromeLeakThreshold,
#mochibrowser_leak_threshold=mochibrowserLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
productName=config['product_name'],
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=1.0,
buildsBeforeReboot=config['platforms'][platform]['builds_before_reboot'],
totalChunks=totalChunks,
thisChunk=i+1,
chunkByDir=suites.get('chunkByDir'),
env=pf.get('unittest-env', {}),
downloadSymbols=pf.get('download_symbols', True),
)
builder = {
'name': '%s %s-%i/%i' % (name_prefix, suites_name, i+1, totalChunks),
'slavenames': config['platforms'][platform]['slaves'],
'builddir': '%s-%s-%i' % (build_dir_prefix, suites_name, i+1),
'factory': factory,
'category': branch_name,
}
builders.append(builder)
else:
factory = UnittestPackagedBuildFactory(
platform=platform,
test_suites=suites,
mochitest_leak_threshold=mochitestLeakThreshold,
#mochichrome_leak_threshold=mochichromeLeakThreshold,
#mochibrowser_leak_threshold=mochibrowserLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
productName=config['product_name'],
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=1.0,
buildsBeforeReboot=config['platforms'][platform]['builds_before_reboot'],
downloadSymbols=pf.get('download_symbols', True),
)
builder = {
'name': '%s %s' % (name_prefix, suites_name),
'slavenames': config['platforms'][platform]['slaves'],
'builddir': '%s-%s' % (build_dir_prefix, suites_name),
'factory': factory,
'category': branch_name,
}
builders.append(builder)
return builders
def generateBranchObjects(config, name):
"""name is the name of branch which is usually the last part of the path
to the repository. For example, 'mozilla-central', 'tracemonkey', or
'mozilla-1.9.1'.
config is a dictionary containing all of the necessary configuration
information for a branch. The required keys depends greatly on what's
enabled for a branch (unittests, xulrunner, l10n, etc). The best way
to figure out what you need to pass is by looking at existing configs
and using 'buildbot checkconfig' to verify.
"""
# We return this at the end
branchObjects = {
'builders': [],
'change_source': [],
'schedulers': [],
'status': []
}
builders = []
unittestBuilders = []
triggeredUnittestBuilders = []
nightlyBuilders = []
xulrunnerNightlyBuilders = []
debugBuilders = []
weeklyBuilders = []
# These dicts provides mapping between en-US dep and nightly scheduler names
# to l10n dep and l10n nightly scheduler names. It's filled out just below here.
l10nBuilders = {}
l10nNightlyBuilders = {}
# generate a list of builders, nightly builders (names must be different)
# for easy access
for platform in config['platforms'].keys():
pf = config['platforms'][platform]
base_name = pf['base_name']
if platform.endswith("-debug"):
debugBuilders.append('%s build' % base_name)
# Debug unittests
if pf.get('enable_unittests'):
test_builders = []
base_name = config['platforms'][platform.replace("-debug", "")]['base_name']
for suites_name, suites in config['unittest_suites']:
test_builders.extend(generateTestBuilderNames('%s debug test' % base_name, suites_name, suites))
triggeredUnittestBuilders.append(('%s-%s-unittest' % (name, platform), test_builders, True))
# Skip l10n, unit tests and nightlies for debug builds
continue
else:
builders.append('%s build' % base_name)
#Fill the l10n dep dict
if config['enable_l10n'] and platform in config['l10n_platforms'] and \
config['enable_l10n_onchange']:
l10nBuilders[base_name] = {}
l10nBuilders[base_name]['tree'] = config['l10n_tree']
l10nBuilders[base_name]['l10n_builder'] = \
'%s %s %s l10n dep' % (config['product_name'].capitalize(),
name, platform)
l10nBuilders[base_name]['platform'] = platform
# Check if branch wants nightly builds
if config['enable_nightly']:
builder = '%s nightly' % base_name
nightlyBuilders.append(builder)
# Fill the l10nNightly dict
if config['enable_l10n'] and platform in config['l10n_platforms']:
l10nNightlyBuilders[builder] = {}
l10nNightlyBuilders[builder]['tree'] = config['l10n_tree']
l10nNightlyBuilders[builder]['l10n_builder'] = \
'%s %s %s l10n nightly' % (config['product_name'].capitalize(),
name, platform)
l10nNightlyBuilders[builder]['platform'] = platform
if config['enable_shark'] and platform.startswith('macosx'):
nightlyBuilders.append('%s shark' % base_name)
# Regular unittest builds
if pf.get('enable_unittests'):
unittestBuilders.append('%s unit test' % base_name)
test_builders = []
for suites_name, suites in config['unittest_suites']:
test_builders.extend(generateTestBuilderNames('%s test' % base_name, suites_name, suites))
triggeredUnittestBuilders.append(('%s-%s-unittest' % (name, platform), test_builders, True))
# Optimized unittest builds
if pf.get('enable_opt_unittests'):
test_builders = []
for suites_name, suites in config['unittest_suites']:
test_builders.extend(generateTestBuilderNames('%s opt test' % base_name, suites_name, suites))
triggeredUnittestBuilders.append(('%s-%s-opt-unittest' % (name, platform), test_builders, True))
if config['enable_codecoverage'] and platform in ('linux',):
weeklyBuilders.append('%s code coverage' % base_name)
if config['enable_xulrunner'] and platform not in ('wince',):
xulrunnerNightlyBuilders.append('%s xulrunner' % base_name)
# Currently, each branch goes to a different tree
# If this changes in the future this may have to be
# moved out of the loop
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="mozilla2.buildbot@build.mozilla.org",
tree=config['tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
builders=builders + nightlyBuilders,
logCompression="bzip2"
))
# XULRunner builds
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="mozilla2.buildbot@build.mozilla.org",
tree=config['xulrunner_tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
builders=xulrunnerNightlyBuilders,
logCompression="bzip2"
))
# Separate notifier for unittests, since they need to be run through
# the unittest errorparser
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="mozilla2.buildbot@build.mozilla.org",
tree=config['tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
builders=unittestBuilders + debugBuilders,
logCompression="bzip2",
errorparser="unittest"
))
# Weekly builds (currently only code coverage) go to a different tree
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="mozilla2.buildbot@build.mozilla.org",
tree=config['weekly_tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
builders=weeklyBuilders,
logCompression="bzip2",
errorparser="unittest"
))
# Try Server notifier
if config.get('enable_mail_notifier'):
packageUrl = config['package_url']
packageDir = config['package_dir']
notify_builders = builders + unittestBuilders + debugBuilders
for scheduler_branch, test_builders, merge in triggeredUnittestBuilders:
notify_builders.extend(test_builders)
branchObjects['status'].append(MailNotifier(
fromaddr="tryserver@build.mozilla.org",
mode="all",
sendToInterestedUsers=True,
lookup=MercurialEmailLookup(),
customMesg=lambda attrs: buildTryCompleteMessage(attrs,
'/'.join([packageUrl, packageDir]), config['tinderbox_url']),
subject="Try Server: %(result)s on %(builder)s",
relayhost="mail.build.mozilla.org",
builders=notify_builders,
extraHeaders={"In-Reply-To":WithProperties('<tryserver-%(got_revision:-unknown)s>'),
"References": WithProperties('<tryserver-%(got_revision:-unknown)s>')}
))
if config['enable_l10n']:
l10n_builders = []
for b in l10nBuilders:
if config['enable_l10n_onchange']:
l10n_builders.append(l10nBuilders[b]['l10n_builder'])
l10n_builders.append(l10nNightlyBuilders['%s nightly' % b]['l10n_builder'])
l10n_binaryURL = config['enUS_binaryURL']
if l10n_binaryURL.endswith('/'):
l10n_binaryURL = l10n_binaryURL[:-1]
l10n_binaryURL += "-l10n"
# This notifies all l10n related build objects to Mozilla-l10n
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="bootstrap@mozilla.com",
tree=config['l10n_tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
logCompression="bzip2",
builders=l10n_builders,
binaryURL=l10n_binaryURL
))
# We only want the builds from the specified builders
# since their builds have a build property called "locale"
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="bootstrap@mozilla.com",
tree=WithProperties(config['l10n_tinderbox_tree'] + "-%(locale)s"),
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
logCompression="bzip2",
builders=l10n_builders,
binaryURL=l10n_binaryURL
))
# change sources
branchObjects['change_source'].append(HgPoller(
hgURL=config['hgurl'],
branch=config['repo_path'],
pushlogUrlOverride='%s/%s/pushlog' % (config['hgurl'],
config['repo_path']),
pollInterval=1*60
))
if config['enable_l10n'] and config['enable_l10n_onchange']:
hg_all_locales_poller = HgAllLocalesPoller(hgURL = config['hgurl'],
repositoryIndex = config['l10n_repo_path'],
pollInterval = 15*60)
hg_all_locales_poller.parallelRequests = 1
branchObjects['change_source'].append(hg_all_locales_poller)
# schedulers
# this one gets triggered by the HG Poller
extra_args = {}
if config.get('enable_merging', True):
schedulerClass = MozScheduler
extra_args['idleTimeout'] = config.get('idle_timeout', None)
else:
schedulerClass = NoMergeScheduler
branchObjects['schedulers'].append(schedulerClass(
name=name,
branch=config['repo_path'],
treeStableTimer=3*60,
builderNames=builders + unittestBuilders + debugBuilders,
fileIsImportant=lambda c: isHgPollerTriggered(c, config['hgurl']),
**extra_args
))
for scheduler_branch, test_builders, merge in triggeredUnittestBuilders:
scheduler_name = scheduler_branch
if not merge:
branchObjects['schedulers'].append(NoMergeScheduler(name=scheduler_name, branch=scheduler_branch, builderNames=test_builders, treeStableTimer=0))
else:
branchObjects['schedulers'].append(Scheduler(name=scheduler_name, branch=scheduler_branch, builderNames=test_builders, treeStableTimer=0))
branchObjects['status'].append(TinderboxMailNotifier(
fromaddr="mozilla2.buildbot@build.mozilla.org",
tree=config['packaged_unittest_tinderbox_tree'],
extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org"],
relayhost="mail.build.mozilla.org",
builders=test_builders,
logCompression="bzip2",
errorparser="unittest"
))
# Now, setup the nightly en-US schedulers and maybe,
# their downstream l10n ones
for builder in nightlyBuilders + xulrunnerNightlyBuilders:
nightly_scheduler=Nightly(
name=builder,
branch=config['repo_path'],
# bug 482123 - keep the minute to avoid problems with DST changes
hour=config['start_hour'], minute=config['start_minute'],
builderNames=[builder]
)
branchObjects['schedulers'].append(nightly_scheduler)
if config['enable_l10n'] and config['enable_nightly'] and builder in l10nNightlyBuilders:
l10n_builder = l10nNightlyBuilders[builder]['l10n_builder']
platform = l10nNightlyBuilders[builder]['platform']
tree = l10nNightlyBuilders[builder]['tree']
branchObjects['schedulers'].append(NightlyL10n(
name=l10n_builder,
platform=platform,
tree=tree,
builderNames=[l10n_builder],
repoType='hg',
branch=config['repo_path'],
baseTag='default',
localesFile=config['allLocalesFile']
))
for builder in weeklyBuilders:
weekly_scheduler=Nightly(
name=builder,
branch=config['repo_path'],
dayOfWeek=5, # Saturday
hour=[3], minute=[02],
builderNames=[builder],
)
branchObjects['schedulers'].append(weekly_scheduler)
for platform in sorted(config['platforms'].keys()):
# shorthand
pf = config['platforms'][platform]
leakTest = False
codesighs = True
uploadPackages = True
uploadSymbols = False
packageTests = False
talosMasters = pf['talos_masters']
unittestBranch = "%s-%s-opt-unittest" % (name, platform)
tinderboxBuildsDir = None
if platform.find('-debug') > -1:
leakTest = True
codesighs = False
if not pf.get('enable_unittests'):
uploadPackages = pf.get('packageTests', False)
else:
packageTests = True
talosMasters = None
# Platform already has the -debug suffix
unittestBranch = "%s-%s-unittest" % (name, platform)
tinderboxBuildsDir = "%s-%s" % (name, platform)
elif pf.get('enable_opt_unittests'):
packageTests = True
# Allow for test packages on platforms that can't be tested
# on the same master.
packageTests = pf.get('packageTests', packageTests)
if platform.find('win') > -1:
codesighs = False
if 'upload_symbols' in pf and pf['upload_symbols']:
uploadSymbols = True
buildSpace = pf.get('build_space', config['default_build_space'])
clobberTime = pf.get('clobber_time', config['default_clobber_time'])
mochitestLeakThreshold = pf.get('mochitest_leak_threshold', None)
crashtestLeakThreshold = pf.get('crashtest_leak_threshold', None)
checkTest = pf.get('enable_checktests', False)
valgrindCheck = pf.get('enable_valgrind_checktests', False)
extra_args = {}
if config.get('enable_try'):
factory_class = TryBuildFactory
extra_args['packageUrl'] = config['package_url']
extra_args['packageDir'] = config['package_dir']
else:
factory_class = NightlyBuildFactory
mozilla2_dep_factory = factory_class(env=pf['env'],
objdir=pf['platform_objdir'],
platform=platform,
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
configRepoPath=config['config_repo_path'],
configSubDir=config['config_subdir'],
profiledBuild=pf['profiled_build'],
productName=config['product_name'],
mozconfig=pf['mozconfig'],
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageGroup=config['stage_group'],
stageSshKey=config['stage_ssh_key'],
stageBasePath=config['stage_base_path'],
graphServer=config['graph_server'],
graphSelector=config['graph_selector'],
graphBranch=config['tinderbox_tree'],
baseName=pf['base_name'],
leakTest=leakTest,
checkTest=checkTest,
valgrindCheck=valgrindCheck,
codesighs=codesighs,
uploadPackages=uploadPackages,
uploadSymbols=False,
buildSpace=buildSpace,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
buildsBeforeReboot=pf['builds_before_reboot'],
talosMasters=talosMasters,
packageTests=packageTests,
unittestMasters=config['unittest_masters'],
unittestBranch=unittestBranch,
tinderboxBuildsDir=tinderboxBuildsDir,
enable_ccache=pf.get('enable_ccache', False),
**extra_args
)
mozilla2_dep_builder = {
'name': '%s build' % pf['base_name'],
'slavenames': pf['slaves'],
'builddir': '%s-%s' % (name, platform),
'factory': mozilla2_dep_factory,
'category': name,
'nextSlave': _nextFastSlave,
}
branchObjects['builders'].append(mozilla2_dep_builder)
# skip nightlies for debug builds
if platform.find('debug') > -1:
if pf.get('enable_unittests'):
for suites_name, suites in config['unittest_suites']:
if "macosx" in platform and 'mochitest-a11y' in suites:
suites = suites[:]
suites.remove('mochitest-a11y')
base_name = config['platforms'][platform.replace("-debug", "")]['base_name']
branchObjects['builders'].extend(generateTestBuilder(
config, name, platform, "%s debug test" % base_name,
"%s-%s-unittest" % (name, platform),
suites_name, suites, mochitestLeakThreshold,
crashtestLeakThreshold))
continue
if config['enable_nightly']:
nightly_builder = '%s nightly' % pf['base_name']
triggeredSchedulers=None
if config['enable_l10n'] and platform in config['l10n_platforms'] and \
nightly_builder in l10nNightlyBuilders:
triggeredSchedulers=[l10nNightlyBuilders[nightly_builder]['l10n_builder']]
mozilla2_nightly_factory = NightlyBuildFactory(
env=pf['env'],
objdir=pf['platform_objdir'],
platform=platform,
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
configRepoPath=config['config_repo_path'],
configSubDir=config['config_subdir'],
profiledBuild=pf['profiled_build'],
productName=config['product_name'],
mozconfig=pf['mozconfig'],
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageGroup=config['stage_group'],
stageSshKey=config['stage_ssh_key'],
stageBasePath=config['stage_base_path'],
codesighs=False,
uploadPackages=uploadPackages,
uploadSymbols=uploadSymbols,
nightly=True,
createSnippet=config['create_snippet'],
createPartial=config['create_partial'],
ausBaseUploadDir=config['aus2_base_upload_dir'],
updatePlatform=pf['update_platform'],
downloadBaseURL=config['download_base_url'],
ausUser=config['aus2_user'],
ausSshKey=config['aus2_ssh_key'],
ausHost=config['aus2_host'],
hashType=config['hash_type'],
buildSpace=buildSpace,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
buildsBeforeReboot=pf['builds_before_reboot'],
talosMasters=talosMasters,
packageTests=packageTests,
unittestMasters=config['unittest_masters'],
unittestBranch=unittestBranch,
geriatricMasters=config['geriatric_masters'],
geriatricBranches=config['geriatric_branches'],
triggerBuilds=config['enable_l10n'],
triggeredSchedulers=triggeredSchedulers,
tinderboxBuildsDir=tinderboxBuildsDir,
enable_ccache=pf.get('enable_ccache', False),
)
mozilla2_nightly_builder = {
'name': nightly_builder,
'slavenames': pf['slaves'],
'builddir': '%s-%s-nightly' % (name, platform),
'factory': mozilla2_nightly_factory,
'category': name,
'nextSlave': _nextFastSlave,
}
branchObjects['builders'].append(mozilla2_nightly_builder)
if config['enable_l10n']:
if platform in config['l10n_platforms']:
# TODO Linux and mac are not working with mozconfig at this point
# and this will disable it for now. We will fix this in bug 518359.
if platform is 'wince':
env = pf['env']
objdir = pf['platform_objdir']
mozconfig = pf['mozconfig']
else:
env = {}
objdir = ''
mozconfig = None
mozilla2_l10n_nightly_factory = NightlyRepackFactory(
env=env,
objdir=objdir,
platform=platform,
hgHost=config['hghost'],
tree=config['l10n_tree'],
project=config['product_name'],
appName=config['app_name'],
enUSBinaryURL=config['enUS_binaryURL'],
nightly=True,
configRepoPath=config['config_repo_path'],
configSubDir=config['config_subdir'],
mozconfig=mozconfig,
l10nNightlyUpdate=config['l10nNightlyUpdate'],
l10nDatedDirs=config['l10nDatedDirs'],
createPartial=config['create_partial_l10n'],
ausBaseUploadDir=config['aus2_base_upload_dir_l10n'],
updatePlatform=pf['update_platform'],
downloadBaseURL=config['download_base_url'],
ausUser=config['aus2_user'],
ausSshKey=config['aus2_ssh_key'],
ausHost=config['aus2_host'],
hashType=config['hash_type'],
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageSshKey=config['stage_ssh_key'],
repoPath=config['repo_path'],
l10nRepoPath=config['l10n_repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
compareLocalesRepoPath=config['compare_locales_repo_path'],
compareLocalesTag=config['compare_locales_tag'],
buildSpace=2,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
)
mozilla2_l10n_nightly_builder = {
'name': l10nNightlyBuilders[nightly_builder]['l10n_builder'],
'slavenames': config['l10n_slaves'][platform],
'builddir': '%s-%s-l10n-nightly' % (name, platform),
'factory': mozilla2_l10n_nightly_factory,
'category': name,
'nextSlave': _nextSlowSlave,
}
branchObjects['builders'].append(mozilla2_l10n_nightly_builder)
# We still want l10n_dep builds if nightlies are off
if config['enable_l10n'] and platform in config['l10n_platforms'] and \
config['enable_l10n_onchange']:
mozilla2_l10n_dep_factory = NightlyRepackFactory(
hgHost=config['hghost'],
tree=config['l10n_tree'],
project=config['product_name'],
appName=config['app_name'],
enUSBinaryURL=config['enUS_binaryURL'],
nightly=False,
l10nDatedDirs=config['l10nDatedDirs'],
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageSshKey=config['stage_ssh_key'],
repoPath=config['repo_path'],
l10nRepoPath=config['l10n_repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
compareLocalesRepoPath=config['compare_locales_repo_path'],
compareLocalesTag=config['compare_locales_tag'],
buildSpace=2,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
)
mozilla2_l10n_dep_builder = {
'name': l10nBuilders[pf['base_name']]['l10n_builder'],
'slavenames': config['l10n_slaves'][platform],
'builddir': '%s-%s-l10n-dep' % (name, platform),
'factory': mozilla2_l10n_dep_factory,
'category': name,
'nextSlave': _nextSlowSlave,
}
branchObjects['builders'].append(mozilla2_l10n_dep_builder)
if pf.get('enable_unittests'):
runA11y = True
if platform.startswith('macosx'):
runA11y = config['enable_mac_a11y']
extra_args = {}
if config.get('enable_try'):
factory_class = TryUnittestBuildFactory
extra_args['branchName'] = name
else:
factory_class = UnittestBuildFactory
unittest_factory = factory_class(
env=pf.get('unittest-env', {}),
platform=platform,
productName=config['product_name'],
config_repo_path=config['config_repo_path'],
config_dir=config['config_subdir'],
objdir=config['objdir_unittests'],
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=config['unittest_build_space'],
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
buildsBeforeReboot=pf['builds_before_reboot'],
run_a11y=runA11y,
mochitest_leak_threshold=mochitestLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageSshKey=config['stage_ssh_key'],
unittestMasters=config['unittest_masters'],
unittestBranch="%s-%s-unittest" % (name, platform),
uploadPackages=True,
**extra_args
)
unittest_builder = {
'name': '%s unit test' % pf['base_name'],
'slavenames': pf['slaves'],
'builddir': '%s-%s-unittest' % (name, platform),
'factory': unittest_factory,
'category': name,
'nextSlave': _nextFastSlave,
}
branchObjects['builders'].append(unittest_builder)
for suites_name, suites in config['unittest_suites']:
runA11y = True
if platform.startswith('macosx'):
runA11y = config['enable_mac_a11y']
# For the regular unittest build, run the a11y suite if
# enable_mac_a11y is set on mac
if not runA11y and 'mochitest-a11y' in suites:
suites = suites[:]
suites.remove('mochitest-a11y')
if pf.get('enable_unittests'):
branchObjects['builders'].extend(generateTestBuilder(
config, name, platform, "%s test" % pf['base_name'],
"%s-%s-unittest" % (name, platform),
suites_name, suites, mochitestLeakThreshold,
crashtestLeakThreshold))
# Remove mochitest-a11y from other types of builds, since they're not
# built with a11y enabled
if platform.startswith("macosx") and 'mochitest-a11y' in suites:
# Create a new factory that doesn't have mochitest-a11y
suites = suites[:]
suites.remove('mochitest-a11y')
if pf.get('enable_opt_unittests'):
branchObjects['builders'].extend(generateTestBuilder(
config, name, platform, "%s opt test" % pf['base_name'],
"%s-%s-opt-unittest" % (name, platform),
suites_name, suites, mochitestLeakThreshold,
crashtestLeakThreshold))
if config['enable_codecoverage']:
# We only do code coverage builds on linux right now
if platform == 'linux':
codecoverage_factory = CodeCoverageFactory(
platform=platform,
productName=config['product_name'],
config_repo_path=config['config_repo_path'],
config_dir=config['config_subdir'],
objdir=config['objdir_unittests'],
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
buildSpace=5,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
buildsBeforeReboot=pf['builds_before_reboot'],
mochitest_leak_threshold=mochitestLeakThreshold,
crashtest_leak_threshold=crashtestLeakThreshold,
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageSshKey=config['stage_ssh_key'],
)
codecoverage_builder = {
'name': '%s code coverage' % pf['base_name'],
'slavenames': pf['slaves'],
'builddir': '%s-%s-codecoverage' % (name, platform),
'factory': codecoverage_factory,
'category': name,
'nextSlave': _nextSlowSlave,
}
branchObjects['builders'].append(codecoverage_builder)
if config['enable_shark'] and platform.startswith('macosx'):
mozilla2_shark_factory = NightlyBuildFactory(
env= pf['env'],
objdir=config['objdir'],
platform=platform,
hgHost=config['hghost'],
repoPath=config['repo_path'],
buildToolsRepoPath=config['build_tools_repo_path'],
configRepoPath=config['config_repo_path'],
configSubDir=config['config_subdir'],
profiledBuild=False,
productName=config['product_name'],
mozconfig='macosx/%s/shark' % name,
stageServer=config['stage_server'],
stageUsername=config['stage_username'],
stageGroup=config['stage_group'],
stageSshKey=config['stage_ssh_key'],
stageBasePath=config['stage_base_path'],
codesighs=False,
uploadPackages=uploadPackages,
uploadSymbols=False,
nightly=True,
createSnippet=False,
buildSpace=buildSpace,
clobberURL=config['base_clobber_url'],
clobberTime=clobberTime,
buildsBeforeReboot=pf['builds_before_reboot']
)
mozilla2_shark_builder = {
'name': '%s shark' % pf['base_name'],
'slavenames': pf['slaves'],
'builddir': '%s-%s-shark' % (name, platform),
'factory': mozilla2_shark_factory,
'category': name,
'nextSlave': _nextSlowSlave,
}
branchObjects['builders'].append(mozilla2_shark_builder)
if config['enable_xulrunner'] and platform not in ('wince',):
xr_env = pf['env'].copy()
xr_env['SYMBOL_SERVER_USER'] = config['stage_username_xulrunner']