Moving everything from lib/gdbbuilder.py into master.cfg; adding lots of comments.
This commit is contained in:
parent
1159ea34bf
commit
9d40e455f3
1 changed files with 361 additions and 72 deletions
433
master.cfg
433
master.cfg
|
@ -1,42 +1,52 @@
|
|||
# -*- python -*-
|
||||
# ex: set syntax=python:
|
||||
|
||||
#from gdbbuilder import make_gdb_builder
|
||||
from gdbbuilder import load_config
|
||||
|
||||
from buildbot.schedulers.basic import SingleBranchScheduler, AnyBranchScheduler
|
||||
from buildbot.schedulers.forcesched import ForceScheduler
|
||||
from buildbot.process import factory
|
||||
from buildbot.process.properties import WithProperties
|
||||
from buildbot.steps.shell import Compile
|
||||
from buildbot.steps.shell import Configure
|
||||
from buildbot.steps.shell import ShellCommand
|
||||
from buildbot.steps.shell import SetPropertyFromCommand
|
||||
from buildbot.steps.source.git import Git
|
||||
from buildbot.changes.filter import ChangeFilter
|
||||
from buildbot.buildslave import BuildSlave
|
||||
from gdbcommand import GdbCatSumfileCommand
|
||||
|
||||
from sumfiles import DejaResults, set_web_base
|
||||
import os.path
|
||||
import urllib
|
||||
from json import load
|
||||
import random
|
||||
|
||||
# This is a sample buildmaster config file. It must be installed as
|
||||
# 'master.cfg' in your buildmaster's base directory.
|
||||
####################################
|
||||
####################################
|
||||
#### GDB BuildBot Configuration ####
|
||||
####################################
|
||||
####################################
|
||||
|
||||
# This is the dictionary that the buildmaster pays attention to. We also use
|
||||
# a shorter alias to save typing.
|
||||
###############################
|
||||
#### General Configuration ####
|
||||
###############################
|
||||
|
||||
# This is the dictionary that the buildmaster pays attention to. We
|
||||
# also use a shorter alias to save typing.
|
||||
c = BuildmasterConfig = {}
|
||||
|
||||
####### BUILDSLAVES
|
||||
|
||||
# The 'slaves' list defines the set of recognized buildslaves. Each element is
|
||||
# a BuildSlave object, specifying a unique slave name and password. The same
|
||||
# slave name and password must be configured on the slave.
|
||||
|
||||
# Base directory for the web server.
|
||||
# Base directory for the web server. This is needed in order to
|
||||
# compare the test results.
|
||||
gdb_web_base = os.path.expanduser(os.path.join(basedir, 'public_html',
|
||||
'results'))
|
||||
set_web_base (gdb_web_base)
|
||||
|
||||
# 'protocols' contains information about protocols which master will use for
|
||||
# communicating with slaves.
|
||||
# You must define at least 'port' option that slaves could connect to your master
|
||||
# with this protocol.
|
||||
# 'port' must match the value configured into the buildslaves (with their
|
||||
# --master option)
|
||||
c['protocols'] = {'pb': {'port': 9989}}
|
||||
|
||||
####### CHANGESOURCES
|
||||
|
||||
# the 'change_source' setting tells the buildmaster how it should find out
|
||||
# about source code changes. Here we point to the buildbot clone of pyflakes.
|
||||
# about source code changes.
|
||||
|
||||
from buildbot.changes.gitpoller import GitPoller
|
||||
c['change_source'] = []
|
||||
|
@ -46,42 +56,6 @@ c['change_source'].append(GitPoller(
|
|||
branches= [ 'master' ],
|
||||
pollinterval=30))
|
||||
|
||||
####### SCHEDULERS
|
||||
|
||||
# Configure the Schedulers, which decide how to react to incoming changes. In this
|
||||
# case, just kick off a 'runtests' build
|
||||
|
||||
from buildbot.schedulers.basic import SingleBranchScheduler, AnyBranchScheduler
|
||||
from buildbot.schedulers.forcesched import ForceScheduler
|
||||
from buildbot.changes import filter
|
||||
|
||||
####### BUILDERS
|
||||
|
||||
# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
|
||||
# what steps, and which slaves can execute them. Note that any particular build will
|
||||
# only take place on one slave.
|
||||
|
||||
from buildbot.process.factory import BuildFactory
|
||||
from buildbot.steps.source.git import Git
|
||||
from buildbot.steps.shell import ShellCommand
|
||||
|
||||
#factory = BuildFactory()
|
||||
# check out the source
|
||||
#factory.addStep(Git(repourl='git://github.com/buildbot/pyflakes.git', mode='incremental'))
|
||||
# run the tests (note that this will require that 'trial' is installed)
|
||||
#factory.addStep(ShellCommand(command=["trial", "pyflakes"]))
|
||||
|
||||
from buildbot.config import BuilderConfig
|
||||
|
||||
#c['builders'] = all_gdb_builders
|
||||
#c['builders'] = []
|
||||
#c['builders'].append(
|
||||
# BuilderConfig(name="runtests",
|
||||
# slavenames=["example-slave"],
|
||||
# factory=factory))
|
||||
|
||||
####### STATUS TARGETS
|
||||
|
||||
# 'status' is a list of Status Targets. The results of each build will be
|
||||
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
|
||||
# including web pages, email senders, and IRC bots.
|
||||
|
@ -130,29 +104,344 @@ c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
|
|||
|
||||
#c['status'].append(mn)
|
||||
|
||||
####### PROJECT IDENTITY
|
||||
|
||||
# the 'title' string will appear at the top of this buildbot
|
||||
# installation's html.WebStatus home page (linked to the
|
||||
# 'titleURL') and is embedded in the title of the waterfall HTML page.
|
||||
|
||||
c['title'] = "GDB"
|
||||
c['titleURL'] = "https://gnu.org/s/gdb"
|
||||
|
||||
# the 'buildbotURL' string should point to the location where the buildbot's
|
||||
# internal web server (usually the html.WebStatus page) is visible. This
|
||||
# typically uses the port number set in the Waterfall 'status' entry, but
|
||||
# with an externally-visible host name which the buildbot cannot figure out
|
||||
# without some help.
|
||||
|
||||
c['buildbotURL'] = "http://localhost:8010/"
|
||||
|
||||
####### DB URL
|
||||
|
||||
c['db'] = {
|
||||
# This specifies what database buildbot uses to store its state. You can leave
|
||||
# this at its default for all but the largest installations.
|
||||
'db_url' : "sqlite:///state.sqlite",
|
||||
}
|
||||
|
||||
#####################
|
||||
#### Build steps ####
|
||||
#####################
|
||||
|
||||
## This is where we define our build steps. A build step is some
|
||||
## command/action that buildbot will perform while building GDB. See
|
||||
## the documentation on each build step class to understand what it
|
||||
## does.
|
||||
|
||||
class DeleteGDBBuildDir (ShellCommand):
|
||||
"""This build step is responsible for removing the build directory
|
||||
from previous builds. It uses the 'builddir' property in order to
|
||||
figure out which directory to remove."""
|
||||
description = "deleting previous GDB build directory"
|
||||
descriptionDone = "deleted previous GDB build directory"
|
||||
command = ['rm', '-rf', WithProperties ("%s/build", 'builddir')]
|
||||
|
||||
class RandomWaitForClone (ShellCommand):
|
||||
"""This build step is responsible for waiting a random number of
|
||||
seconds before trying to update the local git repository. This is a
|
||||
hack, and is needed because sourceware imposes a load average when one
|
||||
tries to update more than 3 repositories at the same time. An obvious
|
||||
FIXME for this would be to have a git mirror somewhere where we could
|
||||
do more than 3 updates at a time."""
|
||||
description = "randomly waiting before git fetching"
|
||||
descriptionDone = "waited before git fetching"
|
||||
command = ['sleep', WithProperties ("%ss", 'randomWait')]
|
||||
|
||||
class CloneOrUpdateGDBMasterRepo (Git):
|
||||
"""This build step updates the so-called "master" git repository. For
|
||||
each buildslave, we have one master GDB git repository, which is then
|
||||
used to create each builder's GDB git repository. In other words,
|
||||
each builder inside a buildslave will have something like:
|
||||
|
||||
-- master GDB git repo
|
||||
|
|
||||
|---- builder X
|
||||
|
|
||||
|-- GDB git repo (clone from the master above)
|
||||
|
|
||||
|----- builder Y
|
||||
|
|
||||
|-- GDB git repo (clone from the master above)
|
||||
|
||||
and so on. This layout helps us to save some when fetching changes
|
||||
from the principal repository."""
|
||||
description = "fetching GDB master sources"
|
||||
descriptionDone = "fetched GDB master sources"
|
||||
def __init__ (self):
|
||||
Git.__init__ (self,
|
||||
repourl = 'git://sourceware.org/git/binutils-gdb.git',
|
||||
workdir = WithProperties ("%s/../binutils-gdb-master/",
|
||||
'builddir'),
|
||||
retryFetch = True,
|
||||
mode = 'incremental')
|
||||
self.haltOnFailure = False
|
||||
self.flunkOnFailure = False
|
||||
|
||||
class CloneOrUpdateGDBRepo (Git):
|
||||
"""This build step is used to clone the GDB git repository that will
|
||||
be used by an specific builder (inside a buildslave). The trick here
|
||||
is to use the "reference" parameter to initialize the class, which
|
||||
makes BuildBot clone the git repository mostly using the objects
|
||||
present at the reference repository (i.e., locally)."""
|
||||
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/",
|
||||
'builddir'),
|
||||
retryFetch = True)
|
||||
|
||||
class ConfigureGDB (Configure):
|
||||
"""This build step runs the GDB "configure" command, providing extra
|
||||
flags for it if needed."""
|
||||
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',
|
||||
'--disable-gas',
|
||||
'--disable-sim',
|
||||
'--disable-gprof'] + extra_conf_flags
|
||||
|
||||
class CompileGDB (Compile):
|
||||
"""This build step runs "make" to compile the GDB sources. It
|
||||
provides extra "make" flags to "make" if needed. It also uses the
|
||||
"jobs" properties to figure out how many parallel jobs we can use when
|
||||
compiling GDB; this is the "-j" flag for "make". The value of the
|
||||
"jobs" property is set at the "config.json" file, for each
|
||||
buildslave."""
|
||||
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):
|
||||
"""This build step runs the full testsuite for GDB. It can run in
|
||||
parallel mode (see BuildAndTestGDBFactory below), and it will also
|
||||
provide any extra flags for "make" if needed. Unfortunately, because
|
||||
our testsuite is not perfect (yet), this command must not make
|
||||
BuildBot halt on failure."""
|
||||
description = "testing GDB"
|
||||
descriptionDone = "tested GDB"
|
||||
def __init__ (self, extra_make_check_flags = [], test_env = {},
|
||||
**kwargs):
|
||||
Compile.__init__ (self, **kwargs)
|
||||
|
||||
self.workdir = WithProperties ("%s/build/gdb/testsuite", 'builddir')
|
||||
self.command = ['make',
|
||||
'-k',
|
||||
'check'] + extra_make_check_flags
|
||||
|
||||
self.env = test_env
|
||||
# Needed because of dejagnu
|
||||
self.haltOnFailure = False
|
||||
self.flunkOnFailure = False
|
||||
|
||||
|
||||
#######################
|
||||
#### Build Factory ####
|
||||
#######################
|
||||
|
||||
## This is where our Build Factory is defined. A build factory is a
|
||||
## description of the build process, which is made in terms of build
|
||||
## steps. The BuildAndTestGDBFactory is the main build factory for
|
||||
## GDB; it is configurable and should be more than enough to describe
|
||||
## most builds.
|
||||
|
||||
class BuildAndTestGDBFactory (factory.BuildFactory):
|
||||
"""This is the main build factory for the GDB project. It was made to be very configurable, and should be enough to describe most builds. The parameters of the class are:
|
||||
|
||||
- ConfigureClass: set this to be the class (i.e., build step) that
|
||||
will be called to configure GDB. It needs to accept the same
|
||||
arguments as the ConfigureGDB class above. The default is to
|
||||
use ConfigureGDB.
|
||||
|
||||
- CompileClass: set this to be the class (i.e., build step) that
|
||||
will be called to compile GDB. It needs to accept the same
|
||||
arguments as the CompileGDB class above. The default is to use
|
||||
CompileGDB.
|
||||
|
||||
- TestClass: set this to be the class (i.e., build step) that will
|
||||
be called to test GDB. It needs to accept the same arguments as
|
||||
the TestGDB class above. The default is to use TestGDB.
|
||||
|
||||
- extra_conf_flags: extra flags to be passed to "configure".
|
||||
Should be a list (i.e., []). The default is None.
|
||||
|
||||
- extra_make_flags: extra flags to be passed to "make", when
|
||||
compiling. Should be a list (i.e., []). The default is None.
|
||||
|
||||
- extra_make_check_flags: extra flags to be passed to "make
|
||||
check", when testing. Should be a list (i.e., []). The default
|
||||
is None.
|
||||
|
||||
- test_env: extra environment variables to be passed to "make
|
||||
check", when testing. Should be a dictionary (i.e., {}). The
|
||||
default is None.
|
||||
|
||||
- no_test_parallel: set to True if the test shall not be
|
||||
parallelized. Default is False.
|
||||
|
||||
- use_system_debuginfo: set to False if GDB should be compiled
|
||||
with the "--with-separate-debug-dir" option set to
|
||||
"/usr/lib/debug". Default is True.
|
||||
|
||||
"""
|
||||
ConfigureClass = ConfigureGDB
|
||||
CompileClass = CompileGDB
|
||||
TestClass = TestGDB
|
||||
|
||||
extra_conf_flags = None
|
||||
extra_make_flags = None
|
||||
extra_make_check_flags = None
|
||||
test_env = None
|
||||
|
||||
# Set this to false to disable parallel testing (i.e., do not use
|
||||
# FORCE_PARALLEL)
|
||||
no_test_parallel = False
|
||||
|
||||
# Set this to False to disable using system's debuginfo files
|
||||
# (i.e., do not use '--with-separate-debug-dir')
|
||||
use_system_debuginfo = True
|
||||
|
||||
def __init__ (self, architecture_triplet = []):
|
||||
factory.BuildFactory.__init__ (self)
|
||||
self.addStep (DeleteGDBBuildDir ())
|
||||
# Unfortunately we need to have this random wait, otherwise
|
||||
# git fetch won't work
|
||||
self.addStep (RandomWaitForClone ())
|
||||
self.addStep (CloneOrUpdateGDBMasterRepo ())
|
||||
self.addStep (CloneOrUpdateGDBRepo ())
|
||||
|
||||
if not self.extra_conf_flags:
|
||||
self.extra_conf_flags = []
|
||||
|
||||
if self.use_system_debuginfo:
|
||||
self.extra_conf_flags.append ('--with-separate-debug-dir=/usr/lib/debug')
|
||||
|
||||
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 = {}
|
||||
|
||||
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'))
|
||||
|
||||
|
||||
##################
|
||||
#### Builders ####
|
||||
##################
|
||||
|
||||
## This section describes our builders. The builders are instances of
|
||||
## a build factory, and they will be used to do a specific build of
|
||||
## the project.
|
||||
##
|
||||
## The nomenclature here is important. Every builder should start
|
||||
## with the prefix "RunTestGDB", and then be followed by the testing
|
||||
## scenario that the build will test, followed by "_cXXtYY", where XX
|
||||
## is the bitness of the compilation, and YY is the bitness of the
|
||||
## testing. So, for example, if we are specifically testing GDB
|
||||
## running the native-gdbserver tests, compiling GDB on a 64-bit
|
||||
## machine, but running the tests in 32-bit mode, our builder would be called:
|
||||
##
|
||||
## RunTestGDBNativeGDBServer_c64t32
|
||||
|
||||
class RunTestGDBPlain_c64t64 (BuildAndTestGDBFactory):
|
||||
"""Compiling for 64-bit, testing on 64-bit."""
|
||||
pass
|
||||
|
||||
class RunTestGDBPlain_c32t32 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 32-bit, testing on 32-bit."""
|
||||
extra_conf_flags = [ 'CFLAGS=-m32' ]
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board unix/-m32' ]
|
||||
|
||||
class RunTestGDBm32_c64t32 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 64-bit, testing on 32-bit."""
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board unix/-m32' ]
|
||||
|
||||
class RunTestGDBNativeGDBServer_c64t64 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 64-bit, testing native-gdbserver on 64-bit."""
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-gdbserver' ]
|
||||
|
||||
class RunTestGDBNativeGDBServer_c64t32 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 64-bit, testing native-gdbserver on 32-bit."""
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-gdbserver/-m32' ]
|
||||
|
||||
class RunTestGDBNativeExtendedGDBServer_c64t64 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 64-bit, testing native-extended-gdbserver on 64-bit."""
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-extended-gdbserver' ]
|
||||
|
||||
class RunTestGDBNativeExtendedGDBServer_c64t32 (BuildAndTestGDBFactory):
|
||||
"""Compiling on 64-bit, testing native-extended-gdbserver on 32-bit."""
|
||||
extra_make_check_flags = [ 'RUNTESTFLAGS=--target_board native-extended-gdbserver/-m32' ]
|
||||
|
||||
class RunTestGDBIndexBuild (BuildAndTestGDBFactory):
|
||||
"""Testing with the "cc-with-tweaks.sh" passing -i. FIXME: include bitness here."""
|
||||
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') ]
|
||||
|
||||
|
||||
# For now, we only support testing the "master" branch.
|
||||
master_filter = ChangeFilter (branch = [ 'master' ])
|
||||
|
||||
###############################
|
||||
#### Configuration loading ####
|
||||
###############################
|
||||
|
||||
## This is "the heart" of this file. This function is responsible for
|
||||
## loading the configuration present in the "lib/config.json" file,
|
||||
## and initializing everything needed for BuildBot to work. Most of
|
||||
## this function was copied from WebKit's BuildBot configuration, with
|
||||
## lots of tweaks.
|
||||
|
||||
def load_config (c):
|
||||
config = load (open ("lib/config.json"))
|
||||
passwd = load (open ("lib/passwords.json"))
|
||||
|
||||
random.seed ()
|
||||
c['slaves'] = [BuildSlave (slave['name'], passwd[slave['name']],
|
||||
max_builds = 1,
|
||||
properties = { 'jobs' : slave['jobs'],
|
||||
'randomWait' : "%d" % random.randrange (1, 30) })
|
||||
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 = []
|
||||
btype = b.pop ('type')
|
||||
factory = globals ()[ "RunTestGDB%s" % btype ]
|
||||
b['factory'] = factory (arch_triplet)
|
||||
c['builders'].append (b)
|
||||
|
||||
load_config (c)
|
||||
|
|
Loading…
Reference in a new issue