Implementing some missing things on try build

This commit is contained in:
Sergio Durigan Junior 2016-07-23 00:04:34 -04:00
parent f466dc3483
commit 2e4d4d641e
3 changed files with 76 additions and 32 deletions

View file

@ -19,14 +19,13 @@ class CopyOldGDBSumFile (ShellCommand):
def evaluateCommand (self, cmd):
rev = self.getProperty('got_revision')
builder = self.getProperty('buildername')
istrybuilder = self.getProperty('isTryBuilder')
isrebuild = self.getProperty ('isRebuild')
branch = self.getProperty('branch')
wb = get_web_base ()
if branch is None:
branch = 'master'
if (istrybuilder and istrybuilder == 'yes') or (isrebuild and isrebuild == 'yes'):
if isrebuild and isrebuild == 'yes':
return SUCCESS
# Switch to the right branch inside the BUILDER repo
@ -51,7 +50,7 @@ class GdbCatSumfileCommand(ShellCommand):
def evaluateCommand(self, cmd):
rev = self.getProperty('got_revision')
builder = self.getProperty('buildername')
istry = self.getProperty('isTryBuilder')
istrysched = self.getProperty('isTrySched')
branch = self.getProperty('branch')
if branch is None:
branch = 'master'
@ -61,12 +60,14 @@ class GdbCatSumfileCommand(ShellCommand):
parser = DejaResults()
cur_results = parser.read_sum_text(self.getLog('stdio').getText())
if not istry or istry == 'no':
if not istrysched or istrysched == 'no':
baseline = parser.read_baseline (builder, branch)
old_sum = parser.read_old_sum_file (builder, branch)
else:
baseline = parser.read_sum_file(builder, rev)
old_sum = parser.read_old_sum_file (builder, rev)
# TODO: We'd probably be able to just call read_sum_file
# for both cases. Investigate.
baseline = parser.read_baseline (builder, branch)
old_sum = parser.read_sum_file (builder, branch)
result = SUCCESS
if baseline is not None:
report = parser.compute_regressions (builder, branch,
@ -82,7 +83,7 @@ class GdbCatSumfileCommand(ShellCommand):
self.addCompleteLog ('regressions', report)
result = FAILURE
if not istry or istry == 'no':
if not istrysched or istrysched == 'no':
parser.write_sum_file (cur_results, builder, branch)
# If there was no previous baseline, then this run
# gets the honor.

View file

@ -101,18 +101,21 @@ class SaveGDBResults (ShellCommand):
def _evaluateCommand_single_repo (self, cmd):
rev = self.getProperty ('got_revision')
builder = self.getProperty ('buildername')
istry = self.getProperty ('isTryBuilder')
istrysched = self.getProperty ('isTrySched')
isrebuild = self.getProperty ('isRebuild')
branch = self.getProperty ('branch')
repodir = os.path.join (get_web_base (), builder)
full_tag = "%s-%s-%s" % (datetime.now ().strftime ("%Y%m%d-%H%M%S"), rev, branch)
if istrysched and istrysched == 'yes':
full_tag += "-TRY_BUILD"
if branch is None:
branch = 'master'
repo = git.Repo.init (path = repodir)
if (istry and istry == 'yes') or (isrebuild and isrebuild == 'yes'):
if isrebuild and isrebuild == 'yes':
# Do nothing
if branch in repo.heads:
# We have to clean the branch because otherwise this
@ -142,7 +145,10 @@ class SaveGDBResults (ShellCommand):
if os.path.exists ("%s/previous_gdb.sum" % repodir):
repo.index.add (['previous_gdb.sum'])
if repo.is_dirty ():
repo.index.commit ('Log files for %s -- branch %s' % (full_tag, branch))
if istrysched and istrysched == 'yes':
repo.index.commit ('TRY BUILD: Log files for %s -- branch %s' % (full_tag, branch))
else:
repo.index.commit ('Log files for %s -- branch %s' % (full_tag, branch))
repo.index.write ()
repo.create_tag (full_tag)
# Returning the HEAD to master

View file

@ -141,11 +141,15 @@ import smtplib
import socket
from email.mime.text import MIMEText
def SendRootMessageGDBTesters (branch, change):
def SendRootMessageGDBTesters (branch, change, istrysched = False,
try_to = None):
global GDB_MAIL_TO, GDB_MAIL_FROM
rev = change.revision
f = "/tmp/gdb-buildbot-%s.lock" % rev
if istrysched:
f = "/tmp/gdb-buildbot-%s-try.lock" % rev
else:
f = "/tmp/gdb-buildbot-%s.lock" % rev
if os.path.exists (f):
# The message has already been sent
@ -174,11 +178,14 @@ def SendRootMessageGDBTesters (branch, change):
mail['Subject'] = sbj
mail['From'] = GDB_MAIL_FROM
mail['To'] = GDB_MAIL_TO
if not istrysched:
mail['To'] = GDB_MAIL_TO
else:
mail['To'] = try_to
mail['Message-Id'] = "<%s@gdb-build>" % rev
s = smtplib.SMTP ('localhost')
s.sendmail (GDB_MAIL_FROM, [ GDB_MAIL_TO ], mail.as_string ())
s.sendmail (GDB_MAIL_FROM, [ mail['To'] ], mail.as_string ())
s.quit ()
def make_breakage_lockfile_prefix ():
@ -237,9 +244,14 @@ send to the gdb-testers mailing list."""
cur_change = build.getSourceStamps ()[0].changes[0]
properties = build.getProperties ()
isrebuild = properties.getProperty ('isRebuild')
istrysched = properties.getProperty ('isTryShed') == 'yes'
if istryshed:
try_to = build.getReason ().strip ("'try' job by user ")
else:
try_to = None
# Sending the root message to gdb-testers.
SendRootMessageGDBTesters (branch, cur_change)
SendRootMessageGDBTesters (branch, cur_change, istrysched, try_to)
# Subject
subj = "Failures on %s, branch %s" % (name, branch)
@ -371,16 +383,17 @@ send to the gdb-testers mailing list."""
text += "FAILURE TO OBTAIN THE COMMIT FOR THE XFAIL LIST. PLEASE CONTACT THE BUILDBOT ADMIN.\n"
text += "\n"
if report_build_breakage:
subj += " *** BREAKAGE ***"
SendAuthorMessage (name, cur_change, text)
else:
# There is no build breakage anymore! Yay! Now, let's see if
# we need to clean up any lock file from previous breaks.
lockfile = "%s%s" % (make_breakage_lockfile_prefix (), name)
if os.path.exists (lockfile):
# We need to clean the lockfile. Garbage-collect it here.
os.remove (lockfile)
if not istrysched:
if report_build_breakage:
subj += " *** BREAKAGE ***"
SendAuthorMessage (name, cur_change, text)
else:
# There is no build breakage anymore! Yay! Now, let's see if
# we need to clean up any lock file from previous breaks.
lockfile = "%s%s" % (make_breakage_lockfile_prefix (), name)
if os.path.exists (lockfile):
# We need to clean the lockfile. Garbage-collect it here.
os.remove (lockfile)
return { 'body' : text,
'type' : 'plain',
@ -392,10 +405,14 @@ class MyMailNotifier (mail.MailNotifier):
"""Extend the regular MailNotifier class in order to filter e-mails by
scheduler."""
def isMailNeeded (self, build, results):
if not build.properties.getProperty ('scheduler').startswith ('racy'):
return mail.MailNotifier.isMailNeeded (self, build, results)
else:
if build.properties.getProperty ('scheduler').startswith ('racy'):
return False
elif build.properties.getProperty ('scheduler').startswith ('try'):
if not self.sendToInterestedUsers:
# This means we're dealing with mn. We only send
# e-mail on mn_try.
return False
return mail.MailNotifier.isMailNeeded (self, build, results)
mn = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
sendToInterestedUsers = False,
@ -407,6 +424,15 @@ mn = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
'In-Reply-To' : WithProperties ("<%s@gdb-build>",
'got_revision') })
mn_try = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
sendToInterestedUsers = True,
mode = ( 'failing', 'passing', 'warnings' ),
messageFormatter = MessageGDBTesters,
tags = [ "MAIL" ],
extraHeaders = { 'X-GDB-Buildbot' : '1',
'In-Reply-To' : WithProperties ("<%s@gdb-build>",
'got_revision') })
c['status'].append (mn)
c['title'] = "GDB"
@ -604,17 +630,27 @@ class CleanupBreakageLockfile (ShellCommand):
def scheduler_is_racy (step):
return step.getProperty ('scheduler').startswith ('racy')
def scheduler_is_try (step):
return step.getProperty ('scheduler').startswith ('try')
def scheduler_is_racy_hide (result, step):
return scheduler_is_racy (step)
def scheduler_is_racy_try_hide (result, step):
return scheduler_is_racy (step) and scheduler_is_try (step)
def scheduler_is_racy_do (step):
return scheduler_is_racy (step)
def scheduler_is_not_racy (step):
return not step.getProperty ('scheduler').startswith ('racy')
return not scheduler_is_racy (step)
def scheduler_is_not_try (step):
return not scheduler_is_try (step)
def scheduler_is_not_racy_hide (result, step):
return scheduler_is_not_racy (step)
def scheduler_is_not_racy_try_hide (result, step):
return scheduler_is_not_racy (step) and scheduler_is_not_try (step)
def scheduler_is_not_racy_do (step):
return scheduler_is_not_racy (step)
def scheduler_is_not_racy_try_do (step):
return scheduler_is_not_racy (step) and scheduler_is_not_try (step)
#######################
#### Build Factory ####
@ -721,8 +757,8 @@ The parameters of the class are:
self.addStep (CloneOrUpdateGDBRepo ())
if self.run_testsuite:
self.addStep (CopyOldGDBSumFile (doStepIf = scheduler_is_not_racy_do,
hideStepIf = scheduler_is_racy_hide))
self.addStep (CopyOldGDBSumFile (doStepIf = scheduler_is_not_racy_try_do,
hideStepIf = scheduler_is_racy_try_hide))
if not self.extra_conf_flags:
self.extra_conf_flags = []
@ -791,7 +827,6 @@ The parameters of the class are:
doStepIf = scheduler_is_racy_do,
hideStepIf = scheduler_is_not_racy_hide))
##################
#### Builders ####
##################
@ -1018,6 +1053,8 @@ def load_config (c):
pass
s['onlyIfChanged'] = False
s['branch'] = 'master'
elif s['type'] == 'Try_Jobdir':
s['properties'] = { 'isTrySched' : 'yes' }
if "change_filter" in s:
s['change_filter'] = globals ()[s['change_filter']]
kls = globals ()[s.pop ('type')]