New version of gdbbuilder.py, with lots of new features
This commit is contained in:
parent
dbcbfcc669
commit
610283d761
1 changed files with 171 additions and 88 deletions
|
@ -2,106 +2,189 @@
|
||||||
|
|
||||||
from buildbot.process import factory
|
from buildbot.process import factory
|
||||||
from buildbot.process.properties import WithProperties
|
from buildbot.process.properties import WithProperties
|
||||||
|
from buildbot.schedulers.basic import SingleBranchScheduler, AnyBranchScheduler
|
||||||
|
from buildbot.schedulers.forcesched import ForceScheduler
|
||||||
from buildbot.steps.shell import Compile
|
from buildbot.steps.shell import Compile
|
||||||
from buildbot.steps.shell import Configure
|
from buildbot.steps.shell import Configure
|
||||||
from buildbot.steps.shell import SetProperty
|
from buildbot.steps.shell import SetProperty
|
||||||
from buildbot.steps.shell import ShellCommand
|
from buildbot.steps.shell import ShellCommand
|
||||||
from buildbot.steps.source import Git
|
from buildbot.steps.shell import SetPropertyFromCommand
|
||||||
|
from buildbot.steps.source.git import Git
|
||||||
|
from buildbot.changes.filter import ChangeFilter
|
||||||
from buildbot.steps.transfer import FileDownload
|
from buildbot.steps.transfer import FileDownload
|
||||||
|
from buildbot.buildslave import BuildSlave
|
||||||
from gdbcommand import GdbCatSumfileCommand
|
from gdbcommand import GdbCatSumfileCommand
|
||||||
|
from json import load
|
||||||
|
|
||||||
giturl = 'git://sourceware.org/git/gdb.git'
|
|
||||||
|
|
||||||
# Initialize F with some basic build rules.
|
## TODO:
|
||||||
def _init_gdb_factory(f, conf_flags):
|
##
|
||||||
global giturl
|
## - Add comments on every function/class
|
||||||
f.addStep(Git(repourl = giturl, workdir = 'gdb', mode = 'update',
|
## - License stuff (on all files)
|
||||||
reference = '/home/buildbot/Git/gdb/.git'))
|
## - Cross testing (needed?)
|
||||||
f.addStep(ShellCommand(command=["rm", "-rf", "build"], workdir=".",
|
## - Improve way to store and compare testcases
|
||||||
description="clean build dir"))
|
|
||||||
f.addStep(Configure(command=["../gdb/configure",
|
|
||||||
'--enable-targets=all'] + conf_flags,
|
|
||||||
workdir="build"))
|
|
||||||
f.addStep(Compile(command=["make", "-j4", "all"], workdir="build"))
|
|
||||||
f.addStep(Compile(command=["make", "-j4", "info"], workdir="build"))
|
|
||||||
|
|
||||||
def _add_summarizer(f):
|
|
||||||
f.addStep(GdbCatSumfileCommand(workdir='build/gdb/testsuite',
|
|
||||||
description='analyze test results'))
|
|
||||||
|
|
||||||
def _add_check(f, check_flags, check_env):
|
class DeleteGDBBuildDir (ShellCommand):
|
||||||
f.addStep(Compile(command=["make", "-k", '-j4', "check"] + check_flags,
|
description = "deleting previous GDB build directory"
|
||||||
workdir="build/gdb/testsuite",
|
descriptionDone = "deleted previous GDB build directory"
|
||||||
description='run test suite',
|
command = ['rm', '-rf', WithProperties ("%s/build", 'builddir')]
|
||||||
env = check_env,
|
|
||||||
# We have to set these due to dejagnu
|
|
||||||
haltOnFailure = False,
|
|
||||||
flunkOnFailure = False))
|
|
||||||
|
|
||||||
def _index_build(f):
|
class CloneOrUpdateGDBMasterRepo (Git):
|
||||||
f.addStep(SetProperty(command=['pwd'], property='SRCDIR',
|
description = "fetching GDB master sources"
|
||||||
workdir='gdb/gdb'))
|
descriptionDone = "fetched GDB master sources"
|
||||||
return [WithProperties (r'CC_FOR_TARGET=/bin/sh %s/cc-with-index.sh gcc',
|
def __init (self):
|
||||||
'SRCDIR'),
|
Git.__init__ (self,
|
||||||
WithProperties (r'CXX_FOR_TARGET=/bin/sh %s/cc-with-index.sh g++',
|
repourl = 'git://sourceware.org/git/binutils-gdb.git',
|
||||||
'SRCDIR')]
|
workdir = WithProperties ("%s/../binutils-gdb-master/",
|
||||||
|
'builddir'),
|
||||||
|
mode = 'incremental')
|
||||||
|
|
||||||
def _gdbserver(f):
|
class CloneOrUpdateGDBRepo (Git):
|
||||||
f.addStep(ShellCommand(command = ['mkdir', '-p', 'stuff/boards'],
|
description = "fetching GDB sources"
|
||||||
workdir = 'build'))
|
descriptionDone = "fetched GDB sources"
|
||||||
f.addStep(ShellCommand(command = ['touch', 'stuff/site.exp'],
|
def __init__ (self):
|
||||||
workdir = 'build'))
|
Git.__init__ (self,
|
||||||
f.addStep(FileDownload(mastersrc = '~/GDB/lib/native-gdbserver.exp',
|
repourl = 'git://sourceware.org/git/binutils-gdb.git',
|
||||||
slavedest = 'stuff/boards/native-gdbserver.exp',
|
workdir = WithProperties ('%s/binutils-gdb/', 'builddir'),
|
||||||
workdir = 'build'))
|
reference = WithProperties ("%s/../binutils-gdb-master/",
|
||||||
f.addStep(SetProperty(command = ['pwd'], property='STUFFDIR',
|
'builddir'))
|
||||||
workdir = 'build/stuff'))
|
|
||||||
return { 'DEJAGNU' : WithProperties(r'%s/site.exp', 'STUFFDIR') }
|
|
||||||
|
|
||||||
def _make_one_gdb_builder(kind):
|
class ConfigureGDB (Configure):
|
||||||
f = factory.BuildFactory()
|
description = "configure GDB"
|
||||||
_init_gdb_factory(f, [])
|
descriptionDone = "configured GDB"
|
||||||
check_flags = []
|
def __init__ (self, extra_conf_flags, **kwargs):
|
||||||
check_env = {}
|
Configure.__init__ (self, **kwargs)
|
||||||
if kind == 'index':
|
self.workdir = WithProperties ("%s", 'builddir')
|
||||||
check_flags = _index_build(f)
|
self.command = ['../binutils-gdb/configure',
|
||||||
elif kind == 'dwarf4':
|
'--enable-targets=all',
|
||||||
check_flags = ['RUNTESTFLAGS=--target_board unix/gdb:debug_flags=-gdwarf-4',
|
'--disable-binutils',
|
||||||
'FORCE_PARALLEL=yes']
|
'--disable-ld',
|
||||||
elif kind == 'm32':
|
'--disable-gold',
|
||||||
check_flags = ['RUNTESTFLAGS=--target_board unix/-m32',
|
'--disable-gprof'] + extra_conf_flags
|
||||||
'FORCE_PARALLEL=yes']
|
|
||||||
elif kind == 'gdbserver':
|
|
||||||
check_env = _gdbserver(f)
|
|
||||||
check_flags = ['RUNTESTFLAGS=--target_board native-gdbserver',
|
|
||||||
'FORCE_PARALLEL=yes']
|
|
||||||
_add_check(f, check_flags, check_env)
|
|
||||||
_add_summarizer(f)
|
|
||||||
return f
|
|
||||||
|
|
||||||
# Future build kinds:
|
class CompileGDB (Compile):
|
||||||
# valgrind Run test suite under valgrind
|
description = "compile GDB"
|
||||||
# bfd64 Build GDB with --enable-64-bit-bfd (32-bit only)
|
descriptionDone = "compiled GDB"
|
||||||
# pie Build test cases with -fPIE.
|
def __init__ (self, extra_make_flags = [], **kwargs):
|
||||||
# nosysdebug Configure so that system debuginfo is ignored.
|
Compile.__init__ (self, **kwargs)
|
||||||
|
self.workdir = WithProperties ("%s", 'builddir')
|
||||||
|
self.command = ['make',
|
||||||
|
WithProperties ("-j%s", 'jobs'),
|
||||||
|
'all'] + extra_make_flags
|
||||||
|
|
||||||
def make_gdb_builder(op_sys, arch, kind = ''):
|
class TestGDB (Compile):
|
||||||
"""Make a new GDB builder.
|
description = "testing GDB"
|
||||||
OP_SYS is the slave's operating system, e.g., 'f14'.
|
descriptionDone = "tested GDB"
|
||||||
ARCH is the slave's architecture, e.g., x86_64.
|
def __init__ (self, extra_make_check_flags = [], test_env = {},
|
||||||
KIND indicates the kind of builder to make. It is a string.
|
noparallel = False, **kwargs):
|
||||||
The default, indicated by the empty string, is to make a basic builder.
|
Compile.__init__ (self, **kwargs)
|
||||||
Other valid values are:
|
|
||||||
dwarf4 Run test suite with -gdwarf-4.
|
self.flags = extra_make_check_flags
|
||||||
gdbserver Run test suite against gdbserver.
|
if not noparallel:
|
||||||
index Run test suite with .gdb_index files.
|
self.flags.append ('FORCE_PARALLEL=1')
|
||||||
m32 Build GDB and run all tests with -m32 (64-bit only).
|
|
||||||
"""
|
self.workdir = WithProperties ("%s/gdb/testsuite", 'builddir')
|
||||||
name = 'gdb-' + op_sys + '-' + arch
|
self.command = ['make',
|
||||||
if kind != '':
|
'-k',
|
||||||
name = name + '-' + kind
|
WithProperties ("-j%s", 'jobs'),
|
||||||
return { 'name' : name,
|
'check'] + self.flags
|
||||||
'slavenames' : [ name ],
|
self.env = test_env
|
||||||
'builddir' : name,
|
# Needed because of dejagnu
|
||||||
'factory' : _make_one_gdb_builder(kind)
|
self.haltOnFailure = False
|
||||||
}
|
self.flunkOnFailure = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BuildAndTestGDBFactory (factory.BuildFactory):
|
||||||
|
ConfigureClass = ConfigureGDB
|
||||||
|
CompileClass = CompileGDB
|
||||||
|
TestClass = TestGDB
|
||||||
|
|
||||||
|
extra_conf_flags = None
|
||||||
|
extra_make_flags = None
|
||||||
|
extra_make_check_flags = None
|
||||||
|
test_env = None
|
||||||
|
|
||||||
|
no_test_parallel = False
|
||||||
|
|
||||||
|
def __init__ (self, architecture_triplet = []):
|
||||||
|
factory.BuildFactory.__init__ (self)
|
||||||
|
self.addStep (DeleteGDBBuildDir ())
|
||||||
|
self.addStep (CloneOrUpdateGDBRepo ())
|
||||||
|
|
||||||
|
if not self.extra_conf_flags:
|
||||||
|
self.extra_conf_flags = []
|
||||||
|
self.addStep (self.ConfigureClass (self.extra_conf_flags + architecture_triplet))
|
||||||
|
|
||||||
|
if not self.extra_make_flags:
|
||||||
|
self.extra_make_flags = []
|
||||||
|
self.addStep (self.CompileClass (self.extra_make_flags))
|
||||||
|
|
||||||
|
if not self.extra_make_check_flags:
|
||||||
|
self.extra_make_check_flags = []
|
||||||
|
if not self.test_env:
|
||||||
|
self.test_env = {}
|
||||||
|
self.addStep (self.TestClass (self.extra_make_check_flags, self.test_env,
|
||||||
|
self.no_test_parallel))
|
||||||
|
|
||||||
|
self.addStep (GdbCatSumfileCommand (workdir = WithProperties ('%s/build/gdb/testsuite', 'builddir'), description = 'analyze test results'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class RunTestGDBPlain_c64t64 (BuildAndTestGDBFactory):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class RunTestGDBPlain_c32t32 (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board unix/-m32' ]
|
||||||
|
|
||||||
|
class RunTestGDBm32_c64t32 (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board unix/-m32' ]
|
||||||
|
|
||||||
|
class RunTestGDBNativeGDBServer_c64t64 (BuildAndTestGDBFactory):
|
||||||
|
no_test_parallel = True
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-gdbserver' ]
|
||||||
|
|
||||||
|
class RunTestGDBNativeGDBServer_c64t32 (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-gdbserver/-m32' ]
|
||||||
|
|
||||||
|
class RunTestGDBNativeExtendedGDBServer_c64t64 (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-extended-gdbserver' ]
|
||||||
|
|
||||||
|
class RunTestGDBNativeExtendedGDBServer_c64t32 (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-extended-gdbserver/-m32' ]
|
||||||
|
|
||||||
|
class RunTestGDBIndexBuild (BuildAndTestGDBFactory):
|
||||||
|
extra_make_check_flags = [ 'CC_FOR_TARGET=/bin/sh binutils-gdb/gdb/contrib/cc-with-tweaks.sh -i gcc', 'CXX_FOR_TARGET=/bin/sh binutils-gdb/gdb/contrib/cc-with-tweaks.sh -i g++']
|
||||||
|
|
||||||
|
master_filter = ChangeFilter (branch = [ 'master' ])
|
||||||
|
|
||||||
|
def load_config (c):
|
||||||
|
config = load (open ("lib/config.json"))
|
||||||
|
passwd = load (open ("lib/passwords.json"))
|
||||||
|
|
||||||
|
c['slaves'] = [BuildSlave (slave['name'], passwd[slave['name']],
|
||||||
|
max_builds = 1,
|
||||||
|
properties = { 'jobs' : slave['jobs'] })
|
||||||
|
for slave in config['slaves']]
|
||||||
|
|
||||||
|
c['schedulers'] = []
|
||||||
|
for s in config['schedulers']:
|
||||||
|
if "change_filter" in s:
|
||||||
|
s['change_filter'] = globals ()[s['change_filter']]
|
||||||
|
kls = globals ()[s.pop ('type')]
|
||||||
|
s = dict (map (lambda key_value_pair : (str (key_value_pair[0]),
|
||||||
|
key_value_pair[1]),
|
||||||
|
s.items ()))
|
||||||
|
c['schedulers'].append (kls (**s))
|
||||||
|
|
||||||
|
c['builders'] = []
|
||||||
|
for b in config['builders']:
|
||||||
|
if 'arch_triplet' in b:
|
||||||
|
arch_triplet = b.pop ('arch_triplet')
|
||||||
|
else:
|
||||||
|
arch_triplet = None
|
||||||
|
btype = b.pop ('type')
|
||||||
|
factory = globals ()[ "RunTestGDB%s" % btype ]
|
||||||
|
b['factory'] = factory (arch_triplet)
|
||||||
|
c['builders'].append (b)
|
||||||
|
|
Loading…
Reference in a new issue