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

View file

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

View file

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