]>
Commit | Line | Data |
---|---|---|
99bb3530 PD |
1 | from invoke import task |
2 | from invoke.exceptions import Failure, UnexpectedExit | |
3 | ||
7ec6fb65 | 4 | import os |
99bb3530 PD |
5 | import sys |
6 | import time | |
7 | ||
8 | all_build_deps = [ | |
d3cb00f9 | 9 | 'ccache', |
99bb3530 PD |
10 | 'libboost-all-dev', |
11 | 'libluajit-5.1-dev', | |
12 | 'libsodium-dev', | |
13 | 'libssl-dev', | |
14 | 'libsystemd-dev', | |
15 | 'libtool', | |
16 | 'make', | |
17 | 'pkg-config', | |
18 | 'python3-venv', | |
19 | 'systemd', | |
20 | ] | |
21 | git_build_deps = [ | |
22 | 'autoconf', | |
23 | 'automake', | |
24 | 'bison', | |
25 | 'bzip2', | |
26 | 'curl', | |
27 | 'flex', | |
28 | 'git', | |
29 | 'ragel' | |
30 | ] | |
31 | auth_build_deps = [ # FIXME: perhaps we should be stealing these from the debian (Ubuntu) control file | |
32 | 'default-libmysqlclient-dev', | |
33 | 'libcdb-dev', | |
34 | 'libcurl4-openssl-dev', | |
35 | 'libgeoip-dev', | |
36 | 'libkrb5-dev', | |
37 | 'libldap2-dev', | |
38 | 'liblmdb-dev', | |
39 | 'libmaxminddb-dev', | |
40 | 'libp11-kit-dev', | |
41 | 'libpq-dev', | |
42 | 'libsqlite3-dev', | |
43 | 'libyaml-cpp-dev', | |
44 | 'libzmq3-dev', | |
45 | 'ruby-bundler', | |
46 | 'ruby-dev', | |
47 | 'sqlite3', | |
c204c9b3 | 48 | 'unixodbc-dev', |
99bb3530 PD |
49 | ] |
50 | rec_build_deps = [ | |
51 | 'libcap-dev', | |
52 | 'libfstrm-dev', | |
53 | 'libsnmp-dev', | |
54 | ] | |
4467dd85 O |
55 | rec_bulk_deps = [ |
56 | 'curl', | |
4467dd85 O |
57 | 'libboost-all-dev', |
58 | 'libcap2', | |
2b219e37 O |
59 | 'libfstrm0', |
60 | 'libluajit-5.1-2', | |
61 | 'libsnmp35', | |
62 | 'libsodium23', | |
4467dd85 O |
63 | 'libssl1.1', |
64 | 'libsystemd0', | |
2b219e37 O |
65 | 'moreutils', |
66 | 'pdns-tools', | |
67 | 'unzip' | |
4467dd85 | 68 | ] |
99bb3530 PD |
69 | dnsdist_build_deps = [ |
70 | 'libcap-dev', | |
71 | 'libcdb-dev', | |
72 | 'libedit-dev', | |
73 | 'libfstrm-dev', | |
79e3404d | 74 | 'libgnutls28-dev', |
99bb3530 PD |
75 | 'libh2o-evloop-dev', |
76 | 'liblmdb-dev', | |
ff4c1303 | 77 | 'libnghttp2-dev', |
99bb3530 PD |
78 | 'libre2-dev', |
79 | 'libsnmp-dev', | |
80 | ] | |
81 | auth_test_deps = [ # FIXME: we should be generating some of these from shlibdeps in build | |
82 | 'authbind', | |
83 | 'bc', | |
84 | 'bind9utils', | |
85 | 'curl', | |
86 | 'default-jre-headless', | |
87 | 'dnsutils', | |
bb4f68fd | 88 | 'docker-compose', |
222d17e2 | 89 | 'faketime', |
99bb3530 | 90 | 'gawk', |
bb4f68fd | 91 | 'krb5-user', |
99bb3530 PD |
92 | 'ldnsutils', |
93 | 'libboost-serialization1.71.0', | |
94 | 'libcdb1', | |
95 | 'libcurl4', | |
96 | 'libgeoip1', | |
97 | 'libkrb5-3', | |
98 | 'libldap-2.4-2', | |
99 | 'liblmdb0', | |
100 | 'libluajit-5.1-2', | |
101 | 'libmaxminddb0', | |
102 | 'libnet-dns-perl', | |
103 | 'libp11-kit0', | |
104 | 'libpq5', | |
105 | 'libsodium23', | |
106 | 'libsqlite3-dev', | |
107 | 'libssl1.1', | |
108 | 'libsystemd0', | |
109 | 'libyaml-cpp0.6', | |
110 | 'libzmq3-dev', | |
0e77de07 PD |
111 | 'ruby-bundler', |
112 | 'ruby-dev', | |
99bb3530 PD |
113 | 'socat', |
114 | 'softhsm2', | |
115 | 'unbound-host', | |
116 | 'unixodbc', | |
117 | 'wget' | |
118 | ] | |
119 | ||
120 | @task | |
121 | def apt_fresh(c): | |
122 | c.sudo('apt-get update') | |
7bc2748c | 123 | c.sudo('apt-get -qq -y --allow-downgrades dist-upgrade') |
99bb3530 PD |
124 | |
125 | @task | |
126 | def install_clang(c): | |
127 | """ | |
d0ec482a | 128 | install clang-12 and llvm-12 |
99bb3530 | 129 | """ |
d0ec482a | 130 | c.sudo('apt-get -qq -y --no-install-recommends install clang-12 llvm-12') |
99bb3530 PD |
131 | |
132 | @task | |
133 | def install_clang_runtime(c): | |
134 | # this gives us the symbolizer, for symbols in asan/ubsan traces | |
d0ec482a | 135 | c.sudo('apt-get -qq -y --no-install-recommends install clang-12') |
99bb3530 | 136 | |
d1c1159f FM |
137 | def install_libdecaf(c, product): |
138 | c.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf') | |
139 | with c.cd('/tmp/libdecaf'): | |
140 | c.run('git checkout 41f349') | |
141 | c.run('cmake -B build ' | |
142 | '-DCMAKE_INSTALL_PREFIX=/usr/local ' | |
143 | '-DCMAKE_INSTALL_LIBDIR=lib ' | |
144 | '-DENABLE_STATIC=OFF ' | |
145 | '-DENABLE_TESTS=OFF ' | |
146 | '-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" .') | |
147 | c.run('make -C build') | |
148 | c.run('sudo make -C build install') | |
149 | c.sudo(f'mkdir -p /opt/{product}/libdecaf') | |
150 | c.sudo(f'cp /usr/local/lib/libdecaf.so* /opt/{product}/libdecaf/.') | |
151 | ||
99bb3530 PD |
152 | @task |
153 | def install_auth_build_deps(c): | |
154 | c.sudo('apt-get install -qq -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + auth_build_deps)) | |
d1c1159f | 155 | install_libdecaf(c, 'pdns-auth') |
99bb3530 PD |
156 | |
157 | def setup_authbind(c): | |
158 | c.sudo('touch /etc/authbind/byport/53') | |
159 | c.sudo('chmod 755 /etc/authbind/byport/53') | |
160 | ||
161 | auth_backend_test_deps = dict( | |
162 | gsqlite3=['sqlite3'], | |
163 | gmysql=['default-libmysqlclient-dev'], | |
164 | gpgsql=['libpq-dev'], | |
0e77de07 | 165 | lmdb=[], |
b33a88da PD |
166 | remote=[], |
167 | bind=[], | |
168 | geoip=[], | |
169 | lua2=[], | |
222d17e2 PD |
170 | tinydns=[], |
171 | authpy=[] | |
99bb3530 PD |
172 | ) |
173 | ||
174 | @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend']) | |
175 | def install_auth_test_deps(c, backend): # FIXME: rename this, we do way more than apt-get | |
176 | extra=[] | |
177 | for b in backend: | |
178 | extra.extend(auth_backend_test_deps[b]) | |
179 | c.sudo('apt-get -y -qq install ' + ' '.join(extra+auth_test_deps)) | |
180 | ||
181 | c.run('chmod +x /opt/pdns-auth/bin/* /opt/pdns-auth/sbin/*') | |
182 | # c.run('''if [ ! -e $HOME/bin/jdnssec-verifyzone ]; then | |
183 | # wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz | |
184 | # tar xfz jdnssec-tools-0.14.tar.gz -C $HOME | |
185 | # rm jdnssec-tools-0.14.tar.gz | |
186 | # fi | |
187 | # echo 'export PATH=$HOME/jdnssec-tools-0.14/bin:$PATH' >> $BASH_ENV''') # FIXME: why did this fail with no error? | |
222d17e2 PD |
188 | c.run('touch regression-tests/tests/verify-dnssec-zone/allow-missing regression-tests.nobackend/rectify-axfr/allow-missing') # FIXME: can this go? |
189 | # FIXME we may want to start a background recursor here to make ALIAS tests more robust | |
99bb3530 PD |
190 | setup_authbind(c) |
191 | ||
d1c1159f FM |
192 | # Copy libdecaf out |
193 | c.sudo('mkdir -p /usr/local/lib') | |
194 | c.sudo('cp /opt/pdns-auth/libdecaf/libdecaf.so* /usr/local/lib/.') | |
195 | ||
4467dd85 O |
196 | @task |
197 | def install_rec_bulk_deps(c): # FIXME: rename this, we do way more than apt-get | |
198 | c.sudo('apt-get --no-install-recommends -qq -y install ' + ' '.join(rec_bulk_deps)) | |
199 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
200 | ||
99bb3530 PD |
201 | @task |
202 | def install_rec_test_deps(c): # FIXME: rename this, we do way more than apt-get | |
4467dd85 O |
203 | c.sudo('apt-get --no-install-recommends install -qq -y ' + ' '.join(rec_bulk_deps) + ' \ |
204 | pdns-server pdns-backend-bind daemontools \ | |
205 | jq libfaketime lua-posix lua-socket bc authbind \ | |
6b45d67b | 206 | python3-venv python3-dev default-libmysqlclient-dev libpq-dev \ |
4467dd85 | 207 | protobuf-compiler snmpd prometheus') |
99bb3530 PD |
208 | |
209 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
210 | ||
211 | setup_authbind(c) | |
212 | ||
6b45d67b O |
213 | c.run('sed "s/agentxperms 0700 0755 recursor/agentxperms 0777 0755/g" regression-tests.recursor-dnssec/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') |
214 | c.sudo('systemctl restart snmpd') | |
215 | time.sleep(5) | |
216 | c.sudo('chmod 755 /var/agentx') | |
217 | ||
99bb3530 PD |
218 | @task |
219 | def install_dnsdist_test_deps(c): # FIXME: rename this, we do way more than apt-get | |
220 | c.sudo('apt-get install -qq -y \ | |
221 | libluajit-5.1-2 \ | |
222 | libboost-all-dev \ | |
223 | libcap2 \ | |
224 | libcdb1 \ | |
225 | libcurl4-openssl-dev \ | |
226 | libfstrm0 \ | |
79e3404d | 227 | libgnutls30 \ |
99bb3530 PD |
228 | libh2o-evloop0.13 \ |
229 | liblmdb0 \ | |
ff4c1303 | 230 | libnghttp2-14 \ |
99bb3530 PD |
231 | libre2-5 \ |
232 | libssl-dev \ | |
233 | libsystemd0 \ | |
234 | libsodium23 \ | |
74a2ea87 | 235 | lua-socket \ |
99bb3530 PD |
236 | patch \ |
237 | protobuf-compiler \ | |
238 | python3-venv snmpd prometheus') | |
239 | c.run('sed "s/agentxperms 0700 0755 dnsdist/agentxperms 0777 0755/g" regression-tests.dnsdist/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') | |
240 | c.sudo('systemctl restart snmpd') | |
241 | time.sleep(5) | |
242 | c.sudo('chmod 755 /var/agentx') | |
243 | ||
244 | @task | |
245 | def install_rec_build_deps(c): | |
246 | c.sudo('apt-get install -qq -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + rec_build_deps)) | |
247 | ||
248 | @task | |
249 | def install_dnsdist_build_deps(c): | |
250 | c.sudo('apt-get install -qq -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + dnsdist_build_deps)) | |
251 | ||
252 | @task | |
253 | def ci_autoconf(c): | |
254 | c.run('BUILDER_VERSION=0.0.0-git1 autoreconf -vfi') | |
255 | ||
256 | @task | |
257 | def ci_auth_configure(c): | |
258 | res = c.run('''CFLAGS="-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int" \ | |
259 | CXXFLAGS="-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int -Wp,-D_GLIBCXX_ASSERTIONS" \ | |
260 | ./configure \ | |
d0ec482a O |
261 | CC='clang-12' \ |
262 | CXX='clang++-12' \ | |
d1c1159f | 263 | LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib' \ |
99bb3530 | 264 | --enable-option-checking=fatal \ |
9a205757 | 265 | --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' \ |
99bb3530 PD |
266 | --enable-systemd \ |
267 | --enable-tools \ | |
268 | --enable-unit-tests \ | |
269 | --enable-backend-unit-tests \ | |
270 | --enable-fuzz-targets \ | |
271 | --enable-experimental-pkcs11 \ | |
c0acf022 | 272 | --enable-experimental-gss-tsig \ |
99bb3530 PD |
273 | --enable-remotebackend-zeromq \ |
274 | --with-lmdb=/usr \ | |
275 | --with-libsodium \ | |
d1c1159f | 276 | --with-libdecaf \ |
99bb3530 PD |
277 | --prefix=/opt/pdns-auth \ |
278 | --enable-ixfrdist \ | |
279 | --enable-asan \ | |
280 | --enable-ubsan''', warn=True) | |
281 | if res.exited != 0: | |
282 | c.run('cat config.log') | |
283 | raise UnexpectedExit(res) | |
284 | @task | |
285 | def ci_rec_configure(c): | |
38529f81 | 286 | sanitizers = ' '.join('--enable-'+x for x in os.getenv('SANITIZERS').split('+')) |
99bb3530 PD |
287 | res = c.run(''' CFLAGS="-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int" \ |
288 | CXXFLAGS="-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int -Wp,-D_GLIBCXX_ASSERTIONS" \ | |
289 | ./configure \ | |
d0ec482a O |
290 | CC='clang-12' \ |
291 | CXX='clang++-12' \ | |
99bb3530 PD |
292 | --enable-option-checking=fatal \ |
293 | --enable-unit-tests \ | |
294 | --enable-nod \ | |
295 | --enable-systemd \ | |
296 | --prefix=/opt/pdns-recursor \ | |
297 | --with-libsodium \ | |
298 | --with-lua=luajit \ | |
299 | --with-libcap \ | |
300 | --with-net-snmp \ | |
38529f81 | 301 | --enable-dns-over-tls ''' + sanitizers, warn=True) |
99bb3530 PD |
302 | if res.exited != 0: |
303 | c.run('cat config.log') | |
304 | raise UnexpectedExit(res) | |
305 | ||
306 | @task | |
e3d6cf05 RG |
307 | def ci_dnsdist_configure(c, features): |
308 | additional_flags = '' | |
309 | if features == 'full': | |
310 | features_set = '--enable-dnstap \ | |
311 | --enable-dnscrypt \ | |
312 | --enable-dns-over-tls \ | |
313 | --enable-dns-over-https \ | |
314 | --enable-systemd \ | |
315 | --prefix=/opt/dnsdist \ | |
316 | --with-gnutls \ | |
317 | --with-libsodium \ | |
318 | --with-lua=luajit \ | |
319 | --with-libcap \ | |
320 | --with-nghttp2 \ | |
321 | --with-re2 ' | |
322 | else: | |
323 | features_set = '--disable-dnstap \ | |
324 | --disable-dnscrypt \ | |
325 | --disable-ipcipher \ | |
326 | --disable-systemd \ | |
327 | --without-cdb \ | |
328 | --without-ebpf \ | |
329 | --without-gnutls \ | |
330 | --without-libedit \ | |
331 | --without-libsodium \ | |
332 | --without-lmdb \ | |
333 | --without-net-snmp \ | |
6135a84e | 334 | --without-nghttp2 \ |
e3d6cf05 RG |
335 | --without-re2 ' |
336 | additional_flags = '-DDISABLE_COMPLETION \ | |
6b6f0aa6 RG |
337 | -DDISABLE_DELAY_PIPE \ |
338 | -DDISABLE_DYNBLOCKS \ | |
e3d6cf05 RG |
339 | -DDISABLE_PROMETHEUS \ |
340 | -DDISABLE_PROTOBUF \ | |
341 | -DDISABLE_BUILTIN_HTML \ | |
342 | -DDISABLE_CARBON \ | |
343 | -DDISABLE_SECPOLL \ | |
344 | -DDISABLE_DEPRECATED_DYNBLOCK \ | |
345 | -DDISABLE_LUA_WEB_HANDLERS \ | |
346 | -DDISABLE_NON_FFI_DQ_BINDINGS \ | |
347 | -DDISABLE_POLICIES_BINDINGS \ | |
348 | -DDISABLE_PACKETCACHE_BINDINGS \ | |
349 | -DDISABLE_DOWNSTREAM_BINDINGS \ | |
350 | -DDISABLE_COMBO_ADDR_BINDINGS \ | |
351 | -DDISABLE_CLIENT_STATE_BINDINGS \ | |
352 | -DDISABLE_QPS_LIMITER_BINDINGS \ | |
353 | -DDISABLE_SUFFIX_MATCH_BINDINGS \ | |
354 | -DDISABLE_NETMASK_BINDINGS \ | |
355 | -DDISABLE_DNSNAME_BINDINGS \ | |
356 | -DDISABLE_DNSHEADER_BINDINGS \ | |
357 | -DDISABLE_RECVMMSG \ | |
358 | -DDISABLE_WEB_CONFIG \ | |
359 | -DDISABLE_RULES_ALTERING_QUERIES \ | |
360 | -DDISABLE_ECS_ACTIONS \ | |
dbefe674 RG |
361 | -DDISABLE_TOP_N_BINDINGS \ |
362 | -DDISABLE_OCSP_STAPLING \ | |
363 | -DDISABLE_HASHED_CREDENTIALS \ | |
364 | -DDISABLE_FALSE_SHARING_PADDING \ | |
365 | -DDISABLE_NPN' | |
7ec6fb65 | 366 | sanitizers = ' '.join('--enable-'+x for x in os.getenv('SANITIZERS').split('+')) |
e3d6cf05 RG |
367 | cflags = '-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int' |
368 | cxxflags = cflags + ' -Wp,-D_GLIBCXX_ASSERTIONS ' + additional_flags | |
369 | res = c.run('''CFLAGS="%s" \ | |
370 | CXXFLAGS="%s" \ | |
99bb3530 | 371 | ./configure \ |
d0ec482a O |
372 | CC='clang-12' \ |
373 | CXX='clang++-12' \ | |
99bb3530 PD |
374 | --enable-option-checking=fatal \ |
375 | --enable-unit-tests \ | |
26c06327 | 376 | --prefix=/opt/dnsdist %s %s''' % (cflags, cxxflags, features_set, sanitizers), warn=True) |
99bb3530 PD |
377 | if res.exited != 0: |
378 | c.run('cat config.log') | |
379 | raise UnexpectedExit(res) | |
380 | ||
381 | @task | |
382 | def ci_auth_make(c): | |
383 | c.run('make -j8 -k V=1') | |
384 | ||
385 | @task | |
386 | def ci_rec_make(c): | |
387 | c.run('make -j8 -k V=1') | |
388 | ||
389 | @task | |
390 | def ci_dnsdist_make(c): | |
391 | c.run('make -j4 -k V=1') | |
392 | ||
393 | @task | |
e55d3a4b | 394 | def ci_auth_install_remotebackend_test_deps(c): |
99bb3530 | 395 | with c.cd('modules/remotebackend'): |
0e77de07 PD |
396 | # c.run('bundle config set path vendor/bundle') |
397 | c.run('sudo ruby -S bundle install') | |
e55d3a4b | 398 | c.sudo('apt-get install -qq -y socat') |
99bb3530 PD |
399 | |
400 | @task | |
401 | def ci_auth_run_unit_tests(c): | |
402 | res = c.run('make check', warn=True) | |
403 | if res.exited != 0: | |
222d17e2 PD |
404 | c.run('cat pdns/test-suite.log', warn=True) |
405 | c.run('cat modules/remotebackend/test-suite.log', warn=True) | |
99bb3530 PD |
406 | raise UnexpectedExit(res) |
407 | ||
408 | @task | |
409 | def ci_rec_run_unit_tests(c): | |
410 | res = c.run('make check', warn=True) | |
411 | if res.exited != 0: | |
412 | c.run('cat test-suite.log') | |
413 | raise UnexpectedExit(res) | |
414 | ||
415 | @task | |
416 | def ci_dnsdist_run_unit_tests(c): | |
417 | res = c.run('make check', warn=True) | |
418 | if res.exited != 0: | |
419 | c.run('cat test-suite.log') | |
420 | raise UnexpectedExit(res) | |
421 | ||
422 | @task | |
423 | def ci_make_install(c): | |
424 | res = c.run('make install') # FIXME: this builds auth docs - again | |
425 | ||
426 | @task | |
427 | def add_auth_repo(c): | |
428 | dist = 'ubuntu' # FIXME take these from the caller? | |
429 | release = 'focal' | |
430 | version = '44' | |
431 | ||
432 | c.sudo('apt-get install -qq -y curl gnupg2') | |
433 | if version == 'master': | |
434 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/CBC8B383-pub.asc') | |
435 | else: | |
436 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/FD380FBB-pub.asc') | |
437 | c.run(f"echo 'deb [arch=amd64] http://repo.powerdns.com/{dist} {release}-auth-{version} main' | sudo tee /etc/apt/sources.list.d/pdns.list") | |
438 | c.run("echo 'Package: pdns-*' | sudo tee /etc/apt/preferences.d/pdns") | |
439 | c.run("echo 'Pin: origin repo.powerdns.com' | sudo tee -a /etc/apt/preferences.d/pdns") | |
440 | c.run("echo 'Pin-Priority: 600' | sudo tee -a /etc/apt/preferences.d/pdns") | |
441 | c.sudo('apt-get update') | |
442 | ||
443 | @task | |
444 | def test_api(c, product, backend=''): | |
445 | if product == 'recursor': | |
446 | with c.cd('regression-tests.api'): | |
447 | c.run(f'PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor ./runtests recursor {backend}') | |
448 | elif product == 'auth': | |
449 | with c.cd('regression-tests.api'): | |
450 | c.run(f'PDNSSERVER=/opt/pdns-auth/sbin/pdns_server PDNSUTIL=/opt/pdns-auth/bin/pdnsutil SDIG=/opt/pdns-auth/bin/sdig MYSQL_HOST="127.0.0.1" PGHOST="127.0.0.1" PGPORT="5432" ./runtests authoritative {backend}') | |
451 | else: | |
452 | raise Failure('unknown product') | |
453 | ||
0e77de07 | 454 | backend_regress_tests = dict( |
b33a88da PD |
455 | bind = [ |
456 | 'bind-both', | |
457 | 'bind-dnssec-both', | |
458 | 'bind-dnssec-nsec3-both', | |
459 | 'bind-dnssec-nsec3-optout-both', | |
460 | 'bind-dnssec-nsec3-narrow', | |
461 | # FIXME 'bind-dnssec-pkcs11' | |
462 | ], | |
463 | geoip = [ | |
464 | 'geoip', | |
465 | 'geoip-nsec3-narrow' | |
466 | # FIXME: also run this with the mmdb we ship | |
467 | ], | |
468 | lua2 = [ | |
469 | 'lua2', | |
470 | 'lua2-dnssec' | |
471 | ], | |
472 | tinydns = [ | |
473 | 'tinydns' | |
474 | ], | |
475 | remote = [ | |
476 | 'remotebackend-pipe', | |
477 | 'remotebackend-unix', | |
478 | 'remotebackend-http', | |
479 | 'remotebackend-zeromq', | |
480 | 'remotebackend-pipe-dnssec', | |
481 | 'remotebackend-unix-dnssec', | |
482 | 'remotebackend-http-dnssec', | |
483 | 'remotebackend-zeromq-dnssec' | |
484 | ], | |
485 | lmdb = [ | |
486 | 'lmdb-nodnssec-both', | |
487 | 'lmdb-both', | |
488 | 'lmdb-nsec3-both', | |
489 | 'lmdb-nsec3-optout-both', | |
490 | 'lmdb-nsec3-narrow' | |
491 | ], | |
492 | gmysql = ['gmysql', 'gmysql-nodnssec-both', 'gmysql-nsec3-both', 'gmysql-nsec3-optout-both', 'gmysql-nsec3-narrow', 'gmysql_sp-both'], | |
493 | gpgsql = ['gpgsql', 'gpgsql-nodnssec-both', 'gpgsql-nsec3-both', 'gpgsql-nsec3-optout-both', 'gpgsql-nsec3-narrow', 'gpgsql_sp-both'], | |
494 | gsqlite3 = ['gsqlite3', 'gsqlite3-nodnssec-both', 'gsqlite3-nsec3-both', 'gsqlite3-nsec3-optout-both', 'gsqlite3-nsec3-narrow'], | |
0e77de07 PD |
495 | ) |
496 | ||
497 | @task | |
498 | def test_auth_backend(c, backend): | |
499 | if backend == 'remote': | |
e55d3a4b | 500 | ci_auth_install_remotebackend_test_deps(c) |
0e77de07 | 501 | |
222d17e2 PD |
502 | if backend == 'authpy': |
503 | with c.cd('regression-tests.auth-py'): | |
bb4f68fd | 504 | c.run(f'PDNS=/opt/pdns-auth/sbin/pdns_server PDNS2=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig NOTIFY=/opt/pdns-auth/bin/pdns_notify NSEC3DIG=/opt/pdns-auth/bin/nsec3dig SAXFR=/opt/pdns-auth/bin/saxfr ZONE2SQL=/opt/pdns-auth/bin/zone2sql ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap ZONE2JSON=/opt/pdns-auth/bin/zone2json PDNSUTIL=/opt/pdns-auth/bin/pdnsutil PDNSCONTROL=/opt/pdns-auth/bin/pdns_control PDNSSERVER=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig GMYSQLHOST=127.0.0.1 GMYSQL2HOST=127.0.0.1 MYSQL_HOST="127.0.0.1" PGHOST="127.0.0.1" PGPORT="5432" WITHKERBEROS=YES ./runtests') |
222d17e2 PD |
505 | return |
506 | ||
0e77de07 | 507 | with c.cd('regression-tests'): |
b33a88da PD |
508 | if backend == 'lua2': |
509 | c.run('touch trustedkeys') # avoid silly error during cleanup | |
510 | for variant in backend_regress_tests[backend]: | |
0e77de07 | 511 | # FIXME this long line is terrible |
222d17e2 PD |
512 | c.run(f'PDNS=/opt/pdns-auth/sbin/pdns_server PDNS2=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig NOTIFY=/opt/pdns-auth/bin/pdns_notify NSEC3DIG=/opt/pdns-auth/bin/nsec3dig SAXFR=/opt/pdns-auth/bin/saxfr ZONE2SQL=/opt/pdns-auth/bin/zone2sql ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap ZONE2JSON=/opt/pdns-auth/bin/zone2json PDNSUTIL=/opt/pdns-auth/bin/pdnsutil PDNSCONTROL=/opt/pdns-auth/bin/pdns_control PDNSSERVER=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig GMYSQLHOST=127.0.0.1 GMYSQL2HOST=127.0.0.1 MYSQL_HOST="127.0.0.1" PGHOST="127.0.0.1" PGPORT="5432" ./start-test-stop 5300 {variant}') |
513 | ||
514 | if backend == 'gsqlite3': | |
515 | with c.cd('regression-tests.nobackend'): | |
516 | c.run(f'PDNS=/opt/pdns-auth/sbin/pdns_server PDNS2=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig NOTIFY=/opt/pdns-auth/bin/pdns_notify NSEC3DIG=/opt/pdns-auth/bin/nsec3dig SAXFR=/opt/pdns-auth/bin/saxfr ZONE2SQL=/opt/pdns-auth/bin/zone2sql ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap ZONE2JSON=/opt/pdns-auth/bin/zone2json PDNSUTIL=/opt/pdns-auth/bin/pdnsutil PDNSCONTROL=/opt/pdns-auth/bin/pdns_control PDNSSERVER=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig GMYSQLHOST=127.0.0.1 GMYSQL2HOST=127.0.0.1 MYSQL_HOST="127.0.0.1" PGHOST="127.0.0.1" PGPORT="5432" ./runtests') | |
517 | c.run('/opt/pdns-auth/bin/pdnsutil test-algorithms') | |
518 | return | |
b33a88da PD |
519 | |
520 | @task | |
521 | def test_ixfrdist(c): | |
522 | with c.cd('regression-tests.ixfrdist'): | |
523 | c.run('IXFRDISTBIN=/opt/pdns-auth/bin/ixfrdist ./runtests') | |
0e77de07 | 524 | |
99bb3530 PD |
525 | @task |
526 | def test_dnsdist(c): | |
527 | c.run('chmod +x /opt/dnsdist/bin/*') | |
528 | c.run('ls -ald /var /var/agentx /var/agentx/master') | |
529 | c.run('ls -al /var/agentx/master') | |
530 | with c.cd('regression-tests.dnsdist'): | |
531 | c.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist ./runtests') | |
d3cb00f9 | 532 | |
6b45d67b O |
533 | @task |
534 | def test_regression_recursor(c): | |
535 | c.run('/opt/pdns-recursor/sbin/pdns_recursor --version') | |
6f1a3e76 | 536 | c.run('PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control SKIP_IPV6_TESTS=y ./build-scripts/test-recursor') |
6b45d67b O |
537 | |
538 | @task | |
375c8fd6 O |
539 | def test_bulk_recursor(c, threads, mthreads, shards): |
540 | # We run an extremely small version of the bulk test, as GH does not seem to be able to handle the UDP load | |
6b45d67b O |
541 | with c.cd('regression-tests'): |
542 | c.run('curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip') | |
543 | c.run('unzip top-1m.csv.zip -d .') | |
544 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
375c8fd6 | 545 | c.run(f'DNSBULKTEST=/usr/bin/dnsbulktest RECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control THRESHOLD=95 TRACE=no ./timestamp ./recursor-test 5300 100 {threads} {mthreads} {shards}') |
6b45d67b | 546 | |
dab788a9 PD |
547 | @task |
548 | def install_swagger_tools(c): | |
549 | c.run('npm install -g api-spec-converter') | |
550 | ||
551 | @task | |
552 | def swagger_syntax_check(c): | |
553 | c.run('api-spec-converter docs/http-api/swagger/authoritative-api-swagger.yaml -f swagger_2 -t openapi_3 -s json -c') | |
554 | ||
d3cb00f9 PD |
555 | # this is run always |
556 | def setup(): | |
557 | if '/usr/lib/ccache' not in os.environ['PATH']: | |
558 | os.environ['PATH']='/usr/lib/ccache:'+os.environ['PATH'] | |
559 | ||
560 | setup() |