aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/qa/docker/buildbot.cfg
blob: b2063ac9ca3b47a31cfe26d98f85c8e893715f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# -*- 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.

# 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.
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("buildslave", "Suridocker")]

# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
# 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.  Here we point to the buildbot clone of pyflakes.

from buildbot.changes.gitpoller import GitPoller
c['change_source'] = []
c['change_source'].append(GitPoller(
        '/data/oisf/.git/',
        workdir='gitpoller-workdir', branches = ['master'],
        pollinterval=300, project='suricata'))

####### 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
#from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.changes import filter
c['schedulers'] = []
c['schedulers'].append(SingleBranchScheduler(
                            name="master",
                            change_filter=filter.ChangeFilter(branch='master'),
                            treeStableTimer=None,
                            builderNames=["features","profiling","clang"]))

#c['schedulers'].append(ForceScheduler(
#                            name="force",
#                            builderNames=["builds","debug"]))

####### 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.source import Git
from buildbot.steps.shell import ShellCommand

def SuriBuildFactory(repo='/data/oisf/'):
    factory = BuildFactory()
    factory.addStep(Git(repourl=repo, mode='copy'))
    factory.addStep(ShellCommand(command=["rm", "-rf", "libhtp"]))
    factory.addStep(ShellCommand(command=["git", "clone", "-b", "0.5.x", "/data/oisf/libhtp/.git/", "libhtp"]))
    return factory

factory = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory.addStep(ShellCommand(command=["./autogen.sh"]))
factory.addStep(ShellCommand(command=["./configure"]))
factory.addStep(ShellCommand(command=["make"]))
factory.addStep(ShellCommand(command=["make", "clean"]))
#factory.addStep(ShellCommand(command=["make", "distcheck"]))

factory_devel = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_devel.addStep(ShellCommand(command=["./autogen.sh"]))
factory_devel.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests"]))
factory_devel.addStep(ShellCommand(command=["make"]))
factory_devel.addStep(ShellCommand(command=["make", "clean"]))
#factory_devel.addStep(ShellCommand(command=["make", "distcheck"], env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-unittests"}))

factory_profiling = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_profiling.addStep(ShellCommand(command=["./autogen.sh"]))
factory_profiling.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-profiling","--enable-unittests"]))
factory_profiling.addStep(ShellCommand(command=["make"]))
factory_profiling.addStep(ShellCommand(command=["make", "clean"]))
#factory_profiling.addStep(ShellCommand(command=["make", "distcheck"],env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-profiling --enable-unittests"}))

factory_clang = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_clang.addStep(ShellCommand(command=["./autogen.sh"]))
#factory_clang.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","CFLAGS=-fsanitize=address"]))
factory_clang.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","ac_cv_func_malloc_0_nonnull=yes","ac_cv_func_realloc_0_nonnull=yes"]))
factory_clang.addStep(ShellCommand(command=["make"]))
factory_clang.addStep(ShellCommand(command=["make", "clean"]))

factory_clang_32 = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_clang_32.addStep(ShellCommand(command=["./autogen.sh"]))
factory_clang_32.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","CFLAGS=-fsanitize=address","ac_cv_func_malloc_0_nonnull=yes","ac_cv_func_realloc_0_nonnull=yes"]))
factory_clang_32.addStep(ShellCommand(command=["make"]))
factory_clang_32.addStep(ShellCommand(command=["make", "clean"]))

factory_features = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_features.addStep(ShellCommand(command=["./autogen.sh"]))
factory_features.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","--enable-nfqueue","--enable-nflog", "--enable-lua", "--enable-prelude"]))
factory_features.addStep(ShellCommand(command=["make"]))
factory_features.addStep(ShellCommand(command=["make", "clean"]))
import psutil
factory_features.addStep(ShellCommand(command=["make", "distcheck"],env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-unittests --enable-nfqueue --enable-nflog --enable-lua --enable-prelude", "CONCURRENCY_LEVEL": str(psutil.cpu_count())}))

import os
PCAP_PATH='/data/oisf/qa/docker/pcaps/'
(_, _, pcaps_list) = os.walk(PCAP_PATH).next()
pcaps_list = [ os.path.join(PCAP_PATH, pcap) for pcap in pcaps_list if pcap.endswith(".pcap") ]

factory_stress_pcap = SuriBuildFactory()
# run the tests (note that this will require that 'trial' is installed)
factory_stress_pcap.addStep(ShellCommand(command=["./autogen.sh"]))
factory_stress_pcap.addStep(ShellCommand(command=["./configure","--enable-debug-validation"],env={"CFLAGS" : "-fsanitize=address -fno-omit-frame-pointer"}))
factory_stress_pcap.addStep(ShellCommand(command=["make"]))
factory_stress_pcap.addStep(ShellCommand(command=["sudo", "make","install"]))
factory_stress_pcap.addStep(ShellCommand(command=["sudo", "rm", "-f", "/usr/local/etc/suricata/suricata.yaml"]))
factory_stress_pcap.addStep(ShellCommand(command=["sudo", "make","install-conf"]))
factory_stress_pcap.addStep(ShellCommand(command=["make","clean"]))
factory_stress_pcap.addStep(ShellCommand(command=["sudo", "ldconfig"]))
for pfile in pcaps_list:
    factory_stress_pcap.addStep(ShellCommand(command=["sudo", "/usr/local/bin/suricata","-r",pfile,"--init-errors-fatal","-S","/data/oisf/rules/http-events.rules"]))
factory_stress_pcap.addStep(ShellCommand(command=["sudo", "rm", "-rf", "/usr/local/var/log/suricata/"]))

from buildbot.config import BuilderConfig

def SuriBuilderConfig(*args, **kwargs):
    if not kwargs.has_key('category'):
        kwargs['category']='default'
    return BuilderConfig(*args, **kwargs)

c['builders'] = []

c['builders'].append(
    SuriBuilderConfig(name="gcc",
      slavename="buildslave",
      factory=factory))
c['schedulers'].append(SingleBranchScheduler(
                            name="build",
                            change_filter=filter.ChangeFilter(branch='master'),
                            treeStableTimer=None,
                            builderNames=["gcc"]))

c['builders'].append(
    SuriBuilderConfig(name="debug",
      slavename="buildslave",
      factory=factory_devel))
c['schedulers'].append(SingleBranchScheduler(
                            name="debug",
                            change_filter=filter.ChangeFilter(branch='master'),
                            treeStableTimer=None,
                            builderNames=["debug"]))

c['builders'].append(
    SuriBuilderConfig(name="profiling",
      slavename="buildslave",
      factory=factory_profiling))
c['builders'].append(
    SuriBuilderConfig(name="clang",
      slavename="buildslave",
      factory=factory_clang_32))
c['builders'].append(
    SuriBuilderConfig(name="features",
      slavename="buildslave",
      factory=factory_features))
c['builders'].append(
    SuriBuilderConfig(name="pcaps",
      slavename="buildslave",
      factory=factory_stress_pcap))

from buildbot import locks
build_lock = locks.SlaveLock("slave_builds", maxCount = 1)


from buildbot.schedulers.forcesched import *
c['schedulers'].append(ForceScheduler(name="force", builderNames = [ builder.getConfigDict()['name'] for builder in c['builders'] ]))

c['status'] = []

from buildbot.status import html
from buildbot.status.web import authz, auth

authz_cfg=authz.Authz(
    # change any of these to True to enable; see the manual for more
    # options
    #auth=auth.BasicAuth(users),
    gracefulShutdown = False,
    forceBuild = True, # use this to test your slave once it is set up
    forceAllBuilds = True,
    pingBuilder = True,
    stopBuild = True,
    stopAllBuilds = True,
    cancelPendingBuild = True,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))

####### 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'] = "Suricata"
c['titleURL'] = "https://redmine.openinfosecfoundation.org/projects/suricata"

# 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",
}