Implementing diff against previous gdb.sum, instead of using a baseline
This commit is contained in:
parent
85ed927a4d
commit
7595196cc7
4 changed files with 59 additions and 7 deletions
|
@ -2,8 +2,36 @@
|
|||
|
||||
from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION
|
||||
from buildbot.steps.shell import ShellCommand
|
||||
from sumfiles import DejaResults
|
||||
from sumfiles import DejaResults, get_web_base
|
||||
from gdbgitdb import switch_to_branch
|
||||
from shutil import copyfile
|
||||
|
||||
class CopyOldGDBSumFile (ShellCommand):
|
||||
"""Copy the current gdb.sum file into the old_gdb.sum file."""
|
||||
name = "copy gdb.sum file"
|
||||
command = [ '/bin/true' ]
|
||||
|
||||
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')
|
||||
wb = get_web_base ()
|
||||
if branch is None:
|
||||
branch = 'master'
|
||||
|
||||
# Switch to the right branch inside the BUILDER repo
|
||||
switch_to_branch (builder, branch)
|
||||
|
||||
try:
|
||||
copyfile ("%d/%d/gdb.sum" % (wb, builder),
|
||||
"%d/%d/previous_gdb.sum" % (wb, builder))
|
||||
except IOError:
|
||||
# If the dest file does not exist, ignore
|
||||
pass
|
||||
|
||||
class GdbCatSumfileCommand(ShellCommand):
|
||||
name = 'regressions'
|
||||
|
@ -27,20 +55,31 @@ class GdbCatSumfileCommand(ShellCommand):
|
|||
cur_results = parser.read_sum_text(self.getLog('stdio').getText())
|
||||
if not istry or istry == '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)
|
||||
result = SUCCESS
|
||||
if baseline is not None:
|
||||
report = parser.compute_regressions (builder, branch,
|
||||
cur_results, baseline)
|
||||
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)
|
||||
if report is not '':
|
||||
self.addCompleteLog ('regressions', report)
|
||||
result = FAILURE
|
||||
|
||||
if not istry or istry == 'no':
|
||||
parser.write_sum_file (cur_results, builder, branch)
|
||||
# If there was no previous baseline, then this run
|
||||
# gets the honor.
|
||||
if baseline is None:
|
||||
baseline = cur_results
|
||||
parser.write_baseline (baseline, builder, branch)
|
||||
parser.write_baseline (baseline, builder, branch, rev)
|
||||
|
||||
return result
|
||||
|
|
|
@ -133,6 +133,8 @@ class SaveGDBResults (ShellCommand):
|
|||
repo.index.add (['gdb.sum',
|
||||
'gdb.log',
|
||||
'baseline'])
|
||||
if os.path.exists ("%s/previous_gdb.sum"):
|
||||
repo.index.add (['previous_gdb.sum'])
|
||||
if repo.is_dirty ():
|
||||
repo.index.commit ('Log files for %s -- branch %s' % (full_tag, branch))
|
||||
repo.index.write ()
|
||||
|
|
|
@ -46,7 +46,8 @@ class DejaResults(object):
|
|||
test_name = nname
|
||||
out_dict[test_name] = result
|
||||
|
||||
def _write_sum_file(self, sum_dict, subdir, rev_or_branch, filename):
|
||||
def _write_sum_file(self, sum_dict, subdir, rev_or_branch, filename,
|
||||
header = None):
|
||||
global gdb_web_base
|
||||
if not rev_or_branch:
|
||||
bdir = os.path.join (gdb_web_base, subdir)
|
||||
|
@ -57,15 +58,21 @@ class DejaResults(object):
|
|||
fname = os.path.join (bdir, filename)
|
||||
keys = sum_dict.keys ()
|
||||
keys.sort ()
|
||||
with open (fname, 'w') as f:
|
||||
mode = 'w'
|
||||
if header:
|
||||
with open (fname, 'w') as f:
|
||||
f.write (header)
|
||||
mode = 'a'
|
||||
with open (fname, mode) as f:
|
||||
for k in keys:
|
||||
f.write (sum_dict[k] + ': ' + k + '\n')
|
||||
|
||||
def write_sum_file(self, sum_dict, builder, branch):
|
||||
self._write_sum_file (sum_dict, builder, None, 'gdb.sum')
|
||||
|
||||
def write_baseline(self, sum_dict, builder, branch):
|
||||
self._write_sum_file(sum_dict, builder, None, 'baseline')
|
||||
def write_baseline(self, sum_dict, builder, branch, rev):
|
||||
self._write_sum_file(sum_dict, builder, None, 'baseline',
|
||||
header = "### THIS BASELINE WAS LAST UPDATED BY COMMIT %s ###\n\n" % rev)
|
||||
|
||||
# Read a .sum file.
|
||||
# The builder name is BUILDER.
|
||||
|
@ -98,6 +105,9 @@ class DejaResults(object):
|
|||
return self._read_sum_file (builder, os.path.join ('xfails', branch),
|
||||
'xfail')
|
||||
|
||||
def read_old_sum_file (self, builder, branch):
|
||||
return self._read_sum_file (builder, None, 'previous_gdb.sum')
|
||||
|
||||
# Parse some text as a .sum file and return the resulting
|
||||
# dictionary.
|
||||
def read_sum_text (self, text):
|
||||
|
|
|
@ -24,7 +24,7 @@ from buildbot.steps.slave import RemoveDirectory
|
|||
from buildbot.changes.filter import ChangeFilter
|
||||
from buildbot.buildslave import BuildSlave
|
||||
from buildbot.status.results import SUCCESS, WARNINGS, FAILURE, EXCEPTION
|
||||
from gdbcommand import GdbCatSumfileCommand
|
||||
from gdbcommand import CopyOldGDBSumFile, GdbCatSumfileCommand
|
||||
from gdbgitdb import SaveGDBResults, get_builder_commit_id
|
||||
from urllib import quote
|
||||
|
||||
|
@ -472,6 +472,7 @@ The parameters of the class are:
|
|||
descriptionDone = r"removed old build dir"))
|
||||
self.addStep (CloneOrUpdateGDBMasterRepo ())
|
||||
self.addStep (CloneOrUpdateGDBRepo ())
|
||||
self.addStep (CopyOldGDBSumFile ())
|
||||
|
||||
if not self.extra_conf_flags:
|
||||
self.extra_conf_flags = []
|
||||
|
|
Loading…
Reference in a new issue