Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Follow-up to bug 786984 Thunderbird's MozMill builders don't obey try…
Browse files Browse the repository at this point in the history
…chooser options - fix try-comm-central's broken unit tests by taking account of the branch name in the trychooser itself. r=rail
  • Loading branch information
Mark Banner committed Sep 5, 2012
1 parent d32c644 commit a038d97
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
6 changes: 6 additions & 0 deletions misc.py
Expand Up @@ -768,6 +768,7 @@ def generateBranchObjects(config, name, secrets=None):
extra_args['chooserFunc'] = tryChooser
extra_args['numberOfBuildsToTrigger'] = 1
extra_args['prettyNames'] = prettyNames
extra_args['buildbotBranch'] = name
else:
scheduler_class = makePropertiesScheduler(Scheduler, [buildIDSchedFunc, buildUIDSchedFunc])

Expand Down Expand Up @@ -821,6 +822,7 @@ def generateBranchObjects(config, name, secrets=None):
extra_args['prettyNames'] = prettyNames
extra_args['unittestSuites'] = unittestSuites
extra_args['unittestPrettyNames'] = unittestPrettyNames
extra_args['buildbotBranch'] = name
else:
scheduler_class = Scheduler
branchObjects['schedulers'].append(scheduler_class(
Expand Down Expand Up @@ -1930,6 +1932,7 @@ def generateTalosBranchObjects(branch, branch_config, PLATFORMS, SUITES,
extra_args['numberOfBuildsToTrigger'] = 1
extra_args['prettyNames'] = prettyNames
extra_args['unittestSuites'] = unittestSuites
extra_args['buildbotBranch'] = branch
else:
scheduler_class = Scheduler
branchObjects['schedulers'].append(scheduler_class(
Expand All @@ -1952,6 +1955,7 @@ def generateTalosBranchObjects(branch, branch_config, PLATFORMS, SUITES,
extra_args['numberOfBuildsToTrigger'] = 1
extra_args['prettyNames'] = prettyNames
extra_args['unittestSuites'] = unittestSuites
extra_args['buildbotBranch'] = branch
else:
scheduler_class = Scheduler
branchObjects['schedulers'].append(scheduler_class(
Expand Down Expand Up @@ -1979,6 +1983,7 @@ def generateTalosBranchObjects(branch, branch_config, PLATFORMS, SUITES,
extra_args['prettyNames'] = prettyNames
extra_args['talosSuites'] = SUITES.keys()
extra_args['numberOfBuildsToTrigger'] = tests
extra_args['buildbotBranch'] = branch

s = scheduler_class(
name=name,
Expand All @@ -2005,6 +2010,7 @@ def generateTalosBranchObjects(branch, branch_config, PLATFORMS, SUITES,
extra_args['prettyNames'] = prettyNames
extra_args['talosSuites'] = SUITES.keys()
extra_args['numberOfBuildsToTrigger'] = tests
extra_args['buildbotBranch'] = branch

s = scheduler_class(
name=name,
Expand Down
2 changes: 1 addition & 1 deletion misc_scheduler.py
Expand Up @@ -42,7 +42,7 @@ def parseData(comments, c):
log.msg("No comments, passing empty string which will result in default set")
comments = ""
customBuilders = TryParser(comments, s.builderNames, s.prettyNames, s.unittestPrettyNames,
s.unittestSuites, s.talosSuites)
s.unittestSuites, s.talosSuites, s.buildbotBranch)
buildersPerChange[c] = customBuilders

def parseDataError(failure, c):
Expand Down
6 changes: 4 additions & 2 deletions scheduler.py
Expand Up @@ -131,13 +131,15 @@ def create_builds(self, to_create, t):

class BuilderChooserScheduler(MultiScheduler):
compare_attrs = MultiScheduler.compare_attrs + ('chooserFunc', 'prettyNames',
'unittestPrettyNames', 'unittestSuites', 'talosSuites')
def __init__(self, chooserFunc, prettyNames=None, unittestPrettyNames=None, unittestSuites=None, talosSuites=None, **kwargs):
'unittestPrettyNames', 'unittestSuites', 'talosSuites', 'buildbotBranch')
def __init__(self, chooserFunc, prettyNames=None, unittestPrettyNames=None, unittestSuites=None,
talosSuites=None, buildbotBranch=None, **kwargs):
self.chooserFunc = chooserFunc
self.prettyNames = prettyNames
self.unittestPrettyNames = unittestPrettyNames
self.unittestSuites = unittestSuites
self.talosSuites = talosSuites
self.buildbotBranch = buildbotBranch
MultiScheduler.__init__(self, **kwargs)
def run(self):
db = self.parent.db
Expand Down
9 changes: 9 additions & 0 deletions test/test_try_parser.py
Expand Up @@ -6,16 +6,19 @@
BUILDER_PRETTY_NAMES = {'macosx64':'OS X 10.6.2 try build', 'win32':'WINNT 5.2 try build', 'win32-debug':'WINNT 5.2 try leak test build', 'linux64':'Linux x86-64 try build', 'linux':'Linux try build', 'macosx64-debug':'OS X 10.6.2 try leak test build', 'linux64-debug':'Linux x86-64 try leak test build', 'linux-debug':'Linux try leak test build', 'macosx-debug':'OS X 10.5.2 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 10.5.8'], 'win32':['Rev3 WINNT 5.1', 'Rev3 WINNT 6.1'], 'linux-64':['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'}

TALOS_SUITES = ['tp4', 'chrome']
UNITTEST_SUITES = ['reftest', 'crashtest', 'mochitests-1/5', 'mochitests-3/5', 'mochitest-other']
UNITTEST_SUITES_TB = ['xpcshell', 'mozmill']
MOBILE_UNITTEST_SUITES = ['reftest-1/3', 'reftest-3/3'] + UNITTEST_SUITES[1:]

VALID_UPN = ['WINNT 5.2 try debug test mochitests-1/5', 'WINNT 5.2 try debug test mochitests-3/5', '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/3', 'WINNT 5.2 try debug test reftest-3/3']
VALID_BUILDER_NAMES = ['OS X 10.6.2 try build', 'WINNT 5.2 try build', 'Linux x86-64 try build', 'Linux try build', 'OS X 10.5.2 try leak test build', 'OS X 10.6.2 try leak test build', 'WINNT 5.2 try leak test build', 'Linux x86-64 try leak test build', 'Linux try leak test build','Android R7 try build', 'Maemo 5 GTK try build']
VALID_TESTER_NAMES = ['Rev3 Fedora 12 try opt test mochitests-1/5', 'Rev3 Fedora 12 try opt test mochitest-other', 'Rev3 Fedora 12 try opt test crashtest', 'Rev3 Fedora 12 try debug test mochitests-1/5', 'Rev3 Fedora 12 try debug test mochitest-other', 'Rev3 WINNT 5.1 try opt test reftest', 'Rev3 WINNT 6.1 try opt test crashtest', 'Rev3 WINNT 6.1 try debug test crashtest', 'Rev3 WINNT 6.1 try debug test mochitest-other', 'Rev3 WINNT 6.1 try debug test mochitests-3/5', 'Rev3 MacOSX Leopard 10.5.8 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 tests mozmill', 'TB Rev3 Fedora 12 try-comm-central opt tests xpcshell']

class TestTryParser(unittest.TestCase):

Expand Down Expand Up @@ -97,6 +100,12 @@ def test_AllOnTestMaster(self):
builders = ['Rev3 Fedora 12 try opt test mochitests-1/5', 'Rev3 Fedora 12 try opt test mochitest-other', 'Rev3 Fedora 12 try opt test crashtest', 'Rev3 Fedora 12 try debug test mochitests-1/5', 'Rev3 Fedora 12 try debug test mochitest-other', 'Rev3 WINNT 5.1 try opt test reftest', 'Rev3 WINNT 6.1 try opt test crashtest', 'Rev3 WINNT 6.1 try debug test crashtest', 'Rev3 WINNT 6.1 try debug test mochitest-other', 'Rev3 WINNT 6.1 try debug test mochitests-3/5']
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 = ['TB Rev3 Fedora 12 try-comm-central opt tests mozmill', 'TB Rev3 Fedora 12 try-comm-central opt tests xpcshell']
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)
Expand Down
18 changes: 10 additions & 8 deletions try_parser.py
Expand Up @@ -59,7 +59,8 @@ def getPlatformBuilders(user_platforms, builderNames, buildTypes, prettyNames):
platformBuilders.extend([custom_builder])
return platformBuilders

def getTestBuilders(platforms, testType, tests, builderNames, buildTypes, prettyNames, unittestPrettyNames):
def getTestBuilders(platforms, testType, tests, builderNames, buildTypes, buildbotBranch,
prettyNames, unittestPrettyNames):
testBuilders = []
builder_test_platforms = []
# for all possible suites, add in the builderNames for that platform
Expand All @@ -76,12 +77,12 @@ def getTestBuilders(platforms, testType, tests, builderNames, buildTypes, pretty
# checking for list type so this is only run for test_master builders where slave_platforms are used
if type(prettyNames[platform])==type(list()):
for slave_platform in prettyNames[platform]:
custom_builder = "%s try %s %s %s" % (slave_platform, buildType, testType, test)
custom_builder = "%s %s %s %s %s" % (slave_platform, buildbotBranch, buildType, testType, test)
# have to check that custom_builder is not already present
if custom_builder in (builderNames) and custom_builder not in testBuilders:
testBuilders.extend([custom_builder])
else:
custom_builder = "%s try %s %s %s" % (prettyNames[platform], buildType, testType, test)
custom_builder = "%s %s %s %s %s" % (prettyNames[platform], buildbotBranch, buildType, testType, test)
# have to check that custom_builder is not already present
if custom_builder in (builderNames) and custom_builder not in testBuilders:
testBuilders.extend([custom_builder])
Expand All @@ -101,13 +102,14 @@ def getTestBuilders(platforms, testType, tests, builderNames, buildTypes, pretty
if platform in prettyNames.keys():
for test in tests:
for slave_platform in prettyNames[platform]:
custom_builder = "%s try %s %s" % (slave_platform, testType, test)
custom_builder = "%s %s %s %s" % (slave_platform, buildbotBranch, testType, test)
if custom_builder in (builderNames) and custom_builder not in testBuilders:
testBuilders.extend([custom_builder])

return testBuilders

def TryParser(message, builderNames, prettyNames, unittestPrettyNames=None, unittestSuites=None, talosSuites=None):
def TryParser(message, builderNames, prettyNames, unittestPrettyNames=None, unittestSuites=None, talosSuites=None,
buildbotBranch='try'):

parser = argparse.ArgumentParser(description='Pass in a commit message and a list \
and tryParse populates the list with the builderNames\
Expand Down Expand Up @@ -186,13 +188,13 @@ def TryParser(message, builderNames, prettyNames, unittestPrettyNames=None, unit
if options.test != 'none' and unittestSuites:
# get test builders for test_master first
customBuilderNames.extend(getTestBuilders(options.user_platforms, "test", options.test,
builderNames, options.build, prettyNames, None))
builderNames, options.build, buildbotBranch, prettyNames, None))
# then add any builder_master test builders
if unittestPrettyNames:
customBuilderNames.extend(getTestBuilders(options.user_platforms, "test", options.test,
builderNames, options.build, {}, unittestPrettyNames))
builderNames, options.build, buildbotBranch, {}, unittestPrettyNames))
if options.talos != 'none' and talosSuites is not None:
customBuilderNames.extend(getTestBuilders(options.user_platforms, "talos", options.talos, builderNames,
options.build, prettyNames, None))
options.build, buildbotBranch, prettyNames, None))

return customBuilderNames

0 comments on commit a038d97

Please sign in to comment.