]> git.ipfire.org Git - thirdparty/pdns.git/blame - build-scripts/travis.sh
dnsdist: Add regression tests for OCSP stapling over DoH and DoT
[thirdparty/pdns.git] / build-scripts / travis.sh
CommitLineData
bf6096f5
PL
1#!/bin/bash
2
3## "upstream" travis functions
4ANSI_RED="\033[31;1m"
5ANSI_GREEN="\033[32;1m"
6ANSI_RESET="\033[0m"
7ANSI_CLEAR="\033[0K"
8
9TRAVIS_TEST_RESULT=
10TRAVIS_CMD=
11
12function travis_cmd() {
13 local assert output display retry timing cmd result
14
15 cmd=$1
16 TRAVIS_CMD=$cmd
17 shift
18
19 while true; do
20 case "$1" in
21 --assert) assert=true; shift ;;
22 --echo) output=true; shift ;;
23 --display) display=$2; shift 2;;
24 --retry) retry=true; shift ;;
25 --timing) timing=true; shift ;;
26 *) break ;;
27 esac
28 done
29
30 if [[ -n "$timing" ]]; then
31 travis_time_start
32 fi
33
34 if [[ -n "$output" ]]; then
35 echo "\$ ${display:-$cmd}"
36 fi
37
38 if [[ -n "$retry" ]]; then
39 travis_retry eval "$cmd"
40 else
41 eval "$cmd"
42 fi
43 result=$?
44
45 if [[ -n "$timing" ]]; then
46 travis_time_finish
47 fi
48
49 if [[ -n "$assert" ]]; then
50 travis_assert $result
51 fi
52
53 return $result
54}
55
56travis_time_start() {
57 travis_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
58 travis_start_time=$(travis_nanoseconds)
59 echo -en "travis_time:start:$travis_timer_id\r${ANSI_CLEAR}"
60}
61
62travis_time_finish() {
63 local result=$?
64 travis_end_time=$(travis_nanoseconds)
65 local duration=$(($travis_end_time-$travis_start_time))
66 echo -en "\ntravis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r${ANSI_CLEAR}"
67 return $result
68}
69
70function travis_nanoseconds() {
71 local cmd="date"
72 local format="+%s%N"
73 local os=$(uname)
74
75 if hash gdate > /dev/null 2>&1; then
76 cmd="gdate" # use gdate if available
77 elif [[ "$os" = Darwin ]]; then
78 format="+%s000000000" # fallback to second precision on darwin (does not support %N)
79 fi
80
81 $cmd -u $format
82}
83
84travis_assert() {
85 local result=${1:-$?}
86 if [ $result -ne 0 ]; then
87 echo -e "\n${ANSI_RED}The command \"$TRAVIS_CMD\" failed and exited with $result during $TRAVIS_STAGE.${ANSI_RESET}\n\nYour build has been stopped."
88 travis_terminate 2
89 fi
90}
91
92travis_result() {
93 local result=$1
94 export TRAVIS_TEST_RESULT=$(( ${TRAVIS_TEST_RESULT:-0} | $(($result != 0)) ))
95
96 if [ $result -eq 0 ]; then
97 echo -e "\n${ANSI_GREEN}The command \"$TRAVIS_CMD\" exited with $result.${ANSI_RESET}"
98 else
99 echo -e "\n${ANSI_RED}The command \"$TRAVIS_CMD\" exited with $result.${ANSI_RESET}"
100 fi
101}
102
103travis_terminate() {
104 pkill -9 -P $$ &> /dev/null || true
105 exit $1
106}
107
108travis_wait() {
109 local timeout=$1
110
111 if [[ $timeout =~ ^[0-9]+$ ]]; then
112 # looks like an integer, so we assume it's a timeout
113 shift
114 else
115 # default value
116 timeout=20
117 fi
118
119 local cmd="$@"
120 local log_file=travis_wait_$$.log
121
122 $cmd &>$log_file &
123 local cmd_pid=$!
124
125 travis_jigger $! $timeout $cmd &
126 local jigger_pid=$!
127 local result
128
129 {
130 wait $cmd_pid 2>/dev/null
131 result=$?
132 ps -p$jigger_pid &>/dev/null && kill $jigger_pid
133 }
134
135 if [ $result -eq 0 ]; then
136 echo -e "\n${ANSI_GREEN}The command $cmd exited with $result.${ANSI_RESET}"
137 else
138 echo -e "\n${ANSI_RED}The command $cmd exited with $result.${ANSI_RESET}"
139 fi
140
141 echo -e "\n${ANSI_GREEN}Log:${ANSI_RESET}\n"
142 cat $log_file
143
144 return $result
145}
146
147travis_jigger() {
148 # helper method for travis_wait()
149 local cmd_pid=$1
150 shift
151 local timeout=$1 # in minutes
152 shift
153 local count=0
154
155 # clear the line
156 echo -e "\n"
157
158 while [ $count -lt $timeout ]; do
159 count=$(($count + 1))
160 echo -ne "Still running ($count of $timeout): $@\r"
161 sleep 60
162 done
163
164 echo -e "\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"$@\"${ANSI_RESET}\n"
165 kill -9 $cmd_pid
166}
167
168travis_retry() {
169 local result=0
170 local count=1
171 while [ $count -le 3 ]; do
172 [ $result -ne 0 ] && {
173 echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
174 }
175 "$@"
176 result=$?
177 [ $result -eq 0 ] && break
178 count=$(($count + 1))
179 sleep 1
180 done
181
182 [ $count -gt 3 ] && {
183 echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
184 }
185
186 return $result
187}
188
189travis_fold() {
190 local action=$1
191 local name=$2
192 echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
193}
194
195decrypt() {
196 echo $1 | base64 -d | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa.repo
197}
198
199
200run() {
201 travis_cmd "$1" --echo --assert
202}
203
204install_auth() {
205 # pkcs11 build requirements
206 run "sudo apt-get -qq --no-install-recommends install \
207 libp11-kit-dev"
208
c5791798
PD
209 # for validns
210 run "sudo add-apt-repository -y ppa:jelu/validns"
211 run 'curl "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x7AA4AC1F04A52E842B88094F01B7B7D6564DECD0" | sudo apt-key add - '
212
bf6096f5 213 # geoip-backend
9c741511
AT
214 run "sudo add-apt-repository -y ppa:maxmind/ppa"
215 run "gpg --keyserver keyserver.ubuntu.com --recv-keys DE742AFA"
216 run "gpg --export DE742AFA | sudo apt-key add -"
217 run "sudo apt-get update"
bf6096f5
PL
218 run "sudo apt-get -qq --no-install-recommends install \
219 libgeoip-dev \
9c741511
AT
220 libyaml-cpp-dev \
221 libmaxminddb-dev"
bf6096f5 222
42f1f726 223 # lmdb-backend
224 run "sudo apt-get -qq --no-install-recommends install \
225 liblmdb-dev"
226
bf6096f5
PL
227 # opendbx-backend
228 run "sudo apt-get -qq --no-install-recommends install \
229 libopendbx1-dev \
230 libopendbx1-sqlite3"
231
232 # remote-backend build requirements
233 run "sudo apt-get -qq --no-install-recommends install \
234 libzmq3-dev"
235
3a435d2e
PD
236 # godbc-backend
237 run "sudo apt-get -qq --no-install-recommends install \
238 libsqliteodbc"
239
bf6096f5
PL
240 # authoritative test requirements / setup
241 run "sudo apt-get -qq --no-install-recommends install \
242 bind9utils \
243 ldnsutils \
244 libnet-dns-perl \
245 moreutils \
246 unbound-host \
247 validns \
248 default-jre \
249 jq"
250
251 run "cd .."
20445e69
PD
252 run "wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz"
253 run "sudo tar xfz jdnssec-tools-0.14.tar.gz --strip-components=1 -C /"
1e0253ca 254 run "cd ${TRAVIS_BUILD_DIR}"
bf6096f5
PL
255
256 # pkcs11 test requirements / setup
257 run "sudo apt-get -qq --no-install-recommends install \
258 p11-kit \
259 softhsm"
260 run "sudo mkdir -p /etc/pkcs11/modules/"
261 run "sudo cp -f regression-tests/softhsm.mod /etc/pkcs11/modules/softhsm.module"
262 run "sudo cp -f regression-tests/softhsm.conf /etc/softhsm/softhsm.conf"
263 run "sudo chmod 0755 /etc/softhsm/"
264 run "sudo chmod 0644 /etc/softhsm/softhsm.conf"
265 run "sudo chmod 0777 /var/lib/softhsm"
266 run "p11-kit -l" # ensure it's ok
267
268 # bind-backend tests requirements
269 run "sudo apt-get -qq --no-install-recommends install \
14fa3ea1
PD
270 alien\
271 fakeroot"
bf6096f5 272 run "cd .."
0e62797e 273 run "wget https://downloads.powerdns.com/tmp/dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz"
bf6096f5
PL
274 run "tar xzvf dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz"
275 run "fakeroot alien --to-deb dnsperf-2.0.0.0-1/dnsperf-2.0.0.0-1.el6.x86_64.rpm"
276 run "sudo dpkg -i dnsperf_2.0.0.0-2_amd64.deb"
1e0253ca 277 run "cd ${TRAVIS_BUILD_DIR}"
bf6096f5
PL
278
279 # geoip-backend test requirements / setup
280 run "sudo apt-get -qq --no-install-recommends install \
281 geoip-database"
282
283 # gmysql-backend test requirements
d004b14c
RG
284 # as of 2016/12/01, mysql-5.6 is now installed in the default travis image
285 # see https://github.com/travis-ci/travis-ci/issues/6961
286 #run "sudo apt-get -qq --no-install-recommends install \
287 # mysql-server"
bf6096f5
PL
288
289 # godbc-backend test setup
3a435d2e
PD
290 run 'echo -e "[pdns-sqlite3-1]\nDriver = SQLite3\nDatabase = ${PWD}/regression-tests/pdns.sqlite3\n\n[pdns-sqlite3-2]\nDriver = SQLite3\nDatabase = ${PWD}/regression-tests/pdns.sqlite32\n" > ${HOME}/.odbc.ini'
291 run 'echo ${HOME}/.odbc.ini'
292 run 'cat ${HOME}/.odbc.ini'
bf6096f5 293
bf6096f5
PL
294 # remote-backend tests requirements
295 run "sudo apt-get -qq --no-install-recommends install \
296 ruby-json \
297 rubygems-integration \
298 socat"
2a5c0b37 299 run "gem update --system"
bf6096f5
PL
300 run "gem install bundler --no-rdoc --no-ri"
301 run "cd modules/remotebackend"
302 run "ruby -S bundle install"
303 run "cd ../.."
304
305 # tinydns
306 run "sudo apt-get -qq --no-install-recommends install \
307 libcdb-dev"
308
309 # No backend
310 run "sudo apt-get -qq --no-install-recommends install \
311 authbind \
312 faketime"
313 run "sudo touch /etc/authbind/byport/53"
314 run "sudo chmod 755 /etc/authbind/byport/53"
869c68a4
PD
315
316 # Install dnsmasq to make lookups more robust
317 run "sudo apt-get -qq --no-install-recommends install \
318 dnsmasq"
319 run 'echo listen-address=127.0.0.53 | sudo tee /etc/dnsmasq.d/local.conf'
320 run 'echo bind-interfaces | sudo tee -a /etc/dnsmasq.d/local.conf'
321
322 ## WARNING
323 ## after this dnsmasq restart, DNS lookups will fail for a few seconds.
324 run 'sudo service dnsmasq restart'
325 run "sudo resolvconf --disable-updates"
326 run 'echo nameserver 127.0.0.53 | sudo tee /etc/resolv.conf'
327 run "export RESOLVERIP=127.0.0.53"
bf6096f5
PL
328}
329
eb353acc
RG
330install_ixfrdist() {
331 run "sudo apt-get -qq --no-install-recommends install \
332 libyaml-cpp-dev"
333}
334
bf6096f5
PL
335install_recursor() {
336 # recursor test requirements / setup
97ab616e
RG
337 # lua-posix is required for the ghost tests
338 # (used by the prequery script in the auth)
bf6096f5
PL
339 run "sudo apt-get -qq --no-install-recommends install \
340 authbind \
341 daemontools \
7c114c00 342 jq \
cb54e9b5 343 libfaketime \
7c114c00 344 libsnmp-dev \
97ab616e 345 lua-posix \
bf6096f5 346 moreutils \
7c114c00 347 snmpd"
bf6096f5 348 run "cd .."
8a27076c 349 run "wget http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip"
1e0253ca 350 run "unzip top-1m.csv.zip -d ${TRAVIS_BUILD_DIR}/regression-tests"
8a27076c 351 run 'echo -e "deb [arch=amd64] http://repo.powerdns.com/ubuntu trusty-auth-master main" | sudo tee /etc/apt/sources.list.d/pdns.list'
352 run 'echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 9001" | sudo tee /etc/apt/preferences.d/pdns'
353 run 'curl https://repo.powerdns.com/CBC8B383-pub.asc | sudo apt-key add - '
dad54543
PL
354 run 'sudo apt-get update'
355 run 'sudo apt-get -y install pdns-server pdns-tools'
e07dae82 356 run "sudo service pdns stop"
bf6096f5
PL
357 run 'for suffix in {1..40}; do sudo /sbin/ip addr add 10.0.3.$suffix/32 dev lo; done'
358 run "sudo touch /etc/authbind/byport/53"
359 run "sudo chmod 755 /etc/authbind/byport/53"
1e0253ca 360 run "cd ${TRAVIS_BUILD_DIR}"
aa7a54c9
RG
361 # install SNMP
362 run "sudo sed -i \"s/agentxperms 0700 0755 recursor/agentxperms 0700 0755 ${USER}/g\" regression-tests.recursor-dnssec/snmpd.conf"
363 run "sudo cp -f regression-tests.recursor-dnssec/snmpd.conf /etc/snmp/snmpd.conf"
364 run "sudo service snmpd restart"
365 ## fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so..
366 run "sudo chmod 0755 /var/agentx"
bf6096f5
PL
367}
368
369install_dnsdist() {
35d883a8 370 # test requirements / setup
82a91ddf
CH
371 run "sudo add-apt-repository -y ppa:zeha/libfstrm-ppa"
372 run 'curl "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x396160EF8126A2E2" | sudo apt-key add - '
373 run "sudo apt-get -qq update"
9f4eb5cc
RG
374 run "sudo apt-get -qq --no-install-recommends install \
375 snmpd \
82a91ddf
CH
376 libsnmp-dev \
377 libfstrm-dev"
9f4eb5cc
RG
378 run "sudo sed -i \"s/agentxperms 0700 0755 dnsdist/agentxperms 0700 0755 ${USER}/g\" regression-tests.dnsdist/snmpd.conf"
379 run "sudo cp -f regression-tests.dnsdist/snmpd.conf /etc/snmp/snmpd.conf"
380 run "sudo service snmpd restart"
381 # fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so..
382 run "sudo chmod 0755 /var/agentx"
bf6096f5
PL
383}
384
d5d421b3
JS
385check_for_dangling_symlinks() {
386 run '! find -L . -name missing-sources -prune -o ! -name pubsuffix.cc -type l | grep .'
387}
388
bf6096f5 389build_auth() {
48c7cae9 390 run "autoreconf -vi"
e9ccf0f7 391 run "./configure \
040e40bb 392 ${sanitizerflags} \
d5d4d894 393 --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 lmdb lua mydns opendbx pipe random remote tinydns godbc lua2' \
bf6096f5
PL
394 --with-modules='' \
395 --with-sqlite3 \
cb264691 396 --with-libsodium \
bf6096f5
PL
397 --enable-experimental-pkcs11 \
398 --enable-remotebackend-zeromq \
399 --enable-tools \
400 --enable-unit-tests \
401 --enable-backend-unit-tests \
84f3c7d3 402 --enable-fuzz-targets \
bf6096f5 403 --disable-dependency-tracking \
42f1f726 404 --disable-silent-rules \
405 --with-lmdb=/usr"
bf6096f5
PL
406 run "make -k dist"
407 run "make -k -j3"
408 run "make -k install DESTDIR=/tmp/pdns-install-dir"
409 run "find /tmp/pdns-install-dir -ls"
410}
411
eb353acc
RG
412build_ixfrdist() {
413 run "autoreconf -vi"
414 run "./configure \
415 ${sanitizerflags} \
416 --with-dynmodules='bind' \
417 --with-modules='' \
418 --enable-ixfrdist \
419 --enable-unit-tests \
420 --disable-dependency-tracking \
421 --disable-silent-rules"
8f9ca3a1 422 run "make -C ext -k -j3"
eb353acc
RG
423 run "cd pdns"
424 run "make -k -j3 ixfrdist"
425 run "cd .."
426}
427
bf6096f5
PL
428build_recursor() {
429 export PDNS_RECURSOR_DIR=$HOME/pdns_recursor
d5d421b3
JS
430 run "cd pdns/recursordist"
431 check_for_dangling_symlinks
432 run "cd ../.."
bf6096f5
PL
433 # distribution build
434 run "./build-scripts/dist-recursor"
435 run "cd pdns/recursordist"
436 run "tar xf pdns-recursor-*.tar.bz2"
437 run "rm -f pdns-recursor-*.tar.bz2"
438 run "cd pdns-recursor-*"
1e0a958b 439 run "./configure \
040e40bb 440 ${sanitizerflags} \
bf6096f5 441 --prefix=$PDNS_RECURSOR_DIR \
cb264691 442 --with-libsodium \
35d883a8 443 --enable-unit-tests \
af1377b7 444 --enable-nod \
bf6096f5
PL
445 --disable-silent-rules"
446 run "make -k -j3"
447 run "make install"
448 run "find $PDNS_RECURSOR_DIR -ls"
449 run "cd ../../.."
450}
451
452build_dnsdist(){
d5d421b3
JS
453 run "cd pdns/dnsdistdist"
454 check_for_dangling_symlinks
455 run "cd ../.."
bf6096f5
PL
456 run "./build-scripts/dist-dnsdist"
457 run "cd pdns/dnsdistdist"
458 run "tar xf dnsdist*.tar.bz2"
459 run "cd dnsdist-*"
e9ccf0f7 460 run "./configure \
040e40bb 461 ${sanitizerflags} \
bf6096f5 462 --enable-unit-tests \
cb264691 463 --with-libsodium \
bf6096f5 464 --enable-dnscrypt \
a227f47d 465 --enable-dns-over-tls \
3bbbeb11 466 --enable-dnstap \
bf6096f5
PL
467 --prefix=$HOME/dnsdist \
468 --disable-silent-rules"
469 run "make -k -j3"
470 run "./testrunner"
471 run "make install"
472 run "cd ../../.."
473 run "find $HOME/dnsdist -ls"
474 run "rm -rf pdns/dnsdistdist/dnsdist-*/"
475
476}
477
bf6096f5 478test_auth() {
488c8611 479 run "make -j3 check || (cat pdns/test-suite.log; false)"
bf6096f5
PL
480 run "test -f pdns/test-suite.log && cat pdns/test-suite.log || true"
481 run "test -f modules/remotebackend/test-suite.log && cat modules/remotebackend/test-suite.log || true"
482
483 #DNSName - make -k -j3 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns')
8695de46 484 run 'make -k -j3 -C pdns $(grep "(EXEEXT):" pdns/Makefile | cut -f1 -d\$)'
bf6096f5
PL
485
486 run "cd pdns"
487 run "./pdnsutil test-algorithms"
488 run "cd .."
489
490 run "cd regression-tests"
491
b6072c01
KM
492 #travis unbound is too old for this test (unbound 1.6.0 required)
493 run "touch tests/ent-asterisk/fail.nsec"
494
bf6096f5
PL
495 run "./timestamp ./start-test-stop 5300 bind-both"
496 run "./timestamp ./start-test-stop 5300 bind-dnssec-both"
497 run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
9955ccf6 498 # run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
bf6096f5
PL
499 run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
500 run "./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
501 #ecdsa - ./timestamp ./start-test-stop 5300 bind-dnssec-pkcs11
502
bf6096f5
PL
503 run "./timestamp ./start-test-stop 5300 geoip"
504 run "./timestamp ./start-test-stop 5300 geoip-nsec3-narrow"
effa40ed
AT
505 run "export geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb"
506 run "./timestamp ./start-test-stop 5300 geoip"
bf6096f5
PL
507
508 run "./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
509 run "./timestamp ./start-test-stop 5300 gmysql-both"
510 run "./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
9955ccf6 511 # run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
bf6096f5
PL
512 run "./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
513
514 run "export GODBC_SQLITE3_DSN=pdns-sqlite3-1"
3a435d2e 515 run "./timestamp ./start-test-stop 5300 godbc_sqlite3-nsec3"
bf6096f5
PL
516
517 run "./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
518 run "./timestamp ./start-test-stop 5300 gpgsql-both"
519 run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
ce4cbc87
OM
520 #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
521 #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
bf6096f5
PL
522
523 run "./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
524 run "./timestamp ./start-test-stop 5300 gsqlite3-both"
525 run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
9955ccf6 526 # run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
bf6096f5
PL
527 run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
528
529 run "./timestamp ./start-test-stop 5300 mydns"
530
531 run "./timestamp ./start-test-stop 5300 opendbx-sqlite3"
532
533 run "./timestamp ./start-test-stop 5300 remotebackend-pipe"
534 run "./timestamp ./start-test-stop 5300 remotebackend-pipe-dnssec"
ce4cbc87 535 #run "./timestamp ./start-test-stop 5300 remotebackend-unix"
bf6096f5 536 run "./timestamp ./start-test-stop 5300 remotebackend-unix-dnssec"
ce4cbc87 537 #run "./timestamp ./start-test-stop 5300 remotebackend-http"
bf6096f5 538 run "./timestamp ./start-test-stop 5300 remotebackend-http-dnssec"
ce4cbc87 539 #run "./timestamp ./start-test-stop 5300 remotebackend-zeromq"
bf6096f5
PL
540 run "./timestamp ./start-test-stop 5300 remotebackend-zeromq-dnssec"
541
542 run "./timestamp ./start-test-stop 5300 tinydns"
b6072c01 543
42f1f726 544 run "./timestamp ./start-test-stop 5300 lmdb-nodnssec-both"
545 run "./timestamp ./start-test-stop 5300 lmdb-both"
546 run "./timestamp ./start-test-stop 5300 lmdb-nsec3-both"
9955ccf6 547 # run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both"
42f1f726 548
b6072c01
KM
549 run "rm tests/ent-asterisk/fail.nsec"
550
8cce0396
KM
551 run "cd ../modules/luabackend/test2"
552 run "../../../regression-tests/timestamp ./runtest"
553
554 run "cd ../../.."
bf6096f5
PL
555
556 run "cd regression-tests.rootzone"
557 run "./timestamp ./start-test-stop 5300 bind-both"
558 run "./timestamp ./start-test-stop 5300 bind-dnssec-both"
559 run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
9955ccf6 560 # run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
bf6096f5
PL
561 run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
562 run "./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
563
564 run "./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
565 run "./timestamp ./start-test-stop 5300 gmysql-both"
566 run "./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
9955ccf6 567 # run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
bf6096f5
PL
568 run "./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
569
570 run "./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
571 run "./timestamp ./start-test-stop 5300 gpgsql-both"
572 run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
9955ccf6 573 # run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
bf6096f5
PL
574 run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
575
576 run "./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
577 run "./timestamp ./start-test-stop 5300 gsqlite3-both"
578 run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
9955ccf6 579 # run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
bf6096f5
PL
580 run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
581
6f09dd5d
AT
582 run "./timestamp ./start-test-stop 5300 lua2"
583 run "./timestamp ./start-test-stop 5300 lua2-dnssec"
584
42f1f726 585 run "./timestamp ./start-test-stop 5300 lmdb-both"
586 run "./timestamp ./start-test-stop 5300 lmdb-nodnssec-both"
587 run "./timestamp ./start-test-stop 5300 lmdb-nsec3-both"
9955ccf6 588 # run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both"
42f1f726 589
bf6096f5
PL
590 run "cd .."
591
592 ### api ###
593 run "cd regression-tests.api"
594 run "./runtests authoritative"
595 run "cd .."
596
597 ### no backend tests ###
598 run "cd regression-tests.nobackend/"
599 run "./runtests"
600 run "test ! -s ./failed_tests"
601 run "cd .."
602
2b3cdcc0
CHB
603 ### Lua rec tests ###
604 run "cd regression-tests.auth-py"
005d7627 605 run "./runtests -v || (cat ./configs/auth/pdns.log; false)"
2b3cdcc0
CHB
606 run "cd .."
607
bf6096f5
PL
608 run "rm -f regression-tests/zones/*-slave.*" #FIXME
609}
610
eb353acc
RG
611test_ixfrdist(){
612 run "cd regression-tests.ixfrdist"
613 run "IXFRDISTBIN=${TRAVIS_BUILD_DIR}/pdns/ixfrdist ./runtests -v || (cat ixfrdist.log; false)"
614 run "cd .."
615}
616
bf6096f5
PL
617test_recursor() {
618 export PDNSRECURSOR="${PDNS_RECURSOR_DIR}/sbin/pdns_recursor"
bf6096f5
PL
619 export DNSBULKTEST="/usr/bin/dnsbulktest"
620 export RECCONTROL="${PDNS_RECURSOR_DIR}/bin/rec_control"
35d883a8 621 run "cd pdns/recursordist/pdns-recursor-*"
6aac061c 622 run "make -j 3 check || (cat test-suite.log; false)"
35d883a8 623 run "cd ${TRAVIS_BUILD_DIR}"
7568b07d
PL
624 run "./build-scripts/test-recursor"
625 export RECURSOR="${PDNSRECURSOR}"
bf6096f5 626 run "cd regression-tests"
280c2f89 627 run "THRESHOLD=50 TRACE=no ./timestamp ./recursor-test 5300 50000"
bf6096f5 628 run "cd .."
7568b07d 629
bf6096f5
PL
630 run "cd regression-tests.api"
631 run "./runtests recursor"
632 run "cd .."
633}
634
bf6096f5
PL
635test_dnsdist(){
636 run "cd regression-tests.dnsdist"
8c15553e 637 run "DNSDISTBIN=$HOME/dnsdist/bin/dnsdist ./runtests -v --ignore-files='(?:^\.|^_,|^setup\.py$|^test_DOH\.py$|^test_OCSP\.py$)'"
bf6096f5
PL
638 run "rm -f ./DNSCryptResolver.cert ./DNSCryptResolver.key"
639 run "cd .."
640}
641
642test_repo(){
643 run "git status"
644 run "git status | grep -q clean"
645}
646
647# global build requirements
648run "sudo apt-get -qq --no-install-recommends install \
649 libboost-all-dev \
3a086960 650 libluajit-5.1-dev \
bf6096f5 651 libedit-dev \
0a4a38ab 652 libprotobuf-dev \
0a4a38ab 653 protobuf-compiler"
bf6096f5
PL
654
655run "cd .."
656run "wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb"
657run "wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium13_1.0.3-1~ppa14.04+1_amd64.deb"
658run "sudo dpkg -i libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb libsodium13_1.0.3-1~ppa14.04+1_amd64.deb"
1e0253ca 659run "cd ${TRAVIS_BUILD_DIR}"
bf6096f5 660
e9ccf0f7 661compilerflags="-O1 -Werror=vla"
040e40bb 662sanitizerflags=""
e9ccf0f7
PD
663if [ "$CC" = "clang" ]
664then
665 compilerflags="$compilerflags -Werror=string-plus-int"
040e40bb
RG
666 if [ "${PDNS_BUILD_PRODUCT}" = "recursor" ]; then
667 sanitizerflags="${sanitizerflags} --enable-asan"
668 elif [ "${PDNS_BUILD_PRODUCT}" = "dnsdist" ]; then
669 sanitizerflags="${sanitizerflags} --enable-asan --enable-ubsan"
eb353acc 670 elif [ "${PDNS_BUILD_PRODUCT}" = "ixfrdist" ]; then
478ca077 671 sanitizerflags="${sanitizerflags} --enable-asan --enable-ubsan"
040e40bb 672 fi
e9ccf0f7
PD
673fi
674export CFLAGS=$compilerflags
675export CXXFLAGS=$compilerflags
040e40bb 676export sanitizerflags
478ca077
RG
677# We need a suppression for UndefinedBehaviorSanitizer with ixfrdist,
678# because of a vptr bug fixed in Boost 1.57.0:
679# https://github.com/boostorg/any/commit/c92ab03ab35775b6aab30f6cdc3d95b7dd8fc5c6
680export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1:suppressions=${TRAVIS_BUILD_DIR}/build-scripts/UBSan.supp"
e9ccf0f7 681
bf6096f5
PL
682install_$PDNS_BUILD_PRODUCT
683
684build_$PDNS_BUILD_PRODUCT
685
686test_$PDNS_BUILD_PRODUCT
687
d2a4a399 688if [ $PDNS_BUILD_PRODUCT == "auth" ]; then
bf6096f5
PL
689 test_repo
690fi