3 ## "upstream" travis functions
5 ANSI_GREEN
="\033[32;1m"
12 function travis_cmd
() {
13 local assert output display retry timing cmd result
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 ;;
30 if [[ -n "$timing" ]]; then
34 if [[ -n "$output" ]]; then
35 echo "\$ ${display:-$cmd}"
38 if [[ -n "$retry" ]]; then
39 travis_retry
eval "$cmd"
45 if [[ -n "$timing" ]]; then
49 if [[ -n "$assert" ]]; then
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}"
62 travis_time_finish
() {
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}"
70 function travis_nanoseconds
() {
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)
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."
94 export TRAVIS_TEST_RESULT
=$
(( ${TRAVIS_TEST_RESULT:-0} | $
(($result != 0)) ))
96 if [ $result -eq 0 ]; then
97 echo -e "\n${ANSI_GREEN}The command \"$TRAVIS_CMD\" exited with $result.${ANSI_RESET}"
99 echo -e "\n${ANSI_RED}The command \"$TRAVIS_CMD\" exited with $result.${ANSI_RESET}"
104 pkill
-9 -P $$
&> /dev
/null || true
111 if [[ $timeout =~ ^
[0-9]+$
]]; then
112 # looks like an integer, so we assume it's a timeout
120 local log_file
=travis_wait_$$.log
125 travis_jigger $
! $timeout $cmd &
130 wait $cmd_pid 2>/dev
/null
132 ps
-p$jigger_pid &>/dev
/null
&& kill $jigger_pid
135 if [ $result -eq 0 ]; then
136 echo -e "\n${ANSI_GREEN}The command $cmd exited with $result.${ANSI_RESET}"
138 echo -e "\n${ANSI_RED}The command $cmd exited with $result.${ANSI_RESET}"
141 echo -e "\n${ANSI_GREEN}Log:${ANSI_RESET}\n"
148 # helper method for travis_wait()
151 local timeout
=$1 # in minutes
158 while [ $count -lt $timeout ]; do
159 count
=$
(($count + 1))
160 echo -ne "Still running ($count of $timeout): $@\r"
164 echo -e "\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"$@\"${ANSI_RESET}\n"
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
177 [ $result -eq 0 ] && break
178 count
=$
(($count + 1))
182 [ $count -gt 3 ] && {
183 echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
192 echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
196 echo $1 | base64
-d | openssl rsautl
-decrypt -inkey ~
/.ssh
/id_rsa.repo
201 travis_cmd
"$1" --echo --assert
205 # pkcs11 build requirements
206 run
"sudo apt-get -qq --no-install-recommends install \
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 - '
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"
218 run
"sudo apt-get -qq --no-install-recommends install \
224 run
"sudo apt-get -qq --no-install-recommends install \
228 run
"sudo apt-get -qq --no-install-recommends install \
232 # remote-backend build requirements
233 run
"sudo apt-get -qq --no-install-recommends install \
237 run
"sudo apt-get -qq --no-install-recommends install \
240 # authoritative test requirements / setup
241 run
"sudo apt-get -qq --no-install-recommends install \
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 /"
254 run
"cd ${TRAVIS_BUILD_DIR}"
256 # pkcs11 test requirements / setup
257 run
"sudo apt-get -qq --no-install-recommends install \
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
268 # bind-backend tests requirements
269 run
"sudo apt-get -qq --no-install-recommends install \
273 run
"wget https://downloads.powerdns.com/tmp/dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz"
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"
277 run
"cd ${TRAVIS_BUILD_DIR}"
279 # geoip-backend test requirements / setup
280 run
"sudo apt-get -qq --no-install-recommends install \
283 # gmysql-backend test requirements
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 \
289 # godbc-backend test setup
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'
294 # remote-backend tests requirements
295 run
"sudo apt-get -qq --no-install-recommends install \
297 rubygems-integration \
299 run
"gem update --system"
300 run
"gem install bundler --no-rdoc --no-ri"
301 run
"cd modules/remotebackend"
302 run
"ruby -S bundle install"
306 run
"sudo apt-get -qq --no-install-recommends install \
310 run
"sudo apt-get -qq --no-install-recommends install \
313 run
"sudo touch /etc/authbind/byport/53"
314 run
"sudo chmod 755 /etc/authbind/byport/53"
316 # Install dnsmasq to make lookups more robust
317 run
"sudo apt-get -qq --no-install-recommends install \
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'
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"
331 run
"sudo apt-get -qq --no-install-recommends install \
336 # recursor test requirements / setup
337 # lua-posix is required for the ghost tests
338 # (used by the prequery script in the auth)
339 run
"sudo apt-get -qq --no-install-recommends install \
350 run
"wget http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip"
351 run
"unzip top-1m.csv.zip -d ${TRAVIS_BUILD_DIR}/regression-tests"
352 run
'echo -e "deb [arch=amd64] http://repo.powerdns.com/ubuntu trusty-auth-master main" | sudo tee /etc/apt/sources.list.d/pdns.list'
353 run
'echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 9001" | sudo tee /etc/apt/preferences.d/pdns'
354 run
'curl https://repo.powerdns.com/CBC8B383-pub.asc | sudo apt-key add - '
355 run
'sudo apt-get update'
356 run
'sudo apt-get -y install pdns-server pdns-tools'
357 run
"sudo service pdns stop"
358 run
'for suffix in {1..40}; do sudo /sbin/ip addr add 10.0.3.$suffix/32 dev lo; done'
359 run
"sudo touch /etc/authbind/byport/53"
360 run
"sudo chmod 755 /etc/authbind/byport/53"
361 run
"cd ${TRAVIS_BUILD_DIR}"
363 run
"sudo sed -i \"s/agentxperms 0700 0755 recursor/agentxperms 0700 0755 ${USER}/g\" regression-tests.recursor-dnssec/snmpd.conf"
364 run
"sudo cp -f regression-tests.recursor-dnssec/snmpd.conf /etc/snmp/snmpd.conf"
365 run
"sudo service snmpd restart"
366 ## fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so..
367 run
"sudo chmod 0755 /var/agentx"
371 # test requirements / setup
372 run
"sudo add-apt-repository -y ppa:zeha/libfstrm-ppa"
373 run
'curl "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x396160EF8126A2E2" | sudo apt-key add - '
374 run
"sudo apt-get -qq update"
375 run
"sudo apt-get -qq --no-install-recommends install \
381 run
"sudo sed -i \"s/agentxperms 0700 0755 dnsdist/agentxperms 0700 0755 ${USER}/g\" regression-tests.dnsdist/snmpd.conf"
382 run
"sudo cp -f regression-tests.dnsdist/snmpd.conf /etc/snmp/snmpd.conf"
383 run
"sudo service snmpd restart"
384 # fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so..
385 run
"sudo chmod 0755 /var/agentx"
388 check_for_dangling_symlinks
() {
389 run
'! find -L . -name missing-sources -prune -o ! -name pubsuffix.cc -type l | grep .'
396 --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 lmdb lua opendbx pipe random remote tinydns godbc lua2' \
400 --enable-experimental-pkcs11 \
401 --enable-remotebackend-zeromq \
403 --enable-unit-tests \
404 --enable-backend-unit-tests \
405 --enable-fuzz-targets \
406 --disable-dependency-tracking \
407 --disable-silent-rules \
411 run
"make -k install DESTDIR=/tmp/pdns-install-dir"
412 run
"find /tmp/pdns-install-dir -ls"
419 --with-dynmodules='bind' \
422 --enable-unit-tests \
423 --disable-dependency-tracking \
424 --disable-silent-rules"
425 run
"make -C ext -k -j3"
427 run
"make -k -j3 ixfrdist"
432 export PDNS_RECURSOR_DIR
=$HOME/pdns_recursor
433 run
"cd pdns/recursordist"
434 check_for_dangling_symlinks
437 run
"./build-scripts/dist-recursor"
438 run
"cd pdns/recursordist"
439 run
"tar xf pdns-recursor-*.tar.bz2"
440 run
"rm -f pdns-recursor-*.tar.bz2"
441 run
"cd pdns-recursor-*"
444 --prefix=$PDNS_RECURSOR_DIR \
446 --enable-unit-tests \
449 --disable-silent-rules"
452 run
"find $PDNS_RECURSOR_DIR -ls"
457 run
"cd pdns/dnsdistdist"
458 check_for_dangling_symlinks
460 run
"./build-scripts/dist-dnsdist"
461 run
"cd pdns/dnsdistdist"
462 run
"tar xf dnsdist*.tar.bz2"
466 --enable-unit-tests \
469 --enable-dns-over-tls \
472 --prefix=$HOME/dnsdist \
473 --disable-silent-rules"
478 run
"find $HOME/dnsdist -ls"
479 run
"rm -rf pdns/dnsdistdist/dnsdist-*/"
484 run
"make -j3 check || (cat pdns/test-suite.log; false)"
485 run
"test -f pdns/test-suite.log && cat pdns/test-suite.log || true"
486 run
"test -f modules/remotebackend/test-suite.log && cat modules/remotebackend/test-suite.log || true"
488 #DNSName - make -k -j3 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns')
489 run
'make -k -j3 -C pdns $(grep "(EXEEXT):" pdns/Makefile | cut -f1 -d\$)'
492 run
"./pdnsutil test-algorithms"
495 run
"cd regression-tests"
497 #travis unbound is too old for this test (unbound 1.6.0 required)
498 run
"touch tests/ent-asterisk/fail.nsec"
500 run
"./timestamp ./start-test-stop 5300 lua-minimal nowait 0 apex-level-a-but-no-a"
502 run
"./timestamp ./start-test-stop 5300 bind-both"
503 run
"./timestamp ./start-test-stop 5300 bind-dnssec-both"
504 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
505 # run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
506 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
507 run
"./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
508 #ecdsa - ./timestamp ./start-test-stop 5300 bind-dnssec-pkcs11
510 run
"./timestamp ./start-test-stop 5300 geoip"
511 run
"./timestamp ./start-test-stop 5300 geoip-nsec3-narrow"
512 run
"export geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb"
513 run
"./timestamp ./start-test-stop 5300 geoip"
515 run
"./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
516 run
"./timestamp ./start-test-stop 5300 gmysql-both"
517 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
518 # run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
519 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
521 run
"export GODBC_SQLITE3_DSN=pdns-sqlite3-1"
522 run
"./timestamp ./start-test-stop 5300 godbc_sqlite3-nsec3"
524 run
"./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
525 run
"./timestamp ./start-test-stop 5300 gpgsql-both"
526 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
527 #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
528 #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
530 run
"./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
531 run
"./timestamp ./start-test-stop 5300 gsqlite3-both"
532 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
533 # run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
534 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
536 run
"./timestamp ./start-test-stop 5300 opendbx-sqlite3"
538 run
"./timestamp ./start-test-stop 5300 remotebackend-pipe"
539 run
"./timestamp ./start-test-stop 5300 remotebackend-pipe-dnssec"
540 #run "./timestamp ./start-test-stop 5300 remotebackend-unix"
541 run
"./timestamp ./start-test-stop 5300 remotebackend-unix-dnssec"
542 #run "./timestamp ./start-test-stop 5300 remotebackend-http"
543 run
"./timestamp ./start-test-stop 5300 remotebackend-http-dnssec"
544 #run "./timestamp ./start-test-stop 5300 remotebackend-zeromq"
545 run
"./timestamp ./start-test-stop 5300 remotebackend-zeromq-dnssec"
547 run
"./timestamp ./start-test-stop 5300 tinydns"
549 run
"./timestamp ./start-test-stop 5300 lmdb-nodnssec-both"
550 run
"./timestamp ./start-test-stop 5300 lmdb-both"
551 run
"./timestamp ./start-test-stop 5300 lmdb-nsec3-both"
552 # run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both"
554 run
"rm tests/ent-asterisk/fail.nsec"
556 run
"cd ../modules/luabackend/test2"
557 run
"../../../regression-tests/timestamp ./runtest"
561 run
"cd regression-tests.rootzone"
562 run
"./timestamp ./start-test-stop 5300 bind-both"
563 run
"./timestamp ./start-test-stop 5300 bind-dnssec-both"
564 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
565 # run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
566 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
567 run
"./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
569 run
"./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
570 run
"./timestamp ./start-test-stop 5300 gmysql-both"
571 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
572 # run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
573 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
575 run
"./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
576 run
"./timestamp ./start-test-stop 5300 gpgsql-both"
577 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
578 # run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
579 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
581 run
"./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
582 run
"./timestamp ./start-test-stop 5300 gsqlite3-both"
583 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
584 # run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
585 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
587 run
"./timestamp ./start-test-stop 5300 lua2"
588 run
"./timestamp ./start-test-stop 5300 lua2-dnssec"
590 run
"./timestamp ./start-test-stop 5300 lmdb-both"
591 run
"./timestamp ./start-test-stop 5300 lmdb-nodnssec-both"
592 run
"./timestamp ./start-test-stop 5300 lmdb-nsec3-both"
593 # run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both"
598 run
"cd regression-tests.api"
599 run
"./runtests authoritative"
602 ### no backend tests ###
603 run
"cd regression-tests.nobackend/"
605 run
"test ! -s ./failed_tests"
608 ### Lua rec tests ###
609 run
"cd regression-tests.auth-py"
610 run
"./runtests -v || (cat ./configs/auth/pdns.log; false)"
613 run
"rm -f regression-tests/zones/*-slave.*" #FIXME
617 run
"cd regression-tests.ixfrdist"
618 run
"IXFRDISTBIN=${TRAVIS_BUILD_DIR}/pdns/ixfrdist ./runtests -v || (cat ixfrdist.log; false)"
623 export PDNSRECURSOR
="${PDNS_RECURSOR_DIR}/sbin/pdns_recursor"
624 export DNSBULKTEST
="/usr/bin/dnsbulktest"
625 export RECCONTROL
="${PDNS_RECURSOR_DIR}/bin/rec_control"
626 run
"cd pdns/recursordist/pdns-recursor-*"
627 run
"make -j 3 check || (cat test-suite.log; false)"
628 run
"cd ${TRAVIS_BUILD_DIR}"
629 run
"./build-scripts/test-recursor"
630 export RECURSOR
="${PDNSRECURSOR}"
631 run
"cd regression-tests"
632 run
"THRESHOLD=50 TRACE=no ./timestamp ./recursor-test 5300 50000"
635 run
"cd regression-tests.api"
636 run
"./runtests recursor"
641 run
"cd regression-tests.dnsdist"
642 run
"DNSDISTBIN=$HOME/dnsdist/bin/dnsdist ./runtests -v --ignore-files='(?:^\.|^_,|^setup\.py$|^test_DOH\.py$|^test_OCSP\.py$|^test_Prometheus\.py$|^test_TLSSessionResumption\.py$)'"
643 run
"rm -f ./DNSCryptResolver.cert ./DNSCryptResolver.key"
649 run
"git status | grep -q clean"
652 # global build requirements
653 run
"sudo apt-get -qq --no-install-recommends install \
661 run
"wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb"
662 run
"wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium13_1.0.3-1~ppa14.04+1_amd64.deb"
663 run
"sudo dpkg -i libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb libsodium13_1.0.3-1~ppa14.04+1_amd64.deb"
664 run
"cd ${TRAVIS_BUILD_DIR}"
666 compilerflags
="-O1 -Werror=vla"
668 if [ "$CC" = "clang" ]
670 compilerflags
="$compilerflags -Werror=string-plus-int"
671 if [ "${PDNS_BUILD_PRODUCT}" = "recursor" ]; then
672 sanitizerflags
="${sanitizerflags} --enable-asan"
673 elif [ "${PDNS_BUILD_PRODUCT}" = "dnsdist" ]; then
674 sanitizerflags
="${sanitizerflags} --enable-asan --enable-ubsan"
675 elif [ "${PDNS_BUILD_PRODUCT}" = "ixfrdist" ]; then
676 sanitizerflags
="${sanitizerflags} --enable-asan --enable-ubsan"
679 export CFLAGS
=$compilerflags
680 export CXXFLAGS
=$compilerflags
681 export sanitizerflags
682 # We need a suppression for UndefinedBehaviorSanitizer with ixfrdist,
683 # because of a vptr bug fixed in Boost 1.57.0:
684 # https://github.com/boostorg/any/commit/c92ab03ab35775b6aab30f6cdc3d95b7dd8fc5c6
685 export UBSAN_OPTIONS
="print_stacktrace=1:halt_on_error=1:suppressions=${TRAVIS_BUILD_DIR}/build-scripts/UBSan.supp"
687 install_
$PDNS_BUILD_PRODUCT
689 build_
$PDNS_BUILD_PRODUCT
691 test_
$PDNS_BUILD_PRODUCT
693 if [ $PDNS_BUILD_PRODUCT == "auth" ]; then