2013-08-01 17:32:44 +00:00
|
|
|
# GDB .sum-fetching command.
|
|
|
|
|
|
|
|
from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION
|
|
|
|
from buildbot.steps.shell import ShellCommand
|
2015-02-05 01:32:58 +00:00
|
|
|
from sumfiles import DejaResults, get_web_base
|
2015-01-23 23:56:28 +00:00
|
|
|
from gdbgitdb import switch_to_branch
|
2015-02-05 01:32:58 +00:00
|
|
|
from shutil import copyfile
|
|
|
|
|
|
|
|
class CopyOldGDBSumFile (ShellCommand):
|
|
|
|
"""Copy the current gdb.sum file into the old_gdb.sum file."""
|
|
|
|
name = "copy gdb.sum file"
|
2015-02-05 03:17:28 +00:00
|
|
|
description = "copying previous gdb.sum file"
|
|
|
|
descriptionDone = "copied previous gdb.sum file"
|
2015-02-05 01:37:24 +00:00
|
|
|
command = [ 'true' ]
|
2015-02-05 01:32:58 +00:00
|
|
|
|
|
|
|
def __init__ (self, **kwargs):
|
|
|
|
ShellCommand.__init__ (self, **kwargs)
|
|
|
|
|
|
|
|
def evaluateCommand (self, cmd):
|
|
|
|
rev = self.getProperty('got_revision')
|
|
|
|
builder = self.getProperty('buildername')
|
2015-02-08 21:04:04 +00:00
|
|
|
istrybuilder = self.getProperty('isTryBuilder')
|
|
|
|
isrebuild = self.getProperty ('isRebuild')
|
2015-02-05 01:32:58 +00:00
|
|
|
branch = self.getProperty('branch')
|
|
|
|
wb = get_web_base ()
|
|
|
|
if branch is None:
|
|
|
|
branch = 'master'
|
|
|
|
|
2015-02-08 21:04:04 +00:00
|
|
|
if (istrybuilder and istrybuilder == 'yes') or (isrebuild and isrebuild == 'yes'):
|
|
|
|
return SUCCESS
|
|
|
|
|
2015-02-05 01:32:58 +00:00
|
|
|
# Switch to the right branch inside the BUILDER repo
|
2015-07-25 22:42:30 +00:00
|
|
|
switch_to_branch (builder, branch, force_switch = True)
|
2015-02-05 01:32:58 +00:00
|
|
|
|
|
|
|
try:
|
2015-02-05 01:34:45 +00:00
|
|
|
copyfile ("%s/%s/gdb.sum" % (wb, builder),
|
|
|
|
"%s/%s/previous_gdb.sum" % (wb, builder))
|
2015-02-05 01:32:58 +00:00
|
|
|
except IOError:
|
|
|
|
# If the dest file does not exist, ignore
|
|
|
|
pass
|
2013-08-01 17:32:44 +00:00
|
|
|
|
2015-02-05 01:40:20 +00:00
|
|
|
return SUCCESS
|
|
|
|
|
2013-08-01 17:32:44 +00:00
|
|
|
class GdbCatSumfileCommand(ShellCommand):
|
|
|
|
name = 'regressions'
|
|
|
|
command = ['cat', 'gdb.sum']
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
ShellCommand.__init__(self, **kwargs)
|
|
|
|
|
|
|
|
def evaluateCommand(self, cmd):
|
|
|
|
rev = self.getProperty('got_revision')
|
|
|
|
builder = self.getProperty('buildername')
|
|
|
|
istry = self.getProperty('isTryBuilder')
|
|
|
|
branch = self.getProperty('branch')
|
|
|
|
if branch is None:
|
|
|
|
branch = 'master'
|
2015-01-23 23:56:28 +00:00
|
|
|
|
|
|
|
# Switch to the right branch inside the BUILDER repo
|
2015-07-25 22:42:30 +00:00
|
|
|
switch_to_branch (builder, branch, force_switch = False)
|
2015-01-23 23:56:28 +00:00
|
|
|
|
2013-08-01 17:32:44 +00:00
|
|
|
parser = DejaResults()
|
|
|
|
cur_results = parser.read_sum_text(self.getLog('stdio').getText())
|
2014-12-21 01:37:10 +00:00
|
|
|
if not istry or istry == 'no':
|
2013-08-01 17:32:44 +00:00
|
|
|
baseline = parser.read_baseline (builder, branch)
|
2015-02-05 01:32:58 +00:00
|
|
|
old_sum = parser.read_old_sum_file (builder, branch)
|
2013-08-01 17:32:44 +00:00
|
|
|
else:
|
|
|
|
baseline = parser.read_sum_file(builder, rev)
|
2015-02-05 01:32:58 +00:00
|
|
|
old_sum = parser.read_old_sum_file (builder, rev)
|
2013-08-01 17:32:44 +00:00
|
|
|
result = SUCCESS
|
|
|
|
if baseline is not None:
|
2015-01-23 23:56:28 +00:00
|
|
|
report = parser.compute_regressions (builder, branch,
|
|
|
|
cur_results, baseline)
|
2015-02-05 01:32:58 +00:00
|
|
|
if report is not '':
|
|
|
|
self.addCompleteLog ('baseline_diff', report)
|
|
|
|
result = WARNINGS
|
|
|
|
|
|
|
|
if old_sum is not None:
|
|
|
|
report = parser.compute_regressions (builder, branch,
|
|
|
|
cur_results, old_sum)
|
2013-08-01 17:32:44 +00:00
|
|
|
if report is not '':
|
2015-01-23 23:56:28 +00:00
|
|
|
self.addCompleteLog ('regressions', report)
|
2013-08-01 17:32:44 +00:00
|
|
|
result = FAILURE
|
2015-02-05 01:32:58 +00:00
|
|
|
|
2014-12-21 01:37:10 +00:00
|
|
|
if not istry or istry == 'no':
|
2015-01-23 23:56:28 +00:00
|
|
|
parser.write_sum_file (cur_results, builder, branch)
|
2013-08-01 17:32:44 +00:00
|
|
|
# If there was no previous baseline, then this run
|
|
|
|
# gets the honor.
|
|
|
|
if baseline is None:
|
|
|
|
baseline = cur_results
|
2015-02-05 01:32:58 +00:00
|
|
|
parser.write_baseline (baseline, builder, branch, rev)
|
|
|
|
|
2013-08-01 17:32:44 +00:00
|
|
|
return result
|