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 apt-get -qq --no-install-recommends install \
215 run
"sudo apt-get -qq --no-install-recommends install \
219 run
"sudo apt-get -qq --no-install-recommends install \
223 # remote-backend build requirements
224 run
"sudo apt-get -qq --no-install-recommends install \
228 run
"sudo apt-get -qq --no-install-recommends install \
231 # authoritative test requirements / setup
232 run
"sudo apt-get -qq --no-install-recommends install \
243 run
"wget https://www.monshouwer.eu/download/3rd_party/jdnssec-tools-0.13.ecdsafix.tar.gz"
244 run
"sudo tar xfz jdnssec-tools-0.13.ecdsafix.tar.gz --strip-components=1 -C /"
245 run
"cd ${TRAVIS_BUILD_DIR}"
247 # pkcs11 test requirements / setup
248 run
"sudo apt-get -qq --no-install-recommends install \
251 run
"sudo mkdir -p /etc/pkcs11/modules/"
252 run
"sudo cp -f regression-tests/softhsm.mod /etc/pkcs11/modules/softhsm.module"
253 run
"sudo cp -f regression-tests/softhsm.conf /etc/softhsm/softhsm.conf"
254 run
"sudo chmod 0755 /etc/softhsm/"
255 run
"sudo chmod 0644 /etc/softhsm/softhsm.conf"
256 run
"sudo chmod 0777 /var/lib/softhsm"
257 run
"p11-kit -l" # ensure it's ok
259 # bind-backend tests requirements
260 run
"sudo apt-get -qq --no-install-recommends install \
264 run
"wget ftp://ftp.nominum.com/pub/nominum/dnsperf/2.0.0.0/dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz"
265 run
"tar xzvf dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz"
266 run
"fakeroot alien --to-deb dnsperf-2.0.0.0-1/dnsperf-2.0.0.0-1.el6.x86_64.rpm"
267 run
"sudo dpkg -i dnsperf_2.0.0.0-2_amd64.deb"
268 run
"cd ${TRAVIS_BUILD_DIR}"
270 # geoip-backend test requirements / setup
271 run
"sudo apt-get -qq --no-install-recommends install \
274 # gmysql-backend test requirements
275 # as of 2016/12/01, mysql-5.6 is now installed in the default travis image
276 # see https://github.com/travis-ci/travis-ci/issues/6961
277 #run "sudo apt-get -qq --no-install-recommends install \
280 # godbc-backend test setup
281 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'
282 run
'echo ${HOME}/.odbc.ini'
283 run
'cat ${HOME}/.odbc.ini'
285 # ldap-backend test setup
286 run
"sudo apt-get -qq --no-install-recommends install \
289 run
"mkdir /tmp/ldap-dns"
290 run
"pushd /tmp/ldap-dns"
291 run
'for schema in /etc/ldap/schema/{core,cosine}.schema ${TRAVIS_BUILD_DIR}/modules/ldapbackend/{dnsdomain2,pdns-domaininfo}.schema ; do echo include $schema ; done > ldap.conf'
293 run
"slaptest -f ldap.conf -F slapd.d"
294 run
"sudo cp slapd.d/cn=config/cn=schema/cn={*dns*.ldif /etc/ldap/slapd.d/cn=config/cn=schema/"
295 run
"sudo chown -R openldap:openldap /etc/ldap/slapd.d/"
296 run
"sudo service slapd restart"
298 run
"sudo -u openldap mkdir -p /var/lib/ldap/powerdns"
299 run
"sudo ldapadd -Y EXTERNAL -H ldapi:/// -f ./modules/ldapbackend/testfiles/add.ldif"
301 # remote-backend tests requirements
302 run
"sudo apt-get -qq --no-install-recommends install \
304 rubygems-integration \
306 run
"gem install bundler --no-rdoc --no-ri"
307 run
"cd modules/remotebackend"
308 run
"ruby -S bundle install"
312 run
"sudo apt-get -qq --no-install-recommends install \
316 run
"sudo apt-get -qq --no-install-recommends install \
319 run
"sudo touch /etc/authbind/byport/53"
320 run
"sudo chmod 755 /etc/authbind/byport/53"
324 # recursor test requirements / setup
325 run
"sudo apt-get -qq --no-install-recommends install \
334 run
"wget http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip"
335 run
"unzip top-1m.csv.zip -d ${TRAVIS_BUILD_DIR}/regression-tests"
336 run
'echo -e "deb [arch=amd64] http://repo.powerdns.com/ubuntu trusty-auth-master main" | sudo tee /etc/apt/sources.list.d/pdns.list'
337 run
'echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 9001" | sudo tee /etc/apt/preferences.d/pdns'
338 run
'curl https://repo.powerdns.com/CBC8B383-pub.asc | sudo apt-key add - '
339 run
'sudo apt-get update'
340 run
'sudo apt-get -y install pdns-server pdns-tools'
341 run
"sudo service pdns stop"
342 run
'for suffix in {1..40}; do sudo /sbin/ip addr add 10.0.3.$suffix/32 dev lo; done'
343 run
"sudo touch /etc/authbind/byport/53"
344 run
"sudo chmod 755 /etc/authbind/byport/53"
345 run
"cd ${TRAVIS_BUILD_DIR}"
349 # test requirements / setup
350 run
"sudo add-apt-repository -y ppa:zeha/libfstrm-ppa"
351 run
'curl "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x396160EF8126A2E2" | sudo apt-key add - '
352 run
"sudo apt-get -qq update"
353 run
"sudo apt-get -qq --no-install-recommends install \
357 run
"sudo sed -i \"s/agentxperms 0700 0755 dnsdist/agentxperms 0700 0755 ${USER}/g\" regression-tests.dnsdist/snmpd.conf"
358 run
"sudo cp -f regression-tests.dnsdist/snmpd.conf /etc/snmp/snmpd.conf"
359 run
"sudo service snmpd restart"
360 # fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so..
361 run
"sudo chmod 0755 /var/agentx"
366 # Build without --enable-botan, no botan 2.x in Travis CI
367 run
"CFLAGS='-O1' CXXFLAGS='-O1' ./configure \
368 --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 ldap lua mydns opendbx pipe random remote tinydns godbc' \
372 --enable-experimental-pkcs11 \
373 --enable-remotebackend-zeromq \
375 --enable-unit-tests \
376 --enable-backend-unit-tests \
377 --disable-dependency-tracking \
378 --disable-silent-rules"
381 run
"make -k install DESTDIR=/tmp/pdns-install-dir"
382 run
"find /tmp/pdns-install-dir -ls"
386 export PDNS_RECURSOR_DIR
=$HOME/pdns_recursor
388 run
"./build-scripts/dist-recursor"
389 run
"cd pdns/recursordist"
390 run
"tar xf pdns-recursor-*.tar.bz2"
391 run
"rm -f pdns-recursor-*.tar.bz2"
392 run
"cd pdns-recursor-*"
393 # Build without --enable-botan, no botan 2.x in Travis CI
394 run
"CFLAGS='-O1' CXXFLAGS='-O1' CXX=${COMPILER} ./configure \
395 --prefix=$PDNS_RECURSOR_DIR \
397 --enable-unit-tests \
398 --disable-silent-rules"
401 run
"find $PDNS_RECURSOR_DIR -ls"
406 run
"./build-scripts/dist-dnsdist"
407 run
"cd pdns/dnsdistdist"
408 run
"tar xf dnsdist*.tar.bz2"
410 run
"CFLAGS='-O1' CXXFLAGS='-O1' ./configure \
411 --enable-unit-tests \
414 --enable-dns-over-tls \
416 --prefix=$HOME/dnsdist \
417 --disable-silent-rules"
422 run
"find $HOME/dnsdist -ls"
423 run
"rm -rf pdns/dnsdistdist/dnsdist-*/"
428 run
"make -j3 check || (cat pdns/test-suite.log; false)"
429 run
"test -f pdns/test-suite.log && cat pdns/test-suite.log || true"
430 run
"test -f modules/remotebackend/test-suite.log && cat modules/remotebackend/test-suite.log || true"
432 #DNSName - make -k -j3 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns')
433 run
'make -k -j3 -C pdns $(grep "(EXEEXT):" pdns/Makefile | cut -f1 -d\$)'
436 run
"./pdnsutil test-algorithms"
439 run
"cd regression-tests"
441 #travis unbound is too old for this test (unbound 1.6.0 required)
442 run
"touch tests/ent-asterisk/fail.nsec"
444 run
"./timestamp ./start-test-stop 5300 ldap-tree"
445 run
"./timestamp ./start-test-stop 5300 ldap-simple"
446 run
"./timestamp ./start-test-stop 5300 ldap-strict"
448 run
"./timestamp ./start-test-stop 5300 bind-both"
449 run
"./timestamp ./start-test-stop 5300 bind-dnssec-both"
450 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
451 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
452 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
453 run
"./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
454 #ecdsa - ./timestamp ./start-test-stop 5300 bind-dnssec-pkcs11
456 run
"./timestamp ./start-test-stop 5300 geoip"
457 run
"./timestamp ./start-test-stop 5300 geoip-nsec3-narrow"
459 run
"./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
460 run
"./timestamp ./start-test-stop 5300 gmysql-both"
461 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
462 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
463 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
465 run
"export GODBC_SQLITE3_DSN=pdns-sqlite3-1"
466 run
"./timestamp ./start-test-stop 5300 godbc_sqlite3-nsec3"
468 run
"./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
469 run
"./timestamp ./start-test-stop 5300 gpgsql-both"
470 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
471 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
472 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
474 run
"./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
475 run
"./timestamp ./start-test-stop 5300 gsqlite3-both"
476 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
477 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
478 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
480 run
"./timestamp ./start-test-stop 5300 mydns"
482 run
"./timestamp ./start-test-stop 5300 opendbx-sqlite3"
484 run
"./timestamp ./start-test-stop 5300 remotebackend-pipe"
485 run
"./timestamp ./start-test-stop 5300 remotebackend-pipe-dnssec"
486 run
"./timestamp ./start-test-stop 5300 remotebackend-unix"
487 run
"./timestamp ./start-test-stop 5300 remotebackend-unix-dnssec"
488 run
"./timestamp ./start-test-stop 5300 remotebackend-http"
489 run
"./timestamp ./start-test-stop 5300 remotebackend-http-dnssec"
490 run
"./timestamp ./start-test-stop 5300 remotebackend-zeromq"
491 run
"./timestamp ./start-test-stop 5300 remotebackend-zeromq-dnssec"
493 run
"./timestamp ./start-test-stop 5300 tinydns"
495 run
"rm tests/ent-asterisk/fail.nsec"
497 run
"cd ../modules/luabackend/test2"
498 run
"../../../regression-tests/timestamp ./runtest"
502 run
"cd regression-tests.rootzone"
503 run
"./timestamp ./start-test-stop 5300 bind-both"
504 run
"./timestamp ./start-test-stop 5300 bind-dnssec-both"
505 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both"
506 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both"
507 run
"./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow"
508 run
"./timestamp ./start-test-stop 5300 bind-hybrid-nsec3"
510 run
"./timestamp ./start-test-stop 5300 gmysql-nodnssec-both"
511 run
"./timestamp ./start-test-stop 5300 gmysql-both"
512 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-both"
513 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both"
514 run
"./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow"
516 run
"./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both"
517 run
"./timestamp ./start-test-stop 5300 gpgsql-both"
518 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-both"
519 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both"
520 run
"./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow"
522 run
"./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both"
523 run
"./timestamp ./start-test-stop 5300 gsqlite3-both"
524 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both"
525 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both"
526 run
"./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow"
531 run
"cd regression-tests.api"
532 run
"./runtests authoritative"
535 ### no backend tests ###
536 run
"cd regression-tests.nobackend/"
538 run
"test ! -s ./failed_tests"
541 run
"rm -f regression-tests/zones/*-slave.*" #FIXME
545 export PDNSRECURSOR
="${PDNS_RECURSOR_DIR}/sbin/pdns_recursor"
546 export DNSBULKTEST
="/usr/bin/dnsbulktest"
547 export RECCONTROL
="${PDNS_RECURSOR_DIR}/bin/rec_control"
548 run
"cd pdns/recursordist/pdns-recursor-*"
549 run
"make -j 3 check || (cat test-suite.log; false)"
550 run
"cd ${TRAVIS_BUILD_DIR}"
551 run
"./build-scripts/test-recursor"
552 export RECURSOR
="${PDNSRECURSOR}"
553 run
"cd regression-tests"
554 run
"THRESHOLD=95 TRACE=no ./timestamp ./recursor-test 5300 50000"
557 run
"cd regression-tests.api"
558 run
"./runtests recursor"
563 run
"cd regression-tests.dnsdist"
564 run
"DNSDISTBIN=$HOME/dnsdist/bin/dnsdist ./runtests -v"
565 run
"rm -f ./DNSCryptResolver.cert ./DNSCryptResolver.key"
571 run
"git status | grep -q clean"
574 # global build requirements
575 # Add botan 2.x when available in Travis CI
576 run
"sudo apt-get -qq --no-install-recommends install \
585 run
"wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb"
586 run
"wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium13_1.0.3-1~ppa14.04+1_amd64.deb"
587 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"
588 run
"cd ${TRAVIS_BUILD_DIR}"
590 install_
$PDNS_BUILD_PRODUCT
592 build_
$PDNS_BUILD_PRODUCT
594 test_
$PDNS_BUILD_PRODUCT
596 if [ $PDNS_BUILD_PRODUCT == "auth" ]; then