Improving Message formatter for try builder

This commit is contained in:
Sergio Durigan Junior 2016-07-23 11:00:11 -04:00
parent 709cf34673
commit 05c9e2ba0e

View file

@ -244,14 +244,9 @@ 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 ('isTrySched') == 'yes'
if istrysched:
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, istrysched, try_to) SendRootMessageGDBTesters (branch, cur_change)
# Subject # Subject
subj = "Failures on %s, branch %s" % (name, branch) subj = "Failures on %s, branch %s" % (name, branch)
@ -383,7 +378,6 @@ 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 not istrysched:
if report_build_breakage: if report_build_breakage:
subj += " *** BREAKAGE ***" subj += " *** BREAKAGE ***"
SendAuthorMessage (name, cur_change, text) SendAuthorMessage (name, cur_change, text)
@ -399,6 +393,131 @@ send to the gdb-testers mailing list."""
'type' : 'plain', 'type' : 'plain',
'subject' : subj } 'subject' : subj }
def MessageGDBTestersTryBuild (mode, name, build, results, master_status):
"""This function is responsible for composing the message that will be
send to the gdb-testers mailing list."""
git_url = "http://gdb-build.sergiodj.net/cgit"
branch = build.getSourceStamps ()[0].branch
sourcestamp = build.getSourceStamps ()[0]
cur_change = sourcestamp.patch_body
properties = build.getProperties ()
isrebuild = properties.getProperty ('isRebuild')
try_to = build.getReason ().strip ("'try' job by user ")
# Sending the root message to gdb-testers.
SendRootMessageGDBTesters (branch, cur_change, istrysched = True, try_to)
# Subject
subj = "Try Build on %s, branch %s" % (name, branch)
# Body
text = ""
# Buildslave name, useful for knowing the exact configuration.
text += "Buildslave:\n"
text += "\t%s\n" % build.getSlavename ()
# Including the link for the full build
text += "\nFull Build URL:\n"
text += "\t<%s>\n" % master_status.getURLForThing (build)
# Commits that were tested. Usually we should be dealing with
# only one commit
text += "\nLast commit(s) before Try Build:\n"
text += "\t%s\n" % sourcestamp.revision
# URL to find more info about what went wrong.
text += "\nTestsuite log (gdb.sum and gdb.log) URL(s):\n"
commit_id = get_builder_commit_id (name, sourcestamp.revision,
sourcestamp.branch)
if commit_id:
text += "\t<%s/%s/.git/tree/?h=%s&id=%s>\n" % (git_url, name,
quote (sourcestamp.branch),
commit_id)
else:
text += "\t<Error fetching commit ID for %s>\n" % sourcestamp.revision
# found_regressions will be True if the 'regressions' log is not
# empty.
found_regressions = False
for log in build.getLogs ():
st = log.getStep ()
n = st.getName ()
if st.getResults ()[0] == SUCCESS or st.getResults ()[0] == WARNING:
if n == 'regressions':
text += "Congratulations! No regressions were found in this build!\n\n"
break
if st.getResults ()[0] == FAILURE:
if 'No space left on device' in log.getText ():
text += "*** Internal error on buildslave (no space left on device). ***\n"
text += "*** Please report this to the buildslave owner (see <%s/buildslaves/%s>) ***\n\n" % (master_status.getBuildbotURL (), build.getSlavename ())
continue
elif n == 'update gdb master repo':
text += "*** Failed to update master GDB git repository. The build can continue. ***\n\n"
continue
elif n == 'update gdb repo':
text += "*** Failed to update GDB git repository. This is probably a timeout problem. ***\n\n"
break
elif n == 'configure gdb':
text += "*** Failed to configure GDB. ***\n"
text += "============================\n"
text += log.getText ()
text += "============================\n"
subj = "*** COMPILATION FAILED *** " + subj
break
elif n == 'compile gdb':
text += "*** Failed to compiled GDB. ***\n"
text += "============================\n"
ct = log.getText ().decode ('ascii', 'ignore')
if len (ct) > 100000:
text += "\n+++ The full log is too big to be posted here."
text += "\n+++ These are the last 100 lines of it.\n\n"
ctt = ct.split ('\n')[-100:]
ct = '\n'.join (ctt)
text += ct
else:
text += ct
text += "============================\n"
subj = "*** COMPILATION FAILED *** " + subj
break
elif n == 'make tags':
# We do not want to break here, because if this step
# fails the test will continue.
text += "*** Failed to make TAGS ***\n"
text += "Log URL: <%s/steps/%s/logs/%s>\n\n" % (master_status.getURLForThing (build),
quote (n), quote (log.getName ()))
continue
elif n == 'regressions' and log.getName () == 'regressions':
text += "*** Diff to previous build ***\n"
text += "============================\n"
text += log.getText ()
text += "============================\n"
found_regressions = True
break
# Including the 'xfail' log. It is important to say which tests
# we are ignoring.
if found_regressions:
if os.path.exists (os.path.join (gdb_web_base, name)):
xfail_commit = os.path.join (gdb_web_base, name, 'xfails', branch, '.last-commit')
text += "\n\n*** Complete list of XFAILs for this builder ***\n\n"
if os.path.exists (xfail_commit):
with open (xfail_commit, 'r') as f:
com = f.read ().strip ('\n')
text += "To obtain the list of XFAIL tests for this builder, go to:\n\n"
text += "\t<http://git.sergiodj.net/?p=gdb-xfails.git;a=blob;f=xfails/%s/xfails/%s/xfail;hb=%s>\n\n" % (name, branch, com)
text += "You can also see a pretty-printed version of the list, with more information\n"
text += "about each XFAIL, by going to:\n\n"
text += "\t<http://git.sergiodj.net/?p=gdb-xfails.git;a=blob;f=xfails/%s/xfails/%s/xfail.table;hb=%s>\n" % (name, branch, com)
else:
text += "FAILURE TO OBTAIN THE COMMIT FOR THE XFAIL LIST. PLEASE CONTACT THE BUILDBOT ADMIN.\n"
text += "\n"
return { 'body' : text,
'type' : 'plain',
'subject' : subj }
from buildbot.status import mail from buildbot.status import mail
class MyMailNotifier (mail.MailNotifier): class MyMailNotifier (mail.MailNotifier):
@ -419,7 +538,7 @@ mn = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
sendToInterestedUsers = False, sendToInterestedUsers = False,
extraRecipients = [ GDB_MAIL_TO ], extraRecipients = [ GDB_MAIL_TO ],
mode = ('failing'), mode = ('failing'),
messageFormatter = MessageGDBTesters, messageFormatter = MessageGDBTestersTryBuild,
tags = [ "MAIL" ], tags = [ "MAIL" ],
extraHeaders = { 'X-GDB-Buildbot' : '1', extraHeaders = { 'X-GDB-Buildbot' : '1',
'In-Reply-To' : WithProperties ("<%s@gdb-build>", 'In-Reply-To' : WithProperties ("<%s@gdb-build>",