From 05c9e2ba0ec9748a40ab53902ef4f9ddb8bffc6f Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sat, 23 Jul 2016 11:00:11 -0400 Subject: [PATCH] Improving Message formatter for try builder --- master.cfg | 155 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 137 insertions(+), 18 deletions(-) diff --git a/master.cfg b/master.cfg index 509622c..0b1c343 100644 --- a/master.cfg +++ b/master.cfg @@ -244,14 +244,9 @@ send to the gdb-testers mailing list.""" cur_change = build.getSourceStamps ()[0].changes[0] properties = build.getProperties () 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. - SendRootMessageGDBTesters (branch, cur_change, istrysched, try_to) + SendRootMessageGDBTesters (branch, cur_change) # Subject subj = "Failures on %s, branch %s" % (name, branch) @@ -383,17 +378,141 @@ 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 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) + 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', + '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\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\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\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', @@ -419,7 +538,7 @@ mn = MyMailNotifier(fromaddr = GDB_MAIL_FROM, sendToInterestedUsers = False, extraRecipients = [ GDB_MAIL_TO ], mode = ('failing'), - messageFormatter = MessageGDBTesters, + messageFormatter = MessageGDBTestersTryBuild, tags = [ "MAIL" ], extraHeaders = { 'X-GDB-Buildbot' : '1', 'In-Reply-To' : WithProperties ("<%s@gdb-build>",