]>
Commit | Line | Data |
---|---|---|
bf6096f5 PL |
1 | #!/bin/bash |
2 | ||
3 | ## "upstream" travis functions | |
4 | ANSI_RED="\033[31;1m" | |
5 | ANSI_GREEN="\033[32;1m" | |
6 | ANSI_RESET="\033[0m" | |
7 | ANSI_CLEAR="\033[0K" | |
8 | ||
9 | TRAVIS_TEST_RESULT= | |
10 | TRAVIS_CMD= | |
11 | ||
12 | function 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 | ||
56 | travis_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 | ||
62 | travis_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 | ||
70 | function 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 | ||
84 | travis_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 | ||
92 | travis_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 | ||
103 | travis_terminate() { | |
104 | pkill -9 -P $$ &> /dev/null || true | |
105 | exit $1 | |
106 | } | |
107 | ||
108 | travis_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 | ||
147 | travis_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 | ||
168 | travis_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 | ||
189 | travis_fold() { | |
190 | local action=$1 | |
191 | local name=$2 | |
192 | echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" | |
193 | } | |
194 | ||
195 | decrypt() { | |
196 | echo $1 | base64 -d | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa.repo | |
197 | } | |
198 | ||
199 | ||
200 | run() { | |
201 | travis_cmd "$1" --echo --assert | |
202 | } | |
203 | ||
204 | install_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 PL |
222 | |
223 | # ldap-backend | |
224 | run "sudo apt-get -qq --no-install-recommends install \ | |
225 | libldap-dev" | |
226 | ||
42f1f726 | 227 | # lmdb-backend |
228 | run "sudo apt-get -qq --no-install-recommends install \ | |
229 | liblmdb-dev" | |
230 | ||
bf6096f5 PL |
231 | # opendbx-backend |
232 | run "sudo apt-get -qq --no-install-recommends install \ | |
233 | libopendbx1-dev \ | |
234 | libopendbx1-sqlite3" | |
235 | ||
236 | # remote-backend build requirements | |
237 | run "sudo apt-get -qq --no-install-recommends install \ | |
238 | libzmq3-dev" | |
239 | ||
3a435d2e PD |
240 | # godbc-backend |
241 | run "sudo apt-get -qq --no-install-recommends install \ | |
242 | libsqliteodbc" | |
243 | ||
bf6096f5 PL |
244 | # authoritative test requirements / setup |
245 | run "sudo apt-get -qq --no-install-recommends install \ | |
246 | bind9utils \ | |
247 | ldnsutils \ | |
248 | libnet-dns-perl \ | |
249 | moreutils \ | |
250 | unbound-host \ | |
251 | validns \ | |
252 | default-jre \ | |
253 | jq" | |
254 | ||
255 | run "cd .." | |
20445e69 PD |
256 | run "wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz" |
257 | run "sudo tar xfz jdnssec-tools-0.14.tar.gz --strip-components=1 -C /" | |
1e0253ca | 258 | run "cd ${TRAVIS_BUILD_DIR}" |
bf6096f5 PL |
259 | |
260 | # pkcs11 test requirements / setup | |
261 | run "sudo apt-get -qq --no-install-recommends install \ | |
262 | p11-kit \ | |
263 | softhsm" | |
264 | run "sudo mkdir -p /etc/pkcs11/modules/" | |
265 | run "sudo cp -f regression-tests/softhsm.mod /etc/pkcs11/modules/softhsm.module" | |
266 | run "sudo cp -f regression-tests/softhsm.conf /etc/softhsm/softhsm.conf" | |
267 | run "sudo chmod 0755 /etc/softhsm/" | |
268 | run "sudo chmod 0644 /etc/softhsm/softhsm.conf" | |
269 | run "sudo chmod 0777 /var/lib/softhsm" | |
270 | run "p11-kit -l" # ensure it's ok | |
271 | ||
272 | # bind-backend tests requirements | |
273 | run "sudo apt-get -qq --no-install-recommends install \ | |
14fa3ea1 PD |
274 | alien\ |
275 | fakeroot" | |
bf6096f5 | 276 | run "cd .." |
0e62797e | 277 | run "wget https://downloads.powerdns.com/tmp/dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz" |
bf6096f5 PL |
278 | run "tar xzvf dnsperf-2.0.0.0-1-rhel-6-x86_64.tar.gz" |
279 | run "fakeroot alien --to-deb dnsperf-2.0.0.0-1/dnsperf-2.0.0.0-1.el6.x86_64.rpm" | |
280 | run "sudo dpkg -i dnsperf_2.0.0.0-2_amd64.deb" | |
1e0253ca | 281 | run "cd ${TRAVIS_BUILD_DIR}" |
bf6096f5 PL |
282 | |
283 | # geoip-backend test requirements / setup | |
284 | run "sudo apt-get -qq --no-install-recommends install \ | |
285 | geoip-database" | |
286 | ||
287 | # gmysql-backend test requirements | |
d004b14c RG |
288 | # as of 2016/12/01, mysql-5.6 is now installed in the default travis image |
289 | # see https://github.com/travis-ci/travis-ci/issues/6961 | |
290 | #run "sudo apt-get -qq --no-install-recommends install \ | |
291 | # mysql-server" | |
bf6096f5 PL |
292 | |
293 | # godbc-backend test setup | |
3a435d2e PD |
294 | 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' |
295 | run 'echo ${HOME}/.odbc.ini' | |
296 | run 'cat ${HOME}/.odbc.ini' | |
bf6096f5 PL |
297 | |
298 | # ldap-backend test setup | |
299 | run "sudo apt-get -qq --no-install-recommends install \ | |
300 | slapd \ | |
301 | ldap-utils" | |
302 | run "mkdir /tmp/ldap-dns" | |
303 | run "pushd /tmp/ldap-dns" | |
304 | 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' | |
305 | run "mkdir slapd.d" | |
306 | run "slaptest -f ldap.conf -F slapd.d" | |
307 | run "sudo cp slapd.d/cn=config/cn=schema/cn={*dns*.ldif /etc/ldap/slapd.d/cn=config/cn=schema/" | |
308 | run "sudo chown -R openldap:openldap /etc/ldap/slapd.d/" | |
309 | run "sudo service slapd restart" | |
310 | run "popd" | |
311 | run "sudo -u openldap mkdir -p /var/lib/ldap/powerdns" | |
312 | run "sudo ldapadd -Y EXTERNAL -H ldapi:/// -f ./modules/ldapbackend/testfiles/add.ldif" | |
313 | ||
314 | # remote-backend tests requirements | |
315 | run "sudo apt-get -qq --no-install-recommends install \ | |
316 | ruby-json \ | |
317 | rubygems-integration \ | |
318 | socat" | |
2a5c0b37 | 319 | run "gem update --system" |
bf6096f5 PL |
320 | run "gem install bundler --no-rdoc --no-ri" |
321 | run "cd modules/remotebackend" | |
322 | run "ruby -S bundle install" | |
323 | run "cd ../.." | |
324 | ||
325 | # tinydns | |
326 | run "sudo apt-get -qq --no-install-recommends install \ | |
327 | libcdb-dev" | |
328 | ||
329 | # No backend | |
330 | run "sudo apt-get -qq --no-install-recommends install \ | |
331 | authbind \ | |
332 | faketime" | |
333 | run "sudo touch /etc/authbind/byport/53" | |
334 | run "sudo chmod 755 /etc/authbind/byport/53" | |
869c68a4 PD |
335 | |
336 | # Install dnsmasq to make lookups more robust | |
337 | run "sudo apt-get -qq --no-install-recommends install \ | |
338 | dnsmasq" | |
339 | run 'echo listen-address=127.0.0.53 | sudo tee /etc/dnsmasq.d/local.conf' | |
340 | run 'echo bind-interfaces | sudo tee -a /etc/dnsmasq.d/local.conf' | |
341 | ||
342 | ## WARNING | |
343 | ## after this dnsmasq restart, DNS lookups will fail for a few seconds. | |
344 | run 'sudo service dnsmasq restart' | |
345 | run "sudo resolvconf --disable-updates" | |
346 | run 'echo nameserver 127.0.0.53 | sudo tee /etc/resolv.conf' | |
347 | run "export RESOLVERIP=127.0.0.53" | |
bf6096f5 PL |
348 | } |
349 | ||
eb353acc RG |
350 | install_ixfrdist() { |
351 | run "sudo apt-get -qq --no-install-recommends install \ | |
352 | libyaml-cpp-dev" | |
353 | } | |
354 | ||
bf6096f5 PL |
355 | install_recursor() { |
356 | # recursor test requirements / setup | |
97ab616e RG |
357 | # lua-posix is required for the ghost tests |
358 | # (used by the prequery script in the auth) | |
bf6096f5 PL |
359 | run "sudo apt-get -qq --no-install-recommends install \ |
360 | authbind \ | |
361 | daemontools \ | |
7c114c00 | 362 | jq \ |
cb54e9b5 | 363 | libfaketime \ |
7c114c00 | 364 | libsnmp-dev \ |
97ab616e | 365 | lua-posix \ |
bf6096f5 | 366 | moreutils \ |
7c114c00 | 367 | snmpd" |
bf6096f5 | 368 | run "cd .." |
8a27076c | 369 | run "wget http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip" |
1e0253ca | 370 | run "unzip top-1m.csv.zip -d ${TRAVIS_BUILD_DIR}/regression-tests" |
8a27076c | 371 | run 'echo -e "deb [arch=amd64] http://repo.powerdns.com/ubuntu trusty-auth-master main" | sudo tee /etc/apt/sources.list.d/pdns.list' |
372 | run 'echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 9001" | sudo tee /etc/apt/preferences.d/pdns' | |
373 | run 'curl https://repo.powerdns.com/CBC8B383-pub.asc | sudo apt-key add - ' | |
dad54543 PL |
374 | run 'sudo apt-get update' |
375 | run 'sudo apt-get -y install pdns-server pdns-tools' | |
e07dae82 | 376 | run "sudo service pdns stop" |
bf6096f5 PL |
377 | run 'for suffix in {1..40}; do sudo /sbin/ip addr add 10.0.3.$suffix/32 dev lo; done' |
378 | run "sudo touch /etc/authbind/byport/53" | |
379 | run "sudo chmod 755 /etc/authbind/byport/53" | |
1e0253ca | 380 | run "cd ${TRAVIS_BUILD_DIR}" |
aa7a54c9 RG |
381 | # install SNMP |
382 | run "sudo sed -i \"s/agentxperms 0700 0755 recursor/agentxperms 0700 0755 ${USER}/g\" regression-tests.recursor-dnssec/snmpd.conf" | |
383 | run "sudo cp -f regression-tests.recursor-dnssec/snmpd.conf /etc/snmp/snmpd.conf" | |
384 | run "sudo service snmpd restart" | |
385 | ## fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so.. | |
386 | run "sudo chmod 0755 /var/agentx" | |
bf6096f5 PL |
387 | } |
388 | ||
389 | install_dnsdist() { | |
35d883a8 | 390 | # test requirements / setup |
82a91ddf CH |
391 | run "sudo add-apt-repository -y ppa:zeha/libfstrm-ppa" |
392 | run 'curl "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x396160EF8126A2E2" | sudo apt-key add - ' | |
393 | run "sudo apt-get -qq update" | |
9f4eb5cc RG |
394 | run "sudo apt-get -qq --no-install-recommends install \ |
395 | snmpd \ | |
82a91ddf CH |
396 | libsnmp-dev \ |
397 | libfstrm-dev" | |
9f4eb5cc RG |
398 | run "sudo sed -i \"s/agentxperms 0700 0755 dnsdist/agentxperms 0700 0755 ${USER}/g\" regression-tests.dnsdist/snmpd.conf" |
399 | run "sudo cp -f regression-tests.dnsdist/snmpd.conf /etc/snmp/snmpd.conf" | |
400 | run "sudo service snmpd restart" | |
401 | # fun story, the directory perms are only applied if it doesn't exist yet, and it is created by the init script, so.. | |
402 | run "sudo chmod 0755 /var/agentx" | |
bf6096f5 PL |
403 | } |
404 | ||
d5d421b3 JS |
405 | check_for_dangling_symlinks() { |
406 | run '! find -L . -name missing-sources -prune -o ! -name pubsuffix.cc -type l | grep .' | |
407 | } | |
408 | ||
bf6096f5 | 409 | build_auth() { |
48c7cae9 | 410 | run "autoreconf -vi" |
e9ccf0f7 | 411 | run "./configure \ |
040e40bb | 412 | ${sanitizerflags} \ |
42f1f726 | 413 | --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 ldap lmdb lua mydns opendbx pipe random remote tinydns godbc lua2' \ |
bf6096f5 PL |
414 | --with-modules='' \ |
415 | --with-sqlite3 \ | |
cb264691 | 416 | --with-libsodium \ |
bf6096f5 PL |
417 | --enable-experimental-pkcs11 \ |
418 | --enable-remotebackend-zeromq \ | |
419 | --enable-tools \ | |
420 | --enable-unit-tests \ | |
421 | --enable-backend-unit-tests \ | |
84f3c7d3 | 422 | --enable-fuzz-targets \ |
bf6096f5 | 423 | --disable-dependency-tracking \ |
42f1f726 | 424 | --disable-silent-rules \ |
425 | --with-lmdb=/usr" | |
bf6096f5 PL |
426 | run "make -k dist" |
427 | run "make -k -j3" | |
428 | run "make -k install DESTDIR=/tmp/pdns-install-dir" | |
429 | run "find /tmp/pdns-install-dir -ls" | |
430 | } | |
431 | ||
eb353acc RG |
432 | build_ixfrdist() { |
433 | run "autoreconf -vi" | |
434 | run "./configure \ | |
435 | ${sanitizerflags} \ | |
436 | --with-dynmodules='bind' \ | |
437 | --with-modules='' \ | |
438 | --enable-ixfrdist \ | |
439 | --enable-unit-tests \ | |
440 | --disable-dependency-tracking \ | |
441 | --disable-silent-rules" | |
8f9ca3a1 | 442 | run "make -C ext -k -j3" |
eb353acc RG |
443 | run "cd pdns" |
444 | run "make -k -j3 ixfrdist" | |
445 | run "cd .." | |
446 | } | |
447 | ||
bf6096f5 PL |
448 | build_recursor() { |
449 | export PDNS_RECURSOR_DIR=$HOME/pdns_recursor | |
d5d421b3 JS |
450 | run "cd pdns/recursordist" |
451 | check_for_dangling_symlinks | |
452 | run "cd ../.." | |
bf6096f5 PL |
453 | # distribution build |
454 | run "./build-scripts/dist-recursor" | |
455 | run "cd pdns/recursordist" | |
456 | run "tar xf pdns-recursor-*.tar.bz2" | |
457 | run "rm -f pdns-recursor-*.tar.bz2" | |
458 | run "cd pdns-recursor-*" | |
1e0a958b | 459 | run "./configure \ |
040e40bb | 460 | ${sanitizerflags} \ |
bf6096f5 | 461 | --prefix=$PDNS_RECURSOR_DIR \ |
cb264691 | 462 | --with-libsodium \ |
35d883a8 | 463 | --enable-unit-tests \ |
af1377b7 | 464 | --enable-nod \ |
bf6096f5 PL |
465 | --disable-silent-rules" |
466 | run "make -k -j3" | |
467 | run "make install" | |
468 | run "find $PDNS_RECURSOR_DIR -ls" | |
469 | run "cd ../../.." | |
470 | } | |
471 | ||
472 | build_dnsdist(){ | |
d5d421b3 JS |
473 | run "cd pdns/dnsdistdist" |
474 | check_for_dangling_symlinks | |
475 | run "cd ../.." | |
bf6096f5 PL |
476 | run "./build-scripts/dist-dnsdist" |
477 | run "cd pdns/dnsdistdist" | |
478 | run "tar xf dnsdist*.tar.bz2" | |
479 | run "cd dnsdist-*" | |
e9ccf0f7 | 480 | run "./configure \ |
040e40bb | 481 | ${sanitizerflags} \ |
bf6096f5 | 482 | --enable-unit-tests \ |
cb264691 | 483 | --with-libsodium \ |
bf6096f5 | 484 | --enable-dnscrypt \ |
a227f47d | 485 | --enable-dns-over-tls \ |
3bbbeb11 | 486 | --enable-dnstap \ |
bf6096f5 PL |
487 | --prefix=$HOME/dnsdist \ |
488 | --disable-silent-rules" | |
489 | run "make -k -j3" | |
490 | run "./testrunner" | |
491 | run "make install" | |
492 | run "cd ../../.." | |
493 | run "find $HOME/dnsdist -ls" | |
494 | run "rm -rf pdns/dnsdistdist/dnsdist-*/" | |
495 | ||
496 | } | |
497 | ||
bf6096f5 | 498 | test_auth() { |
488c8611 | 499 | run "make -j3 check || (cat pdns/test-suite.log; false)" |
bf6096f5 PL |
500 | run "test -f pdns/test-suite.log && cat pdns/test-suite.log || true" |
501 | run "test -f modules/remotebackend/test-suite.log && cat modules/remotebackend/test-suite.log || true" | |
502 | ||
503 | #DNSName - make -k -j3 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns') | |
8695de46 | 504 | run 'make -k -j3 -C pdns $(grep "(EXEEXT):" pdns/Makefile | cut -f1 -d\$)' |
bf6096f5 PL |
505 | |
506 | run "cd pdns" | |
507 | run "./pdnsutil test-algorithms" | |
508 | run "cd .." | |
509 | ||
510 | run "cd regression-tests" | |
511 | ||
b6072c01 KM |
512 | #travis unbound is too old for this test (unbound 1.6.0 required) |
513 | run "touch tests/ent-asterisk/fail.nsec" | |
514 | ||
bf6096f5 PL |
515 | run "./timestamp ./start-test-stop 5300 ldap-tree" |
516 | run "./timestamp ./start-test-stop 5300 ldap-simple" | |
517 | run "./timestamp ./start-test-stop 5300 ldap-strict" | |
518 | ||
519 | run "./timestamp ./start-test-stop 5300 bind-both" | |
520 | run "./timestamp ./start-test-stop 5300 bind-dnssec-both" | |
521 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both" | |
522 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both" | |
523 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow" | |
524 | run "./timestamp ./start-test-stop 5300 bind-hybrid-nsec3" | |
525 | #ecdsa - ./timestamp ./start-test-stop 5300 bind-dnssec-pkcs11 | |
526 | ||
bf6096f5 PL |
527 | run "./timestamp ./start-test-stop 5300 geoip" |
528 | run "./timestamp ./start-test-stop 5300 geoip-nsec3-narrow" | |
effa40ed AT |
529 | run "export geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb" |
530 | run "./timestamp ./start-test-stop 5300 geoip" | |
bf6096f5 PL |
531 | |
532 | run "./timestamp ./start-test-stop 5300 gmysql-nodnssec-both" | |
533 | run "./timestamp ./start-test-stop 5300 gmysql-both" | |
534 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-both" | |
535 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both" | |
536 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow" | |
537 | ||
538 | run "export GODBC_SQLITE3_DSN=pdns-sqlite3-1" | |
3a435d2e | 539 | run "./timestamp ./start-test-stop 5300 godbc_sqlite3-nsec3" |
bf6096f5 PL |
540 | |
541 | run "./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both" | |
542 | run "./timestamp ./start-test-stop 5300 gpgsql-both" | |
543 | run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-both" | |
ce4cbc87 OM |
544 | #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both" |
545 | #run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow" | |
bf6096f5 PL |
546 | |
547 | run "./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both" | |
548 | run "./timestamp ./start-test-stop 5300 gsqlite3-both" | |
549 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both" | |
550 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both" | |
551 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow" | |
552 | ||
553 | run "./timestamp ./start-test-stop 5300 mydns" | |
554 | ||
555 | run "./timestamp ./start-test-stop 5300 opendbx-sqlite3" | |
556 | ||
557 | run "./timestamp ./start-test-stop 5300 remotebackend-pipe" | |
558 | run "./timestamp ./start-test-stop 5300 remotebackend-pipe-dnssec" | |
ce4cbc87 | 559 | #run "./timestamp ./start-test-stop 5300 remotebackend-unix" |
bf6096f5 | 560 | run "./timestamp ./start-test-stop 5300 remotebackend-unix-dnssec" |
ce4cbc87 | 561 | #run "./timestamp ./start-test-stop 5300 remotebackend-http" |
bf6096f5 | 562 | run "./timestamp ./start-test-stop 5300 remotebackend-http-dnssec" |
ce4cbc87 | 563 | #run "./timestamp ./start-test-stop 5300 remotebackend-zeromq" |
bf6096f5 PL |
564 | run "./timestamp ./start-test-stop 5300 remotebackend-zeromq-dnssec" |
565 | ||
566 | run "./timestamp ./start-test-stop 5300 tinydns" | |
b6072c01 | 567 | |
42f1f726 | 568 | run "./timestamp ./start-test-stop 5300 lmdb-nodnssec-both" |
569 | run "./timestamp ./start-test-stop 5300 lmdb-both" | |
570 | run "./timestamp ./start-test-stop 5300 lmdb-nsec3-both" | |
571 | run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both" | |
572 | ||
b6072c01 KM |
573 | run "rm tests/ent-asterisk/fail.nsec" |
574 | ||
8cce0396 KM |
575 | run "cd ../modules/luabackend/test2" |
576 | run "../../../regression-tests/timestamp ./runtest" | |
577 | ||
578 | run "cd ../../.." | |
bf6096f5 PL |
579 | |
580 | run "cd regression-tests.rootzone" | |
581 | run "./timestamp ./start-test-stop 5300 bind-both" | |
582 | run "./timestamp ./start-test-stop 5300 bind-dnssec-both" | |
583 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both" | |
584 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both" | |
585 | run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow" | |
586 | run "./timestamp ./start-test-stop 5300 bind-hybrid-nsec3" | |
587 | ||
588 | run "./timestamp ./start-test-stop 5300 gmysql-nodnssec-both" | |
589 | run "./timestamp ./start-test-stop 5300 gmysql-both" | |
590 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-both" | |
591 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-optout-both" | |
592 | run "./timestamp ./start-test-stop 5300 gmysql-nsec3-narrow" | |
593 | ||
594 | run "./timestamp ./start-test-stop 5300 gpgsql-nodnssec-both" | |
595 | run "./timestamp ./start-test-stop 5300 gpgsql-both" | |
596 | run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-both" | |
597 | run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-optout-both" | |
598 | run "./timestamp ./start-test-stop 5300 gpgsql-nsec3-narrow" | |
599 | ||
600 | run "./timestamp ./start-test-stop 5300 gsqlite3-nodnssec-both" | |
601 | run "./timestamp ./start-test-stop 5300 gsqlite3-both" | |
602 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both" | |
603 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both" | |
604 | run "./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow" | |
605 | ||
6f09dd5d AT |
606 | run "./timestamp ./start-test-stop 5300 lua2" |
607 | run "./timestamp ./start-test-stop 5300 lua2-dnssec" | |
608 | ||
42f1f726 | 609 | run "./timestamp ./start-test-stop 5300 lmdb-both" |
610 | run "./timestamp ./start-test-stop 5300 lmdb-nodnssec-both" | |
611 | run "./timestamp ./start-test-stop 5300 lmdb-nsec3-both" | |
612 | run "./timestamp ./start-test-stop 5300 lmdb-nsec3-optout-both" | |
613 | ||
bf6096f5 PL |
614 | run "cd .." |
615 | ||
616 | ### api ### | |
617 | run "cd regression-tests.api" | |
618 | run "./runtests authoritative" | |
619 | run "cd .." | |
620 | ||
621 | ### no backend tests ### | |
622 | run "cd regression-tests.nobackend/" | |
623 | run "./runtests" | |
624 | run "test ! -s ./failed_tests" | |
625 | run "cd .." | |
626 | ||
2b3cdcc0 CHB |
627 | ### Lua rec tests ### |
628 | run "cd regression-tests.auth-py" | |
005d7627 | 629 | run "./runtests -v || (cat ./configs/auth/pdns.log; false)" |
2b3cdcc0 CHB |
630 | run "cd .." |
631 | ||
bf6096f5 PL |
632 | run "rm -f regression-tests/zones/*-slave.*" #FIXME |
633 | } | |
634 | ||
eb353acc RG |
635 | test_ixfrdist(){ |
636 | run "cd regression-tests.ixfrdist" | |
637 | run "IXFRDISTBIN=${TRAVIS_BUILD_DIR}/pdns/ixfrdist ./runtests -v || (cat ixfrdist.log; false)" | |
638 | run "cd .." | |
639 | } | |
640 | ||
bf6096f5 PL |
641 | test_recursor() { |
642 | export PDNSRECURSOR="${PDNS_RECURSOR_DIR}/sbin/pdns_recursor" | |
bf6096f5 PL |
643 | export DNSBULKTEST="/usr/bin/dnsbulktest" |
644 | export RECCONTROL="${PDNS_RECURSOR_DIR}/bin/rec_control" | |
35d883a8 | 645 | run "cd pdns/recursordist/pdns-recursor-*" |
6aac061c | 646 | run "make -j 3 check || (cat test-suite.log; false)" |
35d883a8 | 647 | run "cd ${TRAVIS_BUILD_DIR}" |
7568b07d PL |
648 | run "./build-scripts/test-recursor" |
649 | export RECURSOR="${PDNSRECURSOR}" | |
bf6096f5 | 650 | run "cd regression-tests" |
280c2f89 | 651 | run "THRESHOLD=50 TRACE=no ./timestamp ./recursor-test 5300 50000" |
bf6096f5 | 652 | run "cd .." |
7568b07d | 653 | |
bf6096f5 PL |
654 | run "cd regression-tests.api" |
655 | run "./runtests recursor" | |
656 | run "cd .." | |
657 | } | |
658 | ||
bf6096f5 PL |
659 | test_dnsdist(){ |
660 | run "cd regression-tests.dnsdist" | |
661 | run "DNSDISTBIN=$HOME/dnsdist/bin/dnsdist ./runtests -v" | |
662 | run "rm -f ./DNSCryptResolver.cert ./DNSCryptResolver.key" | |
663 | run "cd .." | |
664 | } | |
665 | ||
666 | test_repo(){ | |
667 | run "git status" | |
668 | run "git status | grep -q clean" | |
669 | } | |
670 | ||
671 | # global build requirements | |
672 | run "sudo apt-get -qq --no-install-recommends install \ | |
673 | libboost-all-dev \ | |
3a086960 | 674 | libluajit-5.1-dev \ |
bf6096f5 | 675 | libedit-dev \ |
0a4a38ab | 676 | libprotobuf-dev \ |
0a4a38ab | 677 | protobuf-compiler" |
bf6096f5 PL |
678 | |
679 | run "cd .." | |
680 | run "wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb" | |
681 | run "wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium13_1.0.3-1~ppa14.04+1_amd64.deb" | |
682 | 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" | |
1e0253ca | 683 | run "cd ${TRAVIS_BUILD_DIR}" |
bf6096f5 | 684 | |
e9ccf0f7 | 685 | compilerflags="-O1 -Werror=vla" |
040e40bb | 686 | sanitizerflags="" |
e9ccf0f7 PD |
687 | if [ "$CC" = "clang" ] |
688 | then | |
689 | compilerflags="$compilerflags -Werror=string-plus-int" | |
040e40bb RG |
690 | if [ "${PDNS_BUILD_PRODUCT}" = "recursor" ]; then |
691 | sanitizerflags="${sanitizerflags} --enable-asan" | |
692 | elif [ "${PDNS_BUILD_PRODUCT}" = "dnsdist" ]; then | |
693 | sanitizerflags="${sanitizerflags} --enable-asan --enable-ubsan" | |
eb353acc | 694 | elif [ "${PDNS_BUILD_PRODUCT}" = "ixfrdist" ]; then |
478ca077 | 695 | sanitizerflags="${sanitizerflags} --enable-asan --enable-ubsan" |
040e40bb | 696 | fi |
e9ccf0f7 PD |
697 | fi |
698 | export CFLAGS=$compilerflags | |
699 | export CXXFLAGS=$compilerflags | |
040e40bb | 700 | export sanitizerflags |
478ca077 RG |
701 | # We need a suppression for UndefinedBehaviorSanitizer with ixfrdist, |
702 | # because of a vptr bug fixed in Boost 1.57.0: | |
703 | # https://github.com/boostorg/any/commit/c92ab03ab35775b6aab30f6cdc3d95b7dd8fc5c6 | |
704 | export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1:suppressions=${TRAVIS_BUILD_DIR}/build-scripts/UBSan.supp" | |
e9ccf0f7 | 705 | |
bf6096f5 PL |
706 | install_$PDNS_BUILD_PRODUCT |
707 | ||
708 | build_$PDNS_BUILD_PRODUCT | |
709 | ||
710 | test_$PDNS_BUILD_PRODUCT | |
711 | ||
d2a4a399 | 712 | if [ $PDNS_BUILD_PRODUCT == "auth" ]; then |
bf6096f5 PL |
713 | test_repo |
714 | fi |