<commit_before># -*- python -*-
# ex: set syntax=python:

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').

# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .


# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

def readpass(fn):
    return open("passwords/" + fn).read().strip()

####### BUILDSLAVES

# the 'slaves' list defines the set of allowable buildslaves. Each element is
# a BuildSlave object, which is created with bot-name, bot-password.  These
# correspond to values given to the buildslave's mktap invocation.
from buildbot.buildslave import BuildSlave

c['slaves'] = [BuildSlave("ubuntu", readpass("<PASSWORD>"), max_builds=1)]

# to limit to two concurrent builds on a slave, use
#  c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)]


# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)

c['slavePortnum'] = 9989

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.

from buildbot.changes.pb import PBChangeSource
c['change_source'] = PBChangeSource()

# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
#pb = ConfigurationSet([
#    (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)),
#    ])

# then you could use the following buildmaster Change Source to subscribe to
# the FreshCVS daemon and be notified on every commit:
#
#from buildbot.changes.freshcvs import FreshCVSSource
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar")
#c['change_source'] = fc_source

# or, use a PBChangeSource, and then have your repository's commit script run
# 'buildbot sendchange', or use contrib/svn_buildbot.py, or
# contrib/arch_buildbot.py :
#
#from buildbot.changes.pb import PBChangeSource
#c['change_source'] = PBChangeSource()

# If you wat to use SVNPoller, it might look something like
#  # Where to get source code changes
# from buildbot.changes.svnpoller import SVNPoller
# source_code_svn_url='https://svn.myproject.org/bluejay/trunk'
# svn_poller = SVNPoller(
#                    svnurl=source_code_svn_url,
#                    pollinterval=60*60, # seconds
#                    histmax=10,
#                    svnbin='/usr/bin/svn',
## )
# c['sources'] = [ svn_poller ]

####### SCHEDULERS
 
## configure the Schedulers

from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch="develop",
                                 treeStableTimer=2*60,
                                 builderNames=["naali-ubuntu-incremental"]))

####### BUILDERS

# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
#  name (required): the name used to describe this builder
#  slavename (required): which slave to use (must appear in c['bots'])
#  builddir (required): which subdirectory to run the builder in
#  factory (required): a BuildFactory to define how the build is run
#  periodicBuildTime (optional): if set, force a build every N seconds

# buildbot/process/factory.py provides several BuildFactory classes you can
# start with, which implement build processes for common targets (GNU
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the
# base class, and is configured with a series of BuildSteps. When the build
# is run, the appropriate buildslave is told to execute each Step in turn.

# the first BuildStep is typically responsible for obtaining a copy of the
# sources. There are source-obtaining Steps in buildbot/steps/source.py for
# CVS, SVN, and others.

from buildbot.process import factory
from buildbot.steps.source import Git
from buildbot.steps.shell import Configure, Compile, Test, ShellCommand
from buildbot.steps.python_twisted import Trial

from twisted.python import log
import os

class NaaliTest(Test):
    warningPattern = r'(?i)^Traceback .*:|.*\bexception\b'

    testscript="""
    echo '[apitest.testrunner.TestCreateDestroy]' > bin/pymodules/tests.ini
    export DISPLAY=:0
    cd bin
    ulimit -c unlimited
    rm -f core
    ./viewer
    s=$?
    if test -f core; then
      nn=core.$(date --iso=seconds)
      mv core $nn
      gdb -q -batch -ex backtrace viewer $nn 
      gzip $nn &
    fi
    exit $s
    """

    def __init__(self, *args, **kwargs):
        kwargs["command"] = ["bash", "-c", self.testscript]
        Test.__init__(self, *args, **kwargs)
            
f1 = factory.BuildFactory()
f1.addStep(Git(repourl="git://github.com/realXtend/naali.git", branch="develop"))
f1.addStep(ShellCommand(command=["bash", "-c", "rm -f CMakeOptionalModules.txt bin/viewer bin/modules/core/*.{so,xml}"]))
f1.addStep(Compile(command=["bash", "tools/build-ubuntu-deps.bash"]))
#f1.addStep(Trial(testChanges=True, testpath="."))
f1.addStep(NaaliTest())
b1 = {'name': "naali-ubuntu-incremental",
      'slavename': "ubuntu",
      'builddir': "inc1",
      'factory': f1,
      }

f2 = factory.BuildFactory()
f2.addStep(Git(repourl="git://github.com/realXtend/naali.git", branch="NaaliCore"))
f2.addStep(ShellCommand(command=["bash", "-c", "rm -f CMakeOptionalModules.txt bin/viewer bin/modules/core/*.{so,xml}"]))
f2.addStep(Compile(command=["bash", "tools/build-ubuntu-deps.bash"]))
#f2.addStep(Trial(testChanges=True, testpath="."))
f2.addStep(NaaliTest())
b2 = {'name': "naali-ubuntu-incremental-naalicore",
      'slavename': "ubuntu",
      'builddir': "inc-naalicore",
      'factory': f2,
      }
<commit_msg>update buildbot config<commit_after># -*- python -*-
# ex: set syntax=python:

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').

# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .


# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

def readpass(fn):
    return open("passwords/" + fn).read().strip()

####### BUILDSLAVES

# the 'slaves' list defines the set of allowable buildslaves. Each element is
# a BuildSlave object, which is created with bot-name, bot-password.  These
# correspond to values given to the buildslave's mktap invocation.
from buildbot.buildslave import BuildSlave

c['slaves'] = [BuildSlave("ubuntu", readpass("ubuntu-slave"), max_builds=1)]

# to limit to two concurrent builds on a slave, use
#  c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)]


# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)

c['slavePortnum'] = 9989

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.

from buildbot.changes.pb import PBChangeSource
c['change_source'] = PBChangeSource()

# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
#pb = ConfigurationSet([
#    (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)),
#    ])

# then you could use the following buildmaster Change Source to subscribe to
# the FreshCVS daemon and be notified on every commit:
#
#from buildbot.changes.freshcvs import FreshCVSSource
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar")
#c['change_source'] = fc_source

# or, use a PBChangeSource, and then have your repository's commit script run
# 'buildbot sendchange', or use contrib/svn_buildbot.py, or
# contrib/arch_buildbot.py :
#
#from buildbot.changes.pb import PBChangeSource
#c['change_source'] = PBChangeSource()

# If you wat to use SVNPoller, it might look something like
#  # Where to get source code changes
# from buildbot.changes.svnpoller import SVNPoller
# source_code_svn_url='https://svn.myproject.org/bluejay/trunk'
# svn_poller = SVNPoller(
#                    svnurl=source_code_svn_url,
#                    pollinterval=60*60, # seconds
#                    histmax=10,
#                    svnbin='/usr/bin/svn',
## )
# c['sources'] = [ svn_poller ]

####### SCHEDULERS
 
## configure the Schedulers

from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="develop", branch="develop",
                                 treeStableTimer=2*60,
                                 builderNames=["naali-ubuntu-incremental"]))
c['schedulers'].append(Scheduler(name="tundra", branch="tundra",
                                 treeStableTimer=2*60,
                                 builderNames=["tundra-ubuntu-incremental"]))

####### BUILDERS

# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
#  name (required): the name used to describe this builder
#  slavename (required): which slave to use (must appear in c['bots'])
#  builddir (required): which subdirectory to run the builder in
#  factory (required): a BuildFactory to define how the build is run
#  periodicBuildTime (optional): if set, force a build every N seconds

# buildbot/process/factory.py provides several BuildFactory classes you can
# start with, which implement build processes for common targets (GNU
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the
# base class, and is configured with a series of BuildSteps. When the build
# is run, the appropriate buildslave is told to execute each Step in turn.

# the first BuildStep is typically responsible for obtaining a copy of the
# sources. There are source-obtaining Steps in buildbot/steps/source.py for
# CVS, SVN, and others.

from buildbot.process import factory
from buildbot.steps.source import Git
from buildbot.steps.shell import Configure, Compile, Test, ShellCommand
from buildbot.steps.python_twisted import Trial
from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, STDOUT, STDERR
from twisted.python import log
import os

class NaaliTest(Test):
    warningPattern = r'(?i)^Traceback .*:|.*\bexception\b'

    testscript="""
    echo '[apitest.testrunner.TestCreateDestroy]' > bin/pymodules/tests.ini
    export DISPLAY=:0
    cd bin
    ulimit -c unlimited
    ulimit -t 120 # seconds of cpu time
    rm -f core
    ./viewer
    s=$?
    if test -f core; then
      nn=core.$(date --iso=seconds)
      mv core $nn
      gdb -q -batch -ex backtrace viewer $nn 
      gzip $nn &
    fi
    exit $s
    """

    def __init__(self, *args, **kwargs):
        kwargs["command"] = ["bash", "-c", self.testscript]
        Test.__init__(self, *args, **kwargs)


    def evaluateCommand(self, cmd):
        rc = Test.evaluateCommand(self, cmd)
        test_stdio = self.getLog('stdio').getText()
        if 'test state: failure' in test_stdio.lower():
            return FAILURE
        else:
            return rc
            
f1 = factory.BuildFactory()
f1.addStep(Git(repourl="git://github.com/realXtend/naali.git", branch="develop"))
f1.addStep(ShellCommand(command=["bash", "-c", "rm -f CMakeBuildConfig.txt CMakeOptionalModules.txt bin/viewer bin/modules/core/*.{so,xml}"]))
f1.addStep(Compile(command=["bash", "tools/build-ubuntu-deps.bash"]))
#f1.addStep(Trial(testChanges=True, testpath="."))
f1.addStep(NaaliTest())
b1 = {'name': "naali-ubuntu-incremental",
      'slavename': "ubuntu",
      'builddir': "inc1",
      'factory': f1,
      }

f2 = factory.BuildFactory()
f2.addStep(Git(repourl="git://github.com/realXtend/naali.git", branch="tundra"))
f2.addStep(ShellCommand(command=["bash", "-c", "rm -f CMakeBuildConfig.txt CMakeOptionalModules.txt bin/viewer bin/modules/core/*.{so,xml}"]))
f2.addStep(Compile(command=["bash", "tools/build-ubuntu-deps.bash"]))
#f2.addStep(Trial(testChanges=True, testpath="."))
#f2.addStep(NaaliTest())
b2 = {'name': "tundra-ubuntu-incremental",
      'slavename': "ubuntu",
      'builddir': "inc-tundra",
      'factory': f2,
      }

{'fraction_non_alphanumeric': 0.12124522119060623, 'fraction_numerical': 0.007177966762893033, 'mean_word_length': 3.8793300342596115, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1847893', 'n_tokens_mistral': 4112, 'n_tokens_neox': 3925, 'n_words': 1258}