forked from OISF/suricata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
266 lines (258 loc) · 7.61 KB
/
.travis.yml
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
dist: trusty
sudo: false
language: c
addons:
apt:
# Define the required packages without libjansson so we can do a
# build without libjansson.
packages-without-jansson: &packages-without-jansson
- libpcre3
- libpcre3-dbg
- libpcre3-dev
- build-essential
- autoconf
- automake
- libtool
- libpcap-dev
- libnet1-dev
- libyaml-0-2
- libyaml-dev
- zlib1g
- zlib1g-dev
- libcap-ng-dev
- libcap-ng0
- make
- libmagic-dev
- libnetfilter-queue-dev
- libnetfilter-queue1
- libnfnetlink-dev
- libnfnetlink0
- libhiredis-dev
- libjansson-dev
- libevent-dev
- libevent-pthreads-2.0-5
# Now define the default set of packages which is those above, and
# libjansson.
packages: &packages
- *packages-without-jansson
- libjansson-dev
# Define the default CFLAGS used by all builds as a YAML anchor.
default-cflags: &default-cflags
CFLAGS="-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-function"
matrix:
allow_failures:
# Allow the rust-stable build to fail. These entries must match
# the env entry in the build matrix exactly.
- env:
- NAME="linux,gcc,rust-stable"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="stable"
- ARGS="--enable-rust --enable-rust-strict"
- DO_CHECK_SETUP_SCRIPTS="yes"
- DO_DISTCHECK="yes"
include:
# Linux, gcc, coccinelle.
- os: linux
compiler: gcc-7
env:
- NAME="linux,gcc-7,cocci"
- *default-cflags
- NO_UNITTESTS=yes
addons:
apt:
sources:
- sourceline: ppa:npalix/coccinelle
# For gcc-7.
- sourceline: ppa:ubuntu-toolchain-r/test
packages:
- *packages
- coccinelle
- gcc-7
# Linux, gcc, Rust (latest stable).
# This is allowed to fail, update allow_failures if the env changes.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,rust-stable"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="stable"
- ARGS="--enable-rust --enable-rust-strict"
- DO_CHECK_SETUP_SCRIPTS="yes"
- DO_DISTCHECK="yes"
# Linux, gcc, Rust (auto detect).
# - Rust 1.31.0, the latest known working version.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,rust-1.31.0-disabled"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="1.31.0"
- ARGS="--disable-rust"
- DO_DISTCHECK="yes"
# Linux, gcc, Rust (auto detect).
# - Rust 1.31.0, the latest known working version.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,rust-1.31.0-auto"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="1.31.0"
- ARGS=""
- DO_DISTCHECK="yes"
# Linux, gcc, Rust.
# - Rust 1.31.0, the latest known working version.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,rust-1.31.0"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="1.31.0"
- ARGS="--enable-rust --enable-rust-strict"
- DO_DISTCHECK="yes"
# Linux, gcc, Rust (1.24.1 - oldest supported).
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,rust-1.24.1"
- *default-cflags
- ENABLE_RUST="yes"
- RUST_VERSION="1.24.1"
- ARGS="--enable-rust --enable-rust-strict"
- DO_DISTCHECK="yes"
# Linux, gcc, -DNDEBUG.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,ndebug"
- *default-cflags
- EXTRA_CFLAGS="-DNDEBUG"
# Linux, clang. For this build we'll also enable -Wshadow.
- os: linux
compiler: clang
env:
- NAME="linux,clang"
- *default-cflags
- EXTRA_CFLAGS="-Wshadow"
# Linux, gcc, profiling.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,profiling"
- *default-cflags
- ARGS="--enable-profiling"
# Linux, gcc, debug.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,debug"
- *default-cflags
- ARGS="--enable-debug"
- ENABLE_DEBUG="yes"
# Linux, gcc, no jansson.
- os: linux
compiler: gcc
env:
- NAME="linux,gcc,no-json"
- *default-cflags
addons:
apt:
packages:
- *packages-without-jansson
# OSX 10.12, XCode 8.1
- os: osx
compiler: gcc
osx_image: xcode8.1
sudo: true
env:
- NAME="osx,gcc"
- *default-cflags
script:
- sh ./autogen.sh
- |
if [[ "${NO_UNITTESTS}" != "yes" ]]; then
ARGS="${ARGS} --enable-unittests"
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
./configure --enable-nfqueue --enable-hiredis ${ARGS}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
./configure --enable-hiredis --enable-ipfw \
--enable-lua --with-libpcre-includes=/usr/local/include \
--with-libpcre-includes=/usr/local/include \
--with-libpcre-libraries=/usr/local/lib \
--with-libnss-includes=/usr/local/opt/nss/include/nss \
--with-libnss-libraries=/usr/local/opt/nss/lib \
--with-libnspr-includes=/usr/local/opt/nspr/include/nspr \
--with-libnspr-libraries=/usr/local/opt/nspr/lib ${ARGS}
fi
- |
# Linux container builds have 2 cores, make use of them.
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
j="-j 2"
fi
make ${j}
- |
# Like "make check", but fail on first error. We redirect the output
# so Travis doesn't fail the build with a too much output error.
if [[ "${NO_UNITTESTS}" != "yes" ]]; then
mkdir -p ./qa/log
./src/suricata -u -l ./qa/log --fatal-unittests > unittests.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Unit tests failed, last 500 lines of output are:"
tail -n 500 unittests.log
exit 1
fi
fi
- |
if [[ "$DO_DISTCHECK" == "yes" ]]; then
make distcheck DISTCHECK_CONFIGURE_FLAGS="${ARGS}"
fi
- |
if [[ "$DO_CHECK_SETUP_SCRIPTS" == "yes" ]]; then
(cd scripts && ./check-setup.sh)
fi
before_install:
- export PATH=$HOME/.cargo/bin:$PATH
- |
if [[ "$ENABLE_RUST" == "yes" ]]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
if [[ "$RUST_VERSION" != "" ]]; then
rustup override set $RUST_VERSION
fi
rustc --version
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
# Unlink and install each dependency to avoid errors where a
# formula might already be installed but is not the current
# version.
packages=""
packages="$packages pkg-config"
packages="$packages libmagic"
packages="$packages libyaml"
packages="$packages nss"
packages="$packages nspr"
packages="$packages jansson"
packages="$packages libnet"
packages="$packages lua"
packages="$packages pcre"
packages="$packages hiredis"
for package in $packages; do
if brew ls $package --versions > /dev/null; then
brew unlink $package
fi
done
# Now install.
brew install $packages
# Now relink, becuase if a newer version of a package wasn't
# installed above, it will remain unlinked.
brew link $packages
fi
- ./qa/travis-libhtp.sh