2013-08-01 17:32:44 +00:00
|
|
|
# Define a GDB builder of some kind.
|
|
|
|
|
|
|
|
from buildbot.process import factory
|
|
|
|
from buildbot.process.properties import WithProperties
|
2014-12-13 08:39:48 +00:00
|
|
|
from buildbot.schedulers.basic import SingleBranchScheduler, AnyBranchScheduler
|
|
|
|
from buildbot.schedulers.forcesched import ForceScheduler
|
2013-08-01 17:32:44 +00:00
|
|
|
from buildbot.steps.shell import Compile
|
|
|
|
from buildbot.steps.shell import Configure
|
|
|
|
from buildbot.steps.shell import ShellCommand
|
2014-12-13 08:39:48 +00:00
|
|
|
from buildbot.steps.shell import SetPropertyFromCommand
|
|
|
|
from buildbot.steps.source.git import Git
|
|
|
|
from buildbot.changes.filter import ChangeFilter
|
2013-08-01 17:32:44 +00:00
|
|
|
from buildbot.steps.transfer import FileDownload
|
2014-12-13 08:39:48 +00:00
|
|
|
from buildbot.buildslave import BuildSlave
|
2013-08-01 17:32:44 +00:00
|
|
|
from gdbcommand import GdbCatSumfileCommand
|
2014-12-13 08:39:48 +00:00
|
|
|
from json import load
|
2013-08-01 17:32:44 +00:00
|
|
|
|
2014-12-13 08:39:48 +00:00
|
|
|
|
|
|
|
## TODO:
|
|
|
|
##
|
|
|
|
## - Add comments on every function/class
|
|
|
|
## - License stuff (on all files)
|
|
|
|
## - Cross testing (needed?)
|
|
|
|
## - Improve way to store and compare testcases
|
|
|
|
|
|
|
|
|
|
|
|
class DeleteGDBBuildDir (ShellCommand):
|
|
|
|
description = "deleting previous GDB build directory"
|
|
|
|
descriptionDone = "deleted previous GDB build directory"
|
|
|
|
command = ['rm', '-rf', WithProperties ("%s/build", 'builddir')]
|
|
|
|
|
|
|
|
class CloneOrUpdateGDBMasterRepo (Git):
|
|
|
|
description = "fetching GDB master sources"
|
|
|
|
descriptionDone = "fetched GDB master sources"
|
2014-12-14 22:06:44 +00:00
|
|
|
def __init__ (self):
|
2014-12-13 08:39:48 +00:00
|
|
|
Git.__init__ (self,
|
|
|
|
repourl = 'git://sourceware.org/git/binutils-gdb.git',
|
|
|
|
workdir = WithProperties ("%s/../binutils-gdb-master/",
|
|
|
|
'builddir'),
|
2014-12-15 00:19:50 +00:00
|
|
|
retryFetch = True,
|
2014-12-13 08:39:48 +00:00
|
|
|
mode = 'incremental')
|
|
|
|
|
|
|
|
class CloneOrUpdateGDBRepo (Git):
|
|
|
|
description = "fetching GDB sources"
|
|
|
|
descriptionDone = "fetched GDB sources"
|
|
|
|
def __init__ (self):
|
|
|
|
Git.__init__ (self,
|
|
|
|
repourl = 'git://sourceware.org/git/binutils-gdb.git',
|
|
|
|
workdir = WithProperties ('%s/binutils-gdb/', 'builddir'),
|
|
|
|
reference = WithProperties ("%s/../binutils-gdb-master/",
|
2014-12-15 00:19:50 +00:00
|
|
|
'builddir'),
|
|
|
|
retryFetch = True)
|
2014-12-13 08:39:48 +00:00
|
|
|
|
|
|
|
class ConfigureGDB (Configure):
|
|
|
|
description = "configure GDB"
|
|
|
|
descriptionDone = "configured GDB"
|
|
|
|
def __init__ (self, extra_conf_flags, **kwargs):
|
|
|
|
Configure.__init__ (self, **kwargs)
|
|
|
|
self.workdir = WithProperties ("%s", 'builddir')
|
|
|
|
self.command = ['../binutils-gdb/configure',
|
|
|
|
'--enable-targets=all',
|
|
|
|
'--disable-binutils',
|
|
|
|
'--disable-ld',
|
|
|
|
'--disable-gold',
|
2014-12-14 23:35:38 +00:00
|
|
|
'--disable-gas',
|
|
|
|
'--disable-sim',
|
2014-12-13 08:39:48 +00:00
|
|
|
'--disable-gprof'] + extra_conf_flags
|
|
|
|
|
|
|
|
class CompileGDB (Compile):
|
|
|
|
description = "compile GDB"
|
|
|
|
descriptionDone = "compiled GDB"
|
|
|
|
def __init__ (self, extra_make_flags = [], **kwargs):
|
|
|
|
Compile.__init__ (self, **kwargs)
|
|
|
|
self.workdir = WithProperties ("%s", 'builddir')
|
|
|
|
self.command = ['make',
|
|
|
|
WithProperties ("-j%s", 'jobs'),
|
|
|
|
'all'] + extra_make_flags
|
|
|
|
|
|
|
|
class TestGDB (Compile):
|
|
|
|
description = "testing GDB"
|
|
|
|
descriptionDone = "tested GDB"
|
|
|
|
def __init__ (self, extra_make_check_flags = [], test_env = {},
|
2014-12-14 23:35:38 +00:00
|
|
|
**kwargs):
|
2014-12-13 08:39:48 +00:00
|
|
|
Compile.__init__ (self, **kwargs)
|
|
|
|
|
2014-12-14 22:06:44 +00:00
|
|
|
self.workdir = WithProperties ("%s/build/gdb/testsuite", 'builddir')
|
2014-12-13 08:39:48 +00:00
|
|
|
self.command = ['make',
|
|
|
|
'-k',
|
2014-12-14 23:35:38 +00:00
|
|
|
'check'] + extra_make_check_flags
|
|
|
|
|
2014-12-13 08:39:48 +00:00
|
|
|
self.env = test_env
|
|
|
|
# Needed because of dejagnu
|
|
|
|
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
|
|
|
|
|
2014-12-14 23:35:38 +00:00
|
|
|
# Set this to false to disable parallel testing (i.e., do not use
|
|
|
|
# FORCE_PARALLEL)
|
2014-12-13 08:39:48 +00:00
|
|
|
no_test_parallel = False
|
|
|
|
|
2014-12-14 23:35:38 +00:00
|
|
|
# Set this to False to disable using system's debuginfo files
|
|
|
|
# (i.e., do not use '--with-separate-debug-dir')
|
|
|
|
use_system_debuginfo = True
|
|
|
|
|
2014-12-13 08:39:48 +00:00
|
|
|
def __init__ (self, architecture_triplet = []):
|
|
|
|
factory.BuildFactory.__init__ (self)
|
|
|
|
self.addStep (DeleteGDBBuildDir ())
|
2014-12-14 22:06:44 +00:00
|
|
|
self.addStep (CloneOrUpdateGDBMasterRepo ())
|
2014-12-13 08:39:48 +00:00
|
|
|
self.addStep (CloneOrUpdateGDBRepo ())
|
|
|
|
|
|
|
|
if not self.extra_conf_flags:
|
|
|
|
self.extra_conf_flags = []
|
2014-12-14 23:35:38 +00:00
|
|
|
|
|
|
|
if self.use_system_debuginfo:
|
|
|
|
self.extra_conf_flags.append ('--with-separate-debug-dir=/usr/lib/debug')
|
|
|
|
|
2014-12-13 08:39:48 +00:00
|
|
|
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 = {}
|
|
|
|
|
2014-12-14 23:35:38 +00:00
|
|
|
if not self.no_test_parallel:
|
|
|
|
self.extra_make_check_flags.append (WithProperties ("-j%s", 'jobs'))
|
|
|
|
self.extra_make_check_flags.append ('FORCE_PARALLEL=1')
|
|
|
|
|
|
|
|
self.addStep (self.TestClass (self.extra_make_check_flags, self.test_env))
|
|
|
|
|
|
|
|
self.addStep (GdbCatSumfileCommand (workdir = WithProperties ('%s/build/gdb/testsuite',
|
|
|
|
'builddir'),
|
|
|
|
description = 'analyze test results'))
|
2014-12-13 08:39:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RunTestGDBPlain_c64t64 (BuildAndTestGDBFactory):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class RunTestGDBPlain_c32t32 (BuildAndTestGDBFactory):
|
2014-12-14 22:06:44 +00:00
|
|
|
extra_conf_flags = [ 'CFLAGS=-m32' ]
|
2014-12-13 08:39:48 +00:00
|
|
|
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):
|
|
|
|
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):
|
2014-12-16 02:27:30 +00:00
|
|
|
extra_make_check_flags = [ WithProperties ('CC_FOR_TARGET=/bin/sh %s/binutils-gdb/gdb/contrib/cc-with-tweaks.sh -i gcc', 'builddir'),
|
|
|
|
WithProperties ('CXX_FOR_TARGET=/bin/sh %s/binutils-gdb/gdb/contrib/cc-with-tweaks.sh -i g++', 'builddir') ]
|
2014-12-13 08:39:48 +00:00
|
|
|
|
|
|
|
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')]
|
2014-12-16 04:36:14 +00:00
|
|
|
s['properties'] = { 'isTryBuilder' : 'no' }
|
2014-12-13 08:39:48 +00:00
|
|
|
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:
|
2014-12-13 09:00:39 +00:00
|
|
|
arch_triplet = [ b.pop ('arch_triplet') ]
|
2014-12-13 08:39:48 +00:00
|
|
|
else:
|
2014-12-13 08:58:58 +00:00
|
|
|
arch_triplet = []
|
2014-12-13 08:39:48 +00:00
|
|
|
btype = b.pop ('type')
|
|
|
|
factory = globals ()[ "RunTestGDB%s" % btype ]
|
|
|
|
b['factory'] = factory (arch_triplet)
|
|
|
|
c['builders'].append (b)
|