]>
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 | ||
7d862cb3 AR |
8 | auth_backend_ip_addr = os.getenv('AUTH_BACKEND_IP_ADDR', '127.0.0.1') |
9 | ||
10 | clang_version = os.getenv('CLANG_VERSION', '13') | |
91a4477f RG |
11 | quiche_version = '0.20.0' |
12 | quiche_hash = '7125bc82ddcf38fbfbc69882ccb2723bfb4d5bfeb42718b8291d26ec06042e38' | |
7d862cb3 | 13 | |
99bb3530 | 14 | all_build_deps = [ |
d3cb00f9 | 15 | 'ccache', |
99bb3530 PD |
16 | 'libboost-all-dev', |
17 | 'libluajit-5.1-dev', | |
18 | 'libsodium-dev', | |
b69425da | 19 | 'libssl-dev', # This will install libssl 1.1 on Debian 11 and libssl3 on Debian 12 |
99bb3530 PD |
20 | 'libsystemd-dev', |
21 | 'libtool', | |
22 | 'make', | |
23 | 'pkg-config', | |
24 | 'python3-venv', | |
25 | 'systemd', | |
26 | ] | |
27 | git_build_deps = [ | |
28 | 'autoconf', | |
29 | 'automake', | |
30 | 'bison', | |
31 | 'bzip2', | |
32 | 'curl', | |
33 | 'flex', | |
34 | 'git', | |
35 | 'ragel' | |
36 | ] | |
37 | auth_build_deps = [ # FIXME: perhaps we should be stealing these from the debian (Ubuntu) control file | |
38 | 'default-libmysqlclient-dev', | |
39 | 'libcdb-dev', | |
40 | 'libcurl4-openssl-dev', | |
41 | 'libgeoip-dev', | |
42 | 'libkrb5-dev', | |
43 | 'libldap2-dev', | |
44 | 'liblmdb-dev', | |
45 | 'libmaxminddb-dev', | |
46 | 'libp11-kit-dev', | |
47 | 'libpq-dev', | |
48 | 'libsqlite3-dev', | |
49 | 'libyaml-cpp-dev', | |
50 | 'libzmq3-dev', | |
51 | 'ruby-bundler', | |
52 | 'ruby-dev', | |
53 | 'sqlite3', | |
9f930bd7 | 54 | 'unixodbc-dev', |
26cf02ca | 55 | 'cmake', |
99bb3530 PD |
56 | ] |
57 | rec_build_deps = [ | |
58 | 'libcap-dev', | |
59 | 'libfstrm-dev', | |
60 | 'libsnmp-dev', | |
61 | ] | |
4467dd85 O |
62 | rec_bulk_deps = [ |
63 | 'curl', | |
4467dd85 O |
64 | 'libboost-all-dev', |
65 | 'libcap2', | |
2b219e37 O |
66 | 'libfstrm0', |
67 | 'libluajit-5.1-2', | |
7d862cb3 | 68 | '"libsnmp[1-9]+"', |
2b219e37 | 69 | 'libsodium23', |
4467dd85 | 70 | 'libsystemd0', |
2b219e37 O |
71 | 'moreutils', |
72 | 'pdns-tools', | |
869fc2b5 | 73 | 'unzip', |
4467dd85 | 74 | ] |
99bb3530 PD |
75 | dnsdist_build_deps = [ |
76 | 'libcap-dev', | |
77 | 'libcdb-dev', | |
78 | 'libedit-dev', | |
79 | 'libfstrm-dev', | |
79e3404d | 80 | 'libgnutls28-dev', |
99bb3530 PD |
81 | 'libh2o-evloop-dev', |
82 | 'liblmdb-dev', | |
ff4c1303 | 83 | 'libnghttp2-dev', |
99bb3530 PD |
84 | 'libre2-dev', |
85 | 'libsnmp-dev', | |
86 | ] | |
c184b26a RG |
87 | dnsdist_xdp_build_deps = [ |
88 | 'libbpf-dev', | |
89 | 'libxdp-dev', | |
90 | ] | |
99bb3530 PD |
91 | auth_test_deps = [ # FIXME: we should be generating some of these from shlibdeps in build |
92 | 'authbind', | |
93 | 'bc', | |
94 | 'bind9utils', | |
95 | 'curl', | |
96 | 'default-jre-headless', | |
97 | 'dnsutils', | |
222d17e2 | 98 | 'faketime', |
99bb3530 | 99 | 'gawk', |
bb4f68fd | 100 | 'krb5-user', |
99bb3530 | 101 | 'ldnsutils', |
7d862cb3 | 102 | '"libboost-serialization1.7[1-9]+"', |
99bb3530 PD |
103 | 'libcdb1', |
104 | 'libcurl4', | |
105 | 'libgeoip1', | |
106 | 'libkrb5-3', | |
b69425da | 107 | '"libldap-2.[1-9]+"', |
99bb3530 PD |
108 | 'liblmdb0', |
109 | 'libluajit-5.1-2', | |
110 | 'libmaxminddb0', | |
111 | 'libnet-dns-perl', | |
112 | 'libp11-kit0', | |
113 | 'libpq5', | |
114 | 'libsodium23', | |
115 | 'libsqlite3-dev', | |
99bb3530 | 116 | 'libsystemd0', |
b69425da | 117 | '"libyaml-cpp0.[1-9]+"', |
99bb3530 | 118 | 'libzmq3-dev', |
3a52d52f | 119 | 'lmdb-utils', |
7c05901b | 120 | 'prometheus', |
0e77de07 PD |
121 | 'ruby-bundler', |
122 | 'ruby-dev', | |
99bb3530 PD |
123 | 'socat', |
124 | 'softhsm2', | |
125 | 'unbound-host', | |
126 | 'unixodbc', | |
869fc2b5 | 127 | 'wget', |
99bb3530 | 128 | ] |
e8d83f88 FM |
129 | doc_deps = [ |
130 | 'autoconf', | |
131 | 'automake', | |
132 | 'bison', | |
133 | 'curl', | |
134 | 'flex', | |
135 | 'g++', | |
136 | 'git', | |
137 | 'latexmk', | |
138 | 'libboost-all-dev', | |
139 | 'libedit-dev', | |
140 | 'libluajit-5.1-dev', | |
141 | 'libssl-dev', | |
142 | 'make', | |
143 | 'pkg-config', | |
144 | 'python3-venv', | |
145 | 'ragel', | |
146 | 'rsync', | |
147 | ] | |
148 | doc_deps_pdf = [ | |
149 | 'texlive-binaries', | |
150 | 'texlive-formats-extra', | |
151 | 'texlive-latex-extra', | |
152 | ] | |
99bb3530 PD |
153 | |
154 | @task | |
155 | def apt_fresh(c): | |
156 | c.sudo('apt-get update') | |
699d088a | 157 | c.sudo('apt-get -y --allow-downgrades dist-upgrade') |
99bb3530 PD |
158 | |
159 | @task | |
160 | def install_clang(c): | |
161 | """ | |
7d862cb3 | 162 | install clang and llvm |
99bb3530 | 163 | """ |
7d862cb3 | 164 | c.sudo(f'apt-get -y --no-install-recommends install clang-{clang_version} llvm-{clang_version}') |
99bb3530 | 165 | |
fae3e64c FM |
166 | @task |
167 | def install_clang_tidy_tools(c): | |
7d862cb3 | 168 | c.sudo(f'apt-get -y --no-install-recommends install clang-tidy-{clang_version} clang-tools-{clang_version} bear python3-yaml') |
fae3e64c | 169 | |
99bb3530 PD |
170 | @task |
171 | def install_clang_runtime(c): | |
172 | # this gives us the symbolizer, for symbols in asan/ubsan traces | |
7d862cb3 | 173 | c.sudo(f'apt-get -y --no-install-recommends install clang-{clang_version}') |
99bb3530 | 174 | |
9883d3f9 OM |
175 | @task |
176 | def ci_install_rust(c, repo): | |
c0500b19 | 177 | c.sudo(f'{repo}/builder-support/helpers/install_rust.sh') |
9883d3f9 | 178 | |
d1c1159f FM |
179 | def install_libdecaf(c, product): |
180 | c.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf') | |
181 | with c.cd('/tmp/libdecaf'): | |
182 | c.run('git checkout 41f349') | |
2ef73ca0 | 183 | c.run(f'CC={get_c_compiler()} CXX={get_cxx_compiler()} ' |
9466b8e6 | 184 | 'cmake -B build ' |
d1c1159f FM |
185 | '-DCMAKE_INSTALL_PREFIX=/usr/local ' |
186 | '-DCMAKE_INSTALL_LIBDIR=lib ' | |
187 | '-DENABLE_STATIC=OFF ' | |
188 | '-DENABLE_TESTS=OFF ' | |
189 | '-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" .') | |
190 | c.run('make -C build') | |
191 | c.run('sudo make -C build install') | |
192 | c.sudo(f'mkdir -p /opt/{product}/libdecaf') | |
193 | c.sudo(f'cp /usr/local/lib/libdecaf.so* /opt/{product}/libdecaf/.') | |
194 | ||
e8d83f88 FM |
195 | @task |
196 | def install_doc_deps(c): | |
699d088a | 197 | c.sudo('apt-get install -y ' + ' '.join(doc_deps)) |
e8d83f88 FM |
198 | |
199 | @task | |
200 | def install_doc_deps_pdf(c): | |
699d088a | 201 | c.sudo('apt-get install -y ' + ' '.join(doc_deps_pdf)) |
e8d83f88 | 202 | |
99bb3530 PD |
203 | @task |
204 | def install_auth_build_deps(c): | |
699d088a | 205 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + auth_build_deps)) |
825560a1 RG |
206 | if os.getenv('DECAF_SUPPORT', 'no') == 'yes': |
207 | install_libdecaf(c, 'pdns-auth') | |
99bb3530 | 208 | |
628a1dec RG |
209 | def is_coverage_enabled(): |
210 | sanitizers = os.getenv('SANITIZERS') | |
211 | if sanitizers: | |
212 | sanitizers = sanitizers.split('+') | |
213 | if 'tsan' in sanitizers: | |
214 | return False | |
215 | return os.getenv('COVERAGE') == 'yes' | |
216 | ||
7146a45a RG |
217 | def get_coverage(): |
218 | return '--enable-coverage=clang' if is_coverage_enabled() else '' | |
219 | ||
628a1dec RG |
220 | @task |
221 | def install_coverage_deps(c): | |
222 | if is_coverage_enabled(): | |
223 | c.sudo(f'apt-get install -y --no-install-recommends llvm-{clang_version}') | |
224 | ||
225 | @task | |
226 | def generate_coverage_info(c, binary, outputDir): | |
227 | if is_coverage_enabled(): | |
228 | version = os.getenv('BUILDER_VERSION') | |
229 | c.run(f'llvm-profdata-{clang_version} merge -sparse -o {outputDir}/temp.profdata /tmp/code-*.profraw') | |
230 | c.run(f'llvm-cov-{clang_version} export --format=lcov --ignore-filename-regex=\'^/usr/\' -instr-profile={outputDir}/temp.profdata -object {binary} > {outputDir}/coverage.lcov') | |
231 | c.run(f'{outputDir}/.github/scripts/normalize_paths_in_coverage.py {outputDir} {version} {outputDir}/coverage.lcov {outputDir}/normalized_coverage.lcov') | |
232 | c.run(f'mv {outputDir}/normalized_coverage.lcov {outputDir}/coverage.lcov') | |
233 | ||
99bb3530 PD |
234 | def setup_authbind(c): |
235 | c.sudo('touch /etc/authbind/byport/53') | |
236 | c.sudo('chmod 755 /etc/authbind/byport/53') | |
237 | ||
238 | auth_backend_test_deps = dict( | |
239 | gsqlite3=['sqlite3'], | |
240 | gmysql=['default-libmysqlclient-dev'], | |
241 | gpgsql=['libpq-dev'], | |
0e77de07 | 242 | lmdb=[], |
b33a88da PD |
243 | remote=[], |
244 | bind=[], | |
245 | geoip=[], | |
246 | lua2=[], | |
222d17e2 | 247 | tinydns=[], |
8af54cc6 AR |
248 | authpy=[], |
249 | godbc_sqlite3=['libsqliteodbc'], | |
c4a7e1df AR |
250 | godbc_mssql=['freetds-bin','tdsodbc'], |
251 | ldap=[], | |
252 | geoip_mmdb=[] | |
99bb3530 PD |
253 | ) |
254 | ||
255 | @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend']) | |
256 | def install_auth_test_deps(c, backend): # FIXME: rename this, we do way more than apt-get | |
257 | extra=[] | |
258 | for b in backend: | |
259 | extra.extend(auth_backend_test_deps[b]) | |
7d862cb3 | 260 | c.sudo('DEBIAN_FRONTEND=noninteractive apt-get -y install ' + ' '.join(extra+auth_test_deps)) |
99bb3530 PD |
261 | |
262 | c.run('chmod +x /opt/pdns-auth/bin/* /opt/pdns-auth/sbin/*') | |
263 | # c.run('''if [ ! -e $HOME/bin/jdnssec-verifyzone ]; then | |
264 | # wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz | |
265 | # tar xfz jdnssec-tools-0.14.tar.gz -C $HOME | |
266 | # rm jdnssec-tools-0.14.tar.gz | |
267 | # fi | |
268 | # echo 'export PATH=$HOME/jdnssec-tools-0.14/bin:$PATH' >> $BASH_ENV''') # FIXME: why did this fail with no error? | |
222d17e2 PD |
269 | c.run('touch regression-tests/tests/verify-dnssec-zone/allow-missing regression-tests.nobackend/rectify-axfr/allow-missing') # FIXME: can this go? |
270 | # FIXME we may want to start a background recursor here to make ALIAS tests more robust | |
99bb3530 PD |
271 | setup_authbind(c) |
272 | ||
825560a1 RG |
273 | if os.getenv('DECAF_SUPPORT', 'no') == 'yes': |
274 | # Copy libdecaf out | |
275 | c.sudo('mkdir -p /usr/local/lib') | |
276 | c.sudo('cp /opt/pdns-auth/libdecaf/libdecaf.so* /usr/local/lib/.') | |
d1c1159f | 277 | |
4467dd85 O |
278 | @task |
279 | def install_rec_bulk_deps(c): # FIXME: rename this, we do way more than apt-get | |
699d088a | 280 | c.sudo('apt-get --no-install-recommends -y install ' + ' '.join(rec_bulk_deps)) |
4467dd85 O |
281 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') |
282 | ||
99bb3530 PD |
283 | @task |
284 | def install_rec_test_deps(c): # FIXME: rename this, we do way more than apt-get | |
699d088a | 285 | c.sudo('apt-get --no-install-recommends install -y ' + ' '.join(rec_bulk_deps) + ' \ |
4467dd85 O |
286 | pdns-server pdns-backend-bind daemontools \ |
287 | jq libfaketime lua-posix lua-socket bc authbind \ | |
6b45d67b | 288 | python3-venv python3-dev default-libmysqlclient-dev libpq-dev \ |
4467dd85 | 289 | protobuf-compiler snmpd prometheus') |
99bb3530 PD |
290 | |
291 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
292 | ||
293 | setup_authbind(c) | |
294 | ||
6b45d67b | 295 | c.run('sed "s/agentxperms 0700 0755 recursor/agentxperms 0777 0755/g" regression-tests.recursor-dnssec/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') |
7d862cb3 | 296 | c.sudo('/etc/init.d/snmpd restart') |
6b45d67b O |
297 | time.sleep(5) |
298 | c.sudo('chmod 755 /var/agentx') | |
299 | ||
f941004d RG |
300 | @task(optional=['skipXDP']) |
301 | def install_dnsdist_test_deps(c, skipXDP=False): # FIXME: rename this, we do way more than apt-get | |
c184b26a RG |
302 | deps = 'libluajit-5.1-2 \ |
303 | libboost-all-dev \ | |
304 | libcap2 \ | |
305 | libcdb1 \ | |
306 | libcurl4-openssl-dev \ | |
307 | libfstrm0 \ | |
308 | libgnutls30 \ | |
309 | libh2o-evloop0.13 \ | |
310 | liblmdb0 \ | |
311 | libnghttp2-14 \ | |
312 | "libre2-[1-9]+" \ | |
313 | libssl-dev \ | |
314 | libsystemd0 \ | |
315 | libsodium23 \ | |
316 | lua-socket \ | |
317 | patch \ | |
318 | protobuf-compiler \ | |
319 | python3-venv snmpd prometheus' | |
f941004d RG |
320 | if not skipXDP: |
321 | deps = deps + '\ | |
322 | libbpf1 \ | |
c184b26a RG |
323 | libxdp1' |
324 | ||
325 | c.sudo(f'apt-get install -y {deps}') | |
99bb3530 | 326 | c.run('sed "s/agentxperms 0700 0755 dnsdist/agentxperms 0777 0755/g" regression-tests.dnsdist/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') |
7d862cb3 | 327 | c.sudo('/etc/init.d/snmpd restart') |
99bb3530 PD |
328 | time.sleep(5) |
329 | c.sudo('chmod 755 /var/agentx') | |
330 | ||
331 | @task | |
332 | def install_rec_build_deps(c): | |
699d088a | 333 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + rec_build_deps)) |
99bb3530 | 334 | |
c184b26a RG |
335 | @task(optional=['skipXDP']) |
336 | def install_dnsdist_build_deps(c, skipXDP=False): | |
f941004d | 337 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + dnsdist_build_deps + (dnsdist_xdp_build_deps if not skipXDP else []))) |
99bb3530 PD |
338 | |
339 | @task | |
340 | def ci_autoconf(c): | |
e917c86b | 341 | c.run('autoreconf -vfi') |
99bb3530 | 342 | |
fdcc46e4 OM |
343 | @task |
344 | def ci_docs_rec_generate(c): | |
345 | c.run('python3 generate.py') | |
346 | ||
e8d83f88 FM |
347 | @task |
348 | def ci_docs_build(c): | |
349 | c.run('make -f Makefile.sphinx -C docs html') | |
350 | ||
351 | @task | |
352 | def ci_docs_build_pdf(c): | |
353 | c.run('make -f Makefile.sphinx -C docs latexpdf') | |
354 | ||
355 | @task | |
e0ec64f1 | 356 | def ci_docs_upload_master(c, docs_host, pdf, username, product, directory=""): |
5d9b131b FM |
357 | rsync_cmd = " ".join([ |
358 | "rsync", | |
359 | "--checksum", | |
360 | "--recursive", | |
361 | "--verbose", | |
362 | "--no-p", | |
363 | "--chmod=g=rwX", | |
364 | "--exclude '*~'", | |
365 | ]) | |
366 | c.run(f"{rsync_cmd} --delete ./docs/_build/{product}-html-docs/ {username}@{docs_host}:{directory}") | |
367 | c.run(f"{rsync_cmd} ./docs/_build/{product}-html-docs.tar.bz2 {username}@{docs_host}:{directory}/html-docs.tar.bz2") | |
368 | c.run(f"{rsync_cmd} ./docs/_build/latex/{pdf} {username}@{docs_host}:{directory}") | |
e8d83f88 FM |
369 | |
370 | @task | |
371 | def ci_docs_add_ssh(c, ssh_key, host_key): | |
372 | c.run('mkdir -m 700 -p ~/.ssh') | |
373 | c.run(f'echo "{ssh_key}" > ~/.ssh/id_ed25519') | |
374 | c.run('chmod 600 ~/.ssh/id_ed25519') | |
375 | c.run(f'echo "{host_key}" > ~/.ssh/known_hosts') | |
376 | ||
8804bc1d FM |
377 | |
378 | def get_sanitizers(): | |
35859c0b | 379 | sanitizers = os.getenv('SANITIZERS', '') |
8804bc1d FM |
380 | if sanitizers != '': |
381 | sanitizers = sanitizers.split('+') | |
382 | sanitizers = ['--enable-' + sanitizer for sanitizer in sanitizers] | |
383 | sanitizers = ' '.join(sanitizers) | |
384 | return sanitizers | |
385 | ||
7146a45a RG |
386 | def get_unit_tests(auth=False): |
387 | if os.getenv('UNIT_TESTS') != 'yes': | |
388 | return '' | |
389 | return '--enable-unit-tests --enable-backend-unit-tests' if auth else '--enable-unit-tests' | |
390 | ||
391 | def get_build_concurrency(default=8): | |
392 | return os.getenv('CONCURRENCY', default) | |
393 | ||
394 | def get_fuzzing_targets(): | |
395 | return '--enable-fuzz-targets' if os.getenv('FUZZING_TARGETS') == 'yes' else '' | |
396 | ||
397 | def is_compiler_clang(): | |
c6034e81 | 398 | compiler = os.getenv('COMPILER', 'clang') |
7146a45a RG |
399 | return compiler == 'clang' |
400 | ||
401 | def get_c_compiler(): | |
402 | return f'clang-{clang_version}' if is_compiler_clang() else 'gcc' | |
2ef73ca0 RG |
403 | |
404 | def get_cxx_compiler(): | |
7146a45a | 405 | return f'clang++-{clang_version}' if is_compiler_clang() else 'g++' |
2ef73ca0 RG |
406 | |
407 | def get_optimizations(): | |
472404b9 RG |
408 | optimizations = os.getenv('OPTIMIZATIONS', 'yes') |
409 | return '-O1' if optimizations == 'yes' else '-O0' | |
8804bc1d FM |
410 | |
411 | def get_cflags(): | |
412 | return " ".join([ | |
2ef73ca0 | 413 | get_optimizations(), |
8804bc1d FM |
414 | "-Werror=vla", |
415 | "-Werror=shadow", | |
416 | "-Wformat=2", | |
417 | "-Werror=format-security", | |
11c5018a RG |
418 | "-fstack-clash-protection", |
419 | "-fstack-protector-strong", | |
420 | "-fcf-protection=full", | |
7146a45a | 421 | "-Werror=string-plus-int" if is_compiler_clang() else '', |
8804bc1d FM |
422 | ]) |
423 | ||
424 | ||
425 | def get_cxxflags(): | |
426 | return " ".join([ | |
427 | get_cflags(), | |
428 | "-Wp,-D_GLIBCXX_ASSERTIONS", | |
429 | ]) | |
430 | ||
431 | ||
7146a45a RG |
432 | def get_base_configure_cmd(additional_c_flags='', additional_cxx_flags='', enable_systemd=True, enable_sodium=True): |
433 | cflags = " ".join([get_cflags(), additional_c_flags]) | |
434 | cxxflags = " ".join([get_cxxflags(), additional_cxx_flags]) | |
8804bc1d | 435 | return " ".join([ |
7146a45a RG |
436 | f'CFLAGS="{cflags}"', |
437 | f'CXXFLAGS="{cxxflags}"', | |
8804bc1d | 438 | './configure', |
2ef73ca0 RG |
439 | f"CC='{get_c_compiler()}'", |
440 | f"CXX='{get_cxx_compiler()}'", | |
8804bc1d | 441 | "--enable-option-checking=fatal", |
7146a45a RG |
442 | "--enable-systemd" if enable_systemd else '', |
443 | "--with-libsodium" if enable_sodium else '', | |
8804bc1d FM |
444 | "--enable-fortify-source=auto", |
445 | "--enable-auto-var-init=pattern", | |
7146a45a RG |
446 | get_coverage(), |
447 | get_sanitizers() | |
8804bc1d FM |
448 | ]) |
449 | ||
450 | ||
99bb3530 PD |
451 | @task |
452 | def ci_auth_configure(c): | |
7146a45a RG |
453 | unittests = get_unit_tests(True) |
454 | fuzz_targets = get_fuzzing_targets() | |
8804bc1d FM |
455 | modules = " ".join([ |
456 | "bind", | |
457 | "geoip", | |
458 | "gmysql", | |
459 | "godbc", | |
460 | "gpgsql", | |
461 | "gsqlite3", | |
462 | "ldap", | |
463 | "lmdb", | |
464 | "lua2", | |
465 | "pipe", | |
466 | "remote", | |
467 | "tinydns", | |
468 | ]) | |
469 | configure_cmd = " ".join([ | |
470 | get_base_configure_cmd(), | |
471 | "LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib'", | |
472 | f"--with-modules='{modules}'", | |
473 | "--enable-tools", | |
2ef73ca0 | 474 | "--enable-dns-over-tls", |
8804bc1d FM |
475 | "--enable-experimental-pkcs11", |
476 | "--enable-experimental-gss-tsig", | |
477 | "--enable-remotebackend-zeromq", | |
9a299f9d | 478 | "--enable-verbose-logging", |
8804bc1d | 479 | "--with-lmdb=/usr", |
825560a1 | 480 | "--with-libdecaf" if os.getenv('DECAF_SUPPORT', 'no') == 'yes' else '', |
8804bc1d FM |
481 | "--prefix=/opt/pdns-auth", |
482 | "--enable-ixfrdist", | |
8804bc1d | 483 | unittests, |
7146a45a | 484 | fuzz_targets |
8804bc1d FM |
485 | ]) |
486 | res = c.run(configure_cmd, warn=True) | |
99bb3530 PD |
487 | if res.exited != 0: |
488 | c.run('cat config.log') | |
489 | raise UnexpectedExit(res) | |
8804bc1d FM |
490 | |
491 | ||
99bb3530 PD |
492 | @task |
493 | def ci_rec_configure(c): | |
7146a45a | 494 | unittests = get_unit_tests() |
8804bc1d FM |
495 | |
496 | configure_cmd = " ".join([ | |
497 | get_base_configure_cmd(), | |
498 | "--enable-nod", | |
499 | "--prefix=/opt/pdns-recursor", | |
500 | "--with-lua=luajit", | |
501 | "--with-libcap", | |
502 | "--with-net-snmp", | |
503 | "--enable-dns-over-tls", | |
9a299f9d | 504 | "--enable-verbose-logging", |
8804bc1d FM |
505 | unittests, |
506 | ]) | |
507 | res = c.run(configure_cmd, warn=True) | |
99bb3530 PD |
508 | if res.exited != 0: |
509 | c.run('cat config.log') | |
510 | raise UnexpectedExit(res) | |
511 | ||
8804bc1d | 512 | |
99bb3530 | 513 | @task |
e3d6cf05 RG |
514 | def ci_dnsdist_configure(c, features): |
515 | additional_flags = '' | |
516 | if features == 'full': | |
517 | features_set = '--enable-dnstap \ | |
518 | --enable-dnscrypt \ | |
519 | --enable-dns-over-tls \ | |
520 | --enable-dns-over-https \ | |
3e5c7a76 | 521 | --enable-dns-over-quic \ |
d1f77ae6 | 522 | --enable-dns-over-http3 \ |
e3d6cf05 RG |
523 | --enable-systemd \ |
524 | --prefix=/opt/dnsdist \ | |
525 | --with-gnutls \ | |
f31d8bad | 526 | --with-h2o \ |
e3d6cf05 RG |
527 | --with-libsodium \ |
528 | --with-lua=luajit \ | |
529 | --with-libcap \ | |
d5d26f84 | 530 | --with-net-snmp \ |
e3d6cf05 | 531 | --with-nghttp2 \ |
7146a45a | 532 | --with-re2' |
e3d6cf05 RG |
533 | else: |
534 | features_set = '--disable-dnstap \ | |
535 | --disable-dnscrypt \ | |
536 | --disable-ipcipher \ | |
537 | --disable-systemd \ | |
538 | --without-cdb \ | |
539 | --without-ebpf \ | |
540 | --without-gnutls \ | |
f31d8bad | 541 | --without-h2o \ |
e3d6cf05 RG |
542 | --without-libedit \ |
543 | --without-libsodium \ | |
544 | --without-lmdb \ | |
545 | --without-net-snmp \ | |
6135a84e | 546 | --without-nghttp2 \ |
7146a45a | 547 | --without-re2' |
e3d6cf05 | 548 | additional_flags = '-DDISABLE_COMPLETION \ |
6b6f0aa6 RG |
549 | -DDISABLE_DELAY_PIPE \ |
550 | -DDISABLE_DYNBLOCKS \ | |
e3d6cf05 RG |
551 | -DDISABLE_PROMETHEUS \ |
552 | -DDISABLE_PROTOBUF \ | |
553 | -DDISABLE_BUILTIN_HTML \ | |
554 | -DDISABLE_CARBON \ | |
555 | -DDISABLE_SECPOLL \ | |
556 | -DDISABLE_DEPRECATED_DYNBLOCK \ | |
557 | -DDISABLE_LUA_WEB_HANDLERS \ | |
558 | -DDISABLE_NON_FFI_DQ_BINDINGS \ | |
559 | -DDISABLE_POLICIES_BINDINGS \ | |
560 | -DDISABLE_PACKETCACHE_BINDINGS \ | |
561 | -DDISABLE_DOWNSTREAM_BINDINGS \ | |
562 | -DDISABLE_COMBO_ADDR_BINDINGS \ | |
563 | -DDISABLE_CLIENT_STATE_BINDINGS \ | |
564 | -DDISABLE_QPS_LIMITER_BINDINGS \ | |
565 | -DDISABLE_SUFFIX_MATCH_BINDINGS \ | |
566 | -DDISABLE_NETMASK_BINDINGS \ | |
567 | -DDISABLE_DNSNAME_BINDINGS \ | |
568 | -DDISABLE_DNSHEADER_BINDINGS \ | |
569 | -DDISABLE_RECVMMSG \ | |
85241b78 | 570 | -DDISABLE_WEB_CACHE_MANAGEMENT \ |
e3d6cf05 RG |
571 | -DDISABLE_WEB_CONFIG \ |
572 | -DDISABLE_RULES_ALTERING_QUERIES \ | |
573 | -DDISABLE_ECS_ACTIONS \ | |
dbefe674 RG |
574 | -DDISABLE_TOP_N_BINDINGS \ |
575 | -DDISABLE_OCSP_STAPLING \ | |
576 | -DDISABLE_HASHED_CREDENTIALS \ | |
577 | -DDISABLE_FALSE_SHARING_PADDING \ | |
578 | -DDISABLE_NPN' | |
7146a45a RG |
579 | unittests = get_unit_tests() |
580 | fuzztargets = get_fuzzing_targets() | |
581 | tools = f'''AR=llvm-ar-{clang_version} RANLIB=llvm-ranlib-{clang_version}''' if is_compiler_clang() else '' | |
582 | configure_cmd = " ".join([ | |
583 | tools, | |
584 | get_base_configure_cmd(additional_c_flags='', additional_cxx_flags=additional_flags, enable_systemd=False, enable_sodium=False), | |
585 | features_set, | |
586 | unittests, | |
587 | fuzztargets, | |
6e8e1c43 | 588 | '--enable-lto=thin', |
7146a45a RG |
589 | '--prefix=/opt/dnsdist' |
590 | ]) | |
591 | ||
592 | res = c.run(configure_cmd, warn=True) | |
99bb3530 PD |
593 | if res.exited != 0: |
594 | c.run('cat config.log') | |
595 | raise UnexpectedExit(res) | |
596 | ||
597 | @task | |
598 | def ci_auth_make(c): | |
7146a45a | 599 | c.run(f'make -j{get_build_concurrency()} -k V=1') |
99bb3530 | 600 | |
fae3e64c FM |
601 | @task |
602 | def ci_auth_make_bear(c): | |
7146a45a | 603 | c.run(f'bear --append -- make -j{get_build_concurrency()} -k V=1') |
fae3e64c | 604 | |
99bb3530 PD |
605 | @task |
606 | def ci_rec_make(c): | |
7146a45a | 607 | c.run(f'make -j{get_build_concurrency()} -k V=1') |
99bb3530 | 608 | |
f01e3a4a FM |
609 | @task |
610 | def ci_rec_make_bear(c): | |
611 | # Assumed to be running under ./pdns/recursordist/ | |
7146a45a | 612 | c.run(f'bear --append -- make -j{get_build_concurrency()} -k V=1') |
f01e3a4a | 613 | |
99bb3530 PD |
614 | @task |
615 | def ci_dnsdist_make(c): | |
7146a45a | 616 | c.run(f'make -j{get_build_concurrency(4)} -k V=1') |
99bb3530 | 617 | |
97145bb4 FM |
618 | @task |
619 | def ci_dnsdist_make_bear(c): | |
620 | # Assumed to be running under ./pdns/dnsdistdist/ | |
7146a45a | 621 | c.run(f'bear --append -- make -j{get_build_concurrency(4)} -k V=1') |
97145bb4 | 622 | |
99bb3530 | 623 | @task |
e55d3a4b | 624 | def ci_auth_install_remotebackend_test_deps(c): |
99bb3530 | 625 | with c.cd('modules/remotebackend'): |
0e77de07 PD |
626 | # c.run('bundle config set path vendor/bundle') |
627 | c.run('sudo ruby -S bundle install') | |
699d088a | 628 | c.sudo('apt-get install -y socat') |
99bb3530 PD |
629 | |
630 | @task | |
631 | def ci_auth_run_unit_tests(c): | |
632 | res = c.run('make check', warn=True) | |
633 | if res.exited != 0: | |
222d17e2 PD |
634 | c.run('cat pdns/test-suite.log', warn=True) |
635 | c.run('cat modules/remotebackend/test-suite.log', warn=True) | |
99bb3530 PD |
636 | raise UnexpectedExit(res) |
637 | ||
638 | @task | |
639 | def ci_rec_run_unit_tests(c): | |
640 | res = c.run('make check', warn=True) | |
641 | if res.exited != 0: | |
642 | c.run('cat test-suite.log') | |
643 | raise UnexpectedExit(res) | |
644 | ||
645 | @task | |
646 | def ci_dnsdist_run_unit_tests(c): | |
647 | res = c.run('make check', warn=True) | |
648 | if res.exited != 0: | |
649 | c.run('cat test-suite.log') | |
650 | raise UnexpectedExit(res) | |
651 | ||
e917c86b AR |
652 | @task |
653 | def ci_make_distdir(c): | |
654 | res = c.run('make distdir') | |
655 | ||
99bb3530 PD |
656 | @task |
657 | def ci_make_install(c): | |
658 | res = c.run('make install') # FIXME: this builds auth docs - again | |
659 | ||
660 | @task | |
7d862cb3 | 661 | def add_auth_repo(c, dist_name, dist_release_name, pdns_repo_version): |
699d088a | 662 | c.sudo('apt-get install -y curl gnupg2') |
7d862cb3 | 663 | if pdns_repo_version == 'master': |
99bb3530 PD |
664 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/CBC8B383-pub.asc') |
665 | else: | |
666 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/FD380FBB-pub.asc') | |
7d862cb3 | 667 | c.run(f"echo 'deb [arch=amd64] http://repo.powerdns.com/{dist_name} {dist_release_name}-auth-{pdns_repo_version} main' | sudo tee /etc/apt/sources.list.d/pdns.list") |
99bb3530 PD |
668 | c.run("echo 'Package: pdns-*' | sudo tee /etc/apt/preferences.d/pdns") |
669 | c.run("echo 'Pin: origin repo.powerdns.com' | sudo tee -a /etc/apt/preferences.d/pdns") | |
670 | c.run("echo 'Pin-Priority: 600' | sudo tee -a /etc/apt/preferences.d/pdns") | |
671 | c.sudo('apt-get update') | |
672 | ||
673 | @task | |
674 | def test_api(c, product, backend=''): | |
675 | if product == 'recursor': | |
676 | with c.cd('regression-tests.api'): | |
677 | c.run(f'PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor ./runtests recursor {backend}') | |
678 | elif product == 'auth': | |
679 | with c.cd('regression-tests.api'): | |
7d862cb3 | 680 | c.run(f'PDNSSERVER=/opt/pdns-auth/sbin/pdns_server PDNSUTIL=/opt/pdns-auth/bin/pdnsutil SDIG=/opt/pdns-auth/bin/sdig MYSQL_HOST={auth_backend_ip_addr} PGHOST={auth_backend_ip_addr} PGPORT=5432 ./runtests authoritative {backend}') |
99bb3530 PD |
681 | else: |
682 | raise Failure('unknown product') | |
683 | ||
0e77de07 | 684 | backend_regress_tests = dict( |
b33a88da | 685 | bind = [ |
8af54cc6 AR |
686 | 'bind-both', |
687 | 'bind-dnssec-both', | |
688 | 'bind-dnssec-nsec3-both', | |
689 | 'bind-dnssec-nsec3-optout-both', | |
690 | 'bind-dnssec-nsec3-narrow', | |
57d9ffa8 | 691 | 'bind-dnssec-pkcs11' |
b33a88da PD |
692 | ], |
693 | geoip = [ | |
8af54cc6 AR |
694 | 'geoip', |
695 | 'geoip-nsec3-narrow' | |
b33a88da | 696 | ], |
8af54cc6 AR |
697 | lua2 = ['lua2', 'lua2-dnssec'], |
698 | tinydns = ['tinydns'], | |
b33a88da | 699 | remote = [ |
8af54cc6 AR |
700 | 'remotebackend-pipe', |
701 | 'remotebackend-unix', | |
702 | 'remotebackend-http', | |
703 | 'remotebackend-zeromq', | |
704 | 'remotebackend-pipe-dnssec', | |
705 | 'remotebackend-unix-dnssec', | |
706 | 'remotebackend-http-dnssec', | |
707 | 'remotebackend-zeromq-dnssec' | |
b33a88da PD |
708 | ], |
709 | lmdb = [ | |
8af54cc6 AR |
710 | 'lmdb-nodnssec-both', |
711 | 'lmdb-both', | |
712 | 'lmdb-nsec3-both', | |
713 | 'lmdb-nsec3-optout-both', | |
714 | 'lmdb-nsec3-narrow' | |
715 | ], | |
716 | gmysql = [ | |
717 | 'gmysql', | |
718 | 'gmysql-nodnssec-both', | |
719 | 'gmysql-nsec3-both', | |
720 | 'gmysql-nsec3-optout-both', | |
721 | 'gmysql-nsec3-narrow', | |
722 | 'gmysql_sp-both' | |
723 | ], | |
724 | gpgsql = [ | |
725 | 'gpgsql', | |
726 | 'gpgsql-nodnssec-both', | |
727 | 'gpgsql-nsec3-both', | |
728 | 'gpgsql-nsec3-optout-both', | |
729 | 'gpgsql-nsec3-narrow', | |
730 | 'gpgsql_sp-both' | |
731 | ], | |
732 | gsqlite3 = [ | |
733 | 'gsqlite3', | |
734 | 'gsqlite3-nodnssec-both', | |
735 | 'gsqlite3-nsec3-both', | |
736 | 'gsqlite3-nsec3-optout-both', | |
737 | 'gsqlite3-nsec3-narrow' | |
738 | ], | |
739 | godbc_sqlite3 = ['godbc_sqlite3-nodnssec'], | |
740 | godbc_mssql = [ | |
741 | 'godbc_mssql', | |
742 | 'godbc_mssql-nodnssec', | |
743 | 'godbc_mssql-nsec3', | |
744 | 'godbc_mssql-nsec3-optout', | |
745 | 'godbc_mssql-nsec3-narrow' | |
b33a88da | 746 | ], |
c4a7e1df AR |
747 | ldap = [ |
748 | 'ldap-tree', | |
749 | 'ldap-simple', | |
750 | 'ldap-strict' | |
751 | ], | |
752 | geoip_mmdb = ['geoip'], | |
0e77de07 PD |
753 | ) |
754 | ||
b47c41d1 | 755 | godbc_mssql_credentials = {"username": "sa", "password": "SAsa12%%-not-a-secret-password"} |
8af54cc6 | 756 | |
7d862cb3 | 757 | godbc_config = f''' |
8af54cc6 AR |
758 | [pdns-mssql-docker] |
759 | Driver=FreeTDS | |
760 | Trace=No | |
7d862cb3 | 761 | Server={auth_backend_ip_addr} |
8af54cc6 AR |
762 | Port=1433 |
763 | Database=pdns | |
764 | TDS_Version=7.1 | |
765 | ||
766 | [pdns-mssql-docker-nodb] | |
767 | Driver=FreeTDS | |
768 | Trace=No | |
7d862cb3 | 769 | Server={auth_backend_ip_addr} |
8af54cc6 AR |
770 | Port=1433 |
771 | TDS_Version=7.1 | |
772 | ||
773 | [pdns-sqlite3-1] | |
774 | Driver = SQLite3 | |
775 | Database = pdns.sqlite3 | |
776 | ||
777 | [pdns-sqlite3-2] | |
778 | Driver = SQLite3 | |
779 | Database = pdns.sqlite32 | |
780 | ''' | |
781 | ||
782 | def setup_godbc_mssql(c): | |
783 | with open(os.path.expanduser("~/.odbc.ini"), "a") as f: | |
784 | f.write(godbc_config) | |
785 | c.sudo('sh -c \'echo "Threading=1" | cat /usr/share/tdsodbc/odbcinst.ini - | tee -a /etc/odbcinst.ini\'') | |
786 | c.sudo('sed -i "s/libtdsodbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libtdsodbc.so/g" /etc/odbcinst.ini') | |
787 | c.run(f'echo "create database pdns" | isql -v pdns-mssql-docker-nodb {godbc_mssql_credentials["username"]} {godbc_mssql_credentials["password"]}') | |
788 | # FIXME: Skip 8bit-txt-unescaped test | |
789 | c.run('touch ${PWD}/regression-tests/tests/8bit-txt-unescaped/skip') | |
790 | ||
791 | def setup_godbc_sqlite3(c): | |
792 | with open(os.path.expanduser("~/.odbc.ini"), "a") as f: | |
793 | f.write(godbc_config) | |
794 | c.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini') | |
795 | ||
c4a7e1df | 796 | def setup_ldap_client(c): |
699d088a | 797 | c.sudo('DEBIAN_FRONTEND=noninteractive apt-get install -y ldap-utils') |
7d862cb3 | 798 | c.sudo(f'sh -c \'echo "{auth_backend_ip_addr} ldapserver" | tee -a /etc/hosts\'') |
c4a7e1df | 799 | |
57d9ffa8 | 800 | def setup_softhsm(c): |
801 | # Modify the location of the softhsm tokens and configuration directory. | |
802 | # Enables token generation by non-root users (runner) | |
803 | c.run('mkdir -p /opt/pdns-auth/softhsm/tokens') | |
804 | c.run('echo "directories.tokendir = /opt/pdns-auth/softhsm/tokens" > /opt/pdns-auth/softhsm/softhsm2.conf') | |
805 | ||
0e77de07 PD |
806 | @task |
807 | def test_auth_backend(c, backend): | |
7d862cb3 | 808 | pdns_auth_env_vars = 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={auth_backend_ip_addr} GMYSQL2HOST={auth_backend_ip_addr} MYSQL_HOST={auth_backend_ip_addr} PGHOST={auth_backend_ip_addr} PGPORT=5432' |
8af54cc6 | 809 | |
0e77de07 | 810 | if backend == 'remote': |
e55d3a4b | 811 | ci_auth_install_remotebackend_test_deps(c) |
0e77de07 | 812 | |
222d17e2 | 813 | if backend == 'authpy': |
7d862cb3 | 814 | c.sudo(f'sh -c \'echo "{auth_backend_ip_addr} kerberos-server" | tee -a /etc/hosts\'') |
222d17e2 | 815 | with c.cd('regression-tests.auth-py'): |
8af54cc6 AR |
816 | c.run(f'{pdns_auth_env_vars} WITHKERBEROS=YES ./runtests') |
817 | return | |
818 | ||
57d9ffa8 | 819 | if backend == 'bind': |
820 | setup_softhsm(c) | |
821 | with c.cd('regression-tests'): | |
822 | for variant in backend_regress_tests[backend]: | |
823 | c.run(f'{pdns_auth_env_vars} SOFTHSM2_CONF=/opt/pdns-auth/softhsm/softhsm2.conf ./start-test-stop 5300 {variant}') | |
824 | return | |
825 | ||
8af54cc6 AR |
826 | if backend == 'godbc_sqlite3': |
827 | setup_godbc_sqlite3(c) | |
828 | with c.cd('regression-tests'): | |
829 | for variant in backend_regress_tests[backend]: | |
830 | c.run(f'{pdns_auth_env_vars} GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 {variant}') | |
831 | return | |
832 | ||
833 | if backend == 'godbc_mssql': | |
834 | setup_godbc_mssql(c) | |
835 | with c.cd('regression-tests'): | |
836 | for variant in backend_regress_tests[backend]: | |
837 | c.run(f'{pdns_auth_env_vars} GODBC_MSSQL_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL_DSN=pdns-mssql-docker GODBC_MSSQL2_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL2_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL2_DSN=pdns-mssql-docker ./start-test-stop 5300 {variant}') | |
222d17e2 PD |
838 | return |
839 | ||
c4a7e1df AR |
840 | if backend == 'ldap': |
841 | setup_ldap_client(c) | |
842 | ||
843 | if backend == 'geoip_mmdb': | |
844 | with c.cd('regression-tests'): | |
845 | for variant in backend_regress_tests[backend]: | |
846 | c.run(f'{pdns_auth_env_vars} geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb ./start-test-stop 5300 {variant}') | |
847 | return | |
848 | ||
0e77de07 | 849 | with c.cd('regression-tests'): |
b33a88da PD |
850 | if backend == 'lua2': |
851 | c.run('touch trustedkeys') # avoid silly error during cleanup | |
852 | for variant in backend_regress_tests[backend]: | |
8af54cc6 | 853 | c.run(f'{pdns_auth_env_vars} ./start-test-stop 5300 {variant}') |
222d17e2 PD |
854 | |
855 | if backend == 'gsqlite3': | |
7d862cb3 AR |
856 | if os.getenv('SKIP_IPV6_TESTS'): |
857 | pdns_auth_env_vars += ' context=noipv6' | |
222d17e2 | 858 | with c.cd('regression-tests.nobackend'): |
8af54cc6 | 859 | c.run(f'{pdns_auth_env_vars} ./runtests') |
222d17e2 PD |
860 | c.run('/opt/pdns-auth/bin/pdnsutil test-algorithms') |
861 | return | |
b33a88da PD |
862 | |
863 | @task | |
864 | def test_ixfrdist(c): | |
865 | with c.cd('regression-tests.ixfrdist'): | |
866 | c.run('IXFRDISTBIN=/opt/pdns-auth/bin/ixfrdist ./runtests') | |
0e77de07 | 867 | |
99bb3530 PD |
868 | @task |
869 | def test_dnsdist(c): | |
870 | c.run('chmod +x /opt/dnsdist/bin/*') | |
871 | c.run('ls -ald /var /var/agentx /var/agentx/master') | |
872 | c.run('ls -al /var/agentx/master') | |
873 | with c.cd('regression-tests.dnsdist'): | |
6e8e1c43 | 874 | c.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist LD_LIBRARY_PATH=/opt/dnsdist/lib/ ENABLE_SUDO_TESTS=1 ./runtests') |
d3cb00f9 | 875 | |
6b45d67b O |
876 | @task |
877 | def test_regression_recursor(c): | |
878 | c.run('/opt/pdns-recursor/sbin/pdns_recursor --version') | |
7d862cb3 | 879 | c.run('PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control ./build-scripts/test-recursor') |
6b45d67b O |
880 | |
881 | @task | |
375c8fd6 O |
882 | def test_bulk_recursor(c, threads, mthreads, shards): |
883 | # 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 |
884 | with c.cd('regression-tests'): |
885 | c.run('curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip') | |
886 | c.run('unzip top-1m.csv.zip -d .') | |
887 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
30a57c3d | 888 | 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 ./recursor-test 5300 100 {threads} {mthreads} {shards}') |
6b45d67b | 889 | |
dab788a9 PD |
890 | @task |
891 | def install_swagger_tools(c): | |
892 | c.run('npm install -g api-spec-converter') | |
893 | ||
894 | @task | |
895 | def swagger_syntax_check(c): | |
896 | c.run('api-spec-converter docs/http-api/swagger/authoritative-api-swagger.yaml -f swagger_2 -t openapi_3 -s json -c') | |
897 | ||
66c07369 | 898 | @task |
df23d4bf RG |
899 | def install_coverity_tools(c, project): |
900 | token = os.getenv('COVERITY_TOKEN') | |
901 | c.run(f'curl -s https://scan.coverity.com/download/linux64 --data "token={token}&project={project}" | gunzip | sudo tar xvf /dev/stdin --strip-components=1 --no-same-owner -C /usr/local', hide=True) | |
66c07369 RG |
902 | |
903 | @task | |
904 | def coverity_clang_configure(c): | |
7d862cb3 | 905 | c.sudo(f'/usr/local/bin/cov-configure --template --comptype clangcc --compiler clang++-{clang_version}') |
66c07369 RG |
906 | |
907 | @task | |
908 | def coverity_make(c): | |
909 | c.run('/usr/local/bin/cov-build --dir cov-int make -j8 -k') | |
910 | ||
911 | @task | |
912 | def coverity_tarball(c, tarball): | |
913 | c.run(f'tar caf {tarball} cov-int') | |
914 | ||
915 | @task | |
df23d4bf RG |
916 | def coverity_upload(c, email, project, tarball): |
917 | token = os.getenv('COVERITY_TOKEN') | |
66c07369 RG |
918 | c.run(f'curl --form token={token} \ |
919 | --form email="{email}" \ | |
920 | --form file=@{tarball} \ | |
921 | --form version="$(./builder-support/gen-version)" \ | |
922 | --form description="master build" \ | |
df23d4bf | 923 | https://scan.coverity.com/builds?project={project}', hide=True) |
66c07369 | 924 | |
3e5c7a76 RG |
925 | @task |
926 | def ci_build_and_install_quiche(c): | |
927 | # we have to pass -L because GitHub will do a redirect, sadly | |
928 | c.run(f'curl -L -o quiche-{quiche_version}.tar.gz https://github.com/cloudflare/quiche/archive/{quiche_version}.tar.gz') | |
929 | # Line below should echo two spaces between digest and name | |
930 | c.run(f'echo {quiche_hash}" "quiche-{quiche_version}.tar.gz | sha256sum -c -') | |
931 | c.run(f'tar xf quiche-{quiche_version}.tar.gz') | |
932 | with c.cd(f'quiche-{quiche_version}'): | |
2ade4784 | 933 | c.run('cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche') |
3e5c7a76 RG |
934 | # cannot use c.sudo() inside a cd() context, see https://github.com/pyinvoke/invoke/issues/687 |
935 | c.run('sudo install -Dm644 quiche/include/quiche.h /usr/include') | |
2ade4784 RG |
936 | c.run('sudo install -Dm644 target/release/libquiche.so /usr/lib') |
937 | c.run('install -D target/release/libquiche.so /opt/dnsdist/lib/libquiche.so') | |
938 | c.run(f"""sudo install -Dm644 /dev/stdin /usr/lib/pkgconfig/quiche.pc <<PC | |
3e5c7a76 RG |
939 | # quiche |
940 | Name: quiche | |
941 | Description: quiche library | |
942 | URL: https://github.com/cloudflare/quiche | |
2ade4784 | 943 | Version: {quiche_version} |
3e5c7a76 RG |
944 | Libs: -lquiche |
945 | PC""") | |
946 | ||
d3cb00f9 PD |
947 | # this is run always |
948 | def setup(): | |
949 | if '/usr/lib/ccache' not in os.environ['PATH']: | |
950 | os.environ['PATH']='/usr/lib/ccache:'+os.environ['PATH'] | |
951 | ||
952 | setup() |