]>
git.ipfire.org Git - thirdparty/pdns.git/blob - tasks.py
1 from invoke
import task
2 from invoke
.exceptions
import Failure
, UnexpectedExit
8 auth_backend_ip_addr
= os
.getenv('AUTH_BACKEND_IP_ADDR', '127.0.0.1')
10 clang_version
= os
.getenv('CLANG_VERSION', '13')
11 quiche_version
= '0.18.0'
12 quiche_hash
= 'eb242a14c4d801a90b57b6021dd29f7a62099f3a4d7a7ba889e105f8328e6c1f'
37 auth_build_deps
= [ # FIXME: perhaps we should be stealing these from the debian (Ubuntu) control file
38 'default-libmysqlclient-dev',
40 'libcurl4-openssl-dev',
76 dnsdist_build_deps
= [
88 auth_test_deps
= [ # FIXME: we should be generating some of these from shlibdeps in build
93 'default-jre-headless',
99 '"libboost-serialization1.7[1-9]+"',
148 'texlive-formats-extra',
149 'texlive-latex-extra',
154 c
.sudo('apt-get update')
155 c
.sudo('apt-get -y --allow-downgrades dist-upgrade')
158 def install_clang(c
):
160 install clang and llvm
162 c
.sudo(f
'apt-get -y --no-install-recommends install clang-{clang_version} llvm-{clang_version}')
165 def install_clang_tidy_tools(c
):
166 c
.sudo(f
'apt-get -y --no-install-recommends install clang-tidy-{clang_version} clang-tools-{clang_version} bear python3-yaml')
169 def install_clang_runtime(c
):
170 # this gives us the symbolizer, for symbols in asan/ubsan traces
171 c
.sudo(f
'apt-get -y --no-install-recommends install clang-{clang_version}')
174 def ci_install_rust(c
, repo
):
175 c
.sudo(f
'{repo}/builder-support/helpers/install_rust.sh')
177 def install_libdecaf(c
, product
):
178 c
.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf')
179 with c
.cd('/tmp/libdecaf'):
180 c
.run('git checkout 41f349')
181 c
.run(f
'CC={get_c_compiler()} CXX={get_cxx_compiler()} '
183 '-DCMAKE_INSTALL_PREFIX=/usr/local '
184 '-DCMAKE_INSTALL_LIBDIR=lib '
185 '-DENABLE_STATIC=OFF '
186 '-DENABLE_TESTS=OFF '
187 '-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" .')
188 c
.run('make -C build')
189 c
.run('sudo make -C build install')
190 c
.sudo(f
'mkdir -p /opt/{product}/libdecaf')
191 c
.sudo(f
'cp /usr/local/lib/libdecaf.so* /opt/{product}/libdecaf/.')
194 def install_doc_deps(c
):
195 c
.sudo('apt-get install -y ' + ' '.join(doc_deps
))
198 def install_doc_deps_pdf(c
):
199 c
.sudo('apt-get install -y ' + ' '.join(doc_deps_pdf
))
202 def install_auth_build_deps(c
):
203 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ auth_build_deps
))
204 if os
.getenv('DECAF_SUPPORT', 'no') == 'yes':
205 install_libdecaf(c
, 'pdns-auth')
207 def is_coverage_enabled():
208 sanitizers
= os
.getenv('SANITIZERS')
210 sanitizers
= sanitizers
.split('+')
211 if 'tsan' in sanitizers
:
213 return os
.getenv('COVERAGE') == 'yes'
216 return '--enable-coverage=clang' if is_coverage_enabled() else ''
219 def install_coverage_deps(c
):
220 if is_coverage_enabled():
221 c
.sudo(f
'apt-get install -y --no-install-recommends llvm-{clang_version}')
224 def generate_coverage_info(c
, binary
, outputDir
):
225 if is_coverage_enabled():
226 version
= os
.getenv('BUILDER_VERSION')
227 c
.run(f
'llvm-profdata-{clang_version} merge -sparse -o {outputDir}/temp.profdata /tmp/code-*.profraw')
228 c
.run(f
'llvm-cov-{clang_version} export --format=lcov --ignore-filename-regex=\'^/usr/\' -instr-profile={outputDir}/temp.profdata -object {binary} > {outputDir}/coverage.lcov')
229 c
.run(f
'{outputDir}/.github/scripts/normalize_paths_in_coverage.py {outputDir} {version} {outputDir}/coverage.lcov {outputDir}/normalized_coverage.lcov')
230 c
.run(f
'mv {outputDir}/normalized_coverage.lcov {outputDir}/coverage.lcov')
232 def setup_authbind(c
):
233 c
.sudo('touch /etc/authbind/byport/53')
234 c
.sudo('chmod 755 /etc/authbind/byport/53')
236 auth_backend_test_deps
= dict(
237 gsqlite3
=['sqlite3'],
238 gmysql
=['default-libmysqlclient-dev'],
239 gpgsql
=['libpq-dev'],
247 godbc_sqlite3
=['libsqliteodbc'],
248 godbc_mssql
=['freetds-bin','tdsodbc'],
253 @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable
=['backend'], optional
=['backend'])
254 def install_auth_test_deps(c
, backend
): # FIXME: rename this, we do way more than apt-get
257 extra
.extend(auth_backend_test_deps
[b
])
258 c
.sudo('DEBIAN_FRONTEND=noninteractive apt-get -y install ' + ' '.join(extra
+auth_test_deps
))
260 c
.run('chmod +x /opt/pdns-auth/bin/* /opt/pdns-auth/sbin/*')
261 # c.run('''if [ ! -e $HOME/bin/jdnssec-verifyzone ]; then
262 # wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz
263 # tar xfz jdnssec-tools-0.14.tar.gz -C $HOME
264 # rm jdnssec-tools-0.14.tar.gz
266 # echo 'export PATH=$HOME/jdnssec-tools-0.14/bin:$PATH' >> $BASH_ENV''') # FIXME: why did this fail with no error?
267 c
.run('touch regression-tests/tests/verify-dnssec-zone/allow-missing regression-tests.nobackend/rectify-axfr/allow-missing') # FIXME: can this go?
268 # FIXME we may want to start a background recursor here to make ALIAS tests more robust
271 if os
.getenv('DECAF_SUPPORT', 'no') == 'yes':
273 c
.sudo('mkdir -p /usr/local/lib')
274 c
.sudo('cp /opt/pdns-auth/libdecaf/libdecaf.so* /usr/local/lib/.')
277 def install_rec_bulk_deps(c
): # FIXME: rename this, we do way more than apt-get
278 c
.sudo('apt-get --no-install-recommends -y install ' + ' '.join(rec_bulk_deps
))
279 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
282 def install_rec_test_deps(c
): # FIXME: rename this, we do way more than apt-get
283 c
.sudo('apt-get --no-install-recommends install -y ' + ' '.join(rec_bulk_deps
) + ' \
284 pdns-server pdns-backend-bind daemontools \
285 jq libfaketime lua-posix lua-socket bc authbind \
286 python3-venv python3-dev default-libmysqlclient-dev libpq-dev \
287 protobuf-compiler snmpd prometheus')
289 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
293 c
.run('sed "s/agentxperms 0700 0755 recursor/agentxperms 0777 0755/g" regression-tests.recursor-dnssec/snmpd.conf | sudo tee /etc/snmp/snmpd.conf')
294 c
.sudo('/etc/init.d/snmpd restart')
296 c
.sudo('chmod 755 /var/agentx')
299 def install_dnsdist_test_deps(c
): # FIXME: rename this, we do way more than apt-get
300 c
.sudo('apt-get install -y \
305 libcurl4-openssl-dev \
318 python3-venv snmpd prometheus')
319 c
.run('sed "s/agentxperms 0700 0755 dnsdist/agentxperms 0777 0755/g" regression-tests.dnsdist/snmpd.conf | sudo tee /etc/snmp/snmpd.conf')
320 c
.sudo('/etc/init.d/snmpd restart')
322 c
.sudo('chmod 755 /var/agentx')
325 def install_rec_build_deps(c
):
326 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ rec_build_deps
))
329 def install_dnsdist_build_deps(c
):
330 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ dnsdist_build_deps
))
334 c
.run('autoreconf -vfi')
337 def ci_docs_rec_generate(c
):
338 c
.run('python3 generate.py')
341 def ci_docs_build(c
):
342 c
.run('make -f Makefile.sphinx -C docs html')
345 def ci_docs_build_pdf(c
):
346 c
.run('make -f Makefile.sphinx -C docs latexpdf')
349 def ci_docs_upload_master(c
, docs_host
, pdf
, username
, product
, directory
=""):
350 rsync_cmd
= " ".join([
359 c
.run(f
"{rsync_cmd} --delete ./docs/_build/{product}-html-docs/ {username}@{docs_host}:{directory}")
360 c
.run(f
"{rsync_cmd} ./docs/_build/{product}-html-docs.tar.bz2 {username}@{docs_host}:{directory}/html-docs.tar.bz2")
361 c
.run(f
"{rsync_cmd} ./docs/_build/latex/{pdf} {username}@{docs_host}:{directory}")
364 def ci_docs_add_ssh(c
, ssh_key
, host_key
):
365 c
.run('mkdir -m 700 -p ~/.ssh')
366 c
.run(f
'echo "{ssh_key}" > ~/.ssh/id_ed25519')
367 c
.run('chmod 600 ~/.ssh/id_ed25519')
368 c
.run(f
'echo "{host_key}" > ~/.ssh/known_hosts')
371 def get_sanitizers():
372 sanitizers
= os
.getenv('SANITIZERS', '')
374 sanitizers
= sanitizers
.split('+')
375 sanitizers
= ['--enable-' + sanitizer
for sanitizer
in sanitizers
]
376 sanitizers
= ' '.join(sanitizers
)
379 def get_unit_tests(auth
=False):
380 if os
.getenv('UNIT_TESTS') != 'yes':
382 return '--enable-unit-tests --enable-backend-unit-tests' if auth
else '--enable-unit-tests'
384 def get_build_concurrency(default
=8):
385 return os
.getenv('CONCURRENCY', default
)
387 def get_fuzzing_targets():
388 return '--enable-fuzz-targets' if os
.getenv('FUZZING_TARGETS') == 'yes' else ''
390 def is_compiler_clang():
391 compiler
= os
.getenv('COMPILER', 'clang')
392 return compiler
== 'clang'
394 def get_c_compiler():
395 return f
'clang-{clang_version}' if is_compiler_clang() else 'gcc'
397 def get_cxx_compiler():
398 return f
'clang++-{clang_version}' if is_compiler_clang() else 'g++'
400 def get_optimizations():
401 optimizations
= os
.getenv('OPTIMIZATIONS', 'yes')
402 return '-O1' if optimizations
== 'yes' else '-O0'
410 "-Werror=format-security",
411 "-Werror=string-plus-int" if is_compiler_clang() else '',
418 "-Wp,-D_GLIBCXX_ASSERTIONS",
422 def get_base_configure_cmd(additional_c_flags
='', additional_cxx_flags
='', enable_systemd
=True, enable_sodium
=True):
423 cflags
= " ".join([get_cflags(), additional_c_flags
])
424 cxxflags
= " ".join([get_cxxflags(), additional_cxx_flags
])
426 f
'CFLAGS="{cflags}"',
427 f
'CXXFLAGS="{cxxflags}"',
429 f
"CC='{get_c_compiler()}'",
430 f
"CXX='{get_cxx_compiler()}'",
431 "--enable-option-checking=fatal",
432 "--enable-systemd" if enable_systemd
else '',
433 "--with-libsodium" if enable_sodium
else '',
434 "--enable-fortify-source=auto",
435 "--enable-auto-var-init=pattern",
442 def ci_auth_configure(c
):
443 unittests
= get_unit_tests(True)
444 fuzz_targets
= get_fuzzing_targets()
459 configure_cmd
= " ".join([
460 get_base_configure_cmd(),
461 "LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib'",
462 f
"--with-modules='{modules}'",
464 "--enable-dns-over-tls",
465 "--enable-experimental-pkcs11",
466 "--enable-experimental-gss-tsig",
467 "--enable-remotebackend-zeromq",
469 "--with-libdecaf" if os
.getenv('DECAF_SUPPORT', 'no') == 'yes' else '',
470 "--prefix=/opt/pdns-auth",
475 res
= c
.run(configure_cmd
, warn
=True)
477 c
.run('cat config.log')
478 raise UnexpectedExit(res
)
482 def ci_rec_configure(c
):
483 unittests
= get_unit_tests()
485 configure_cmd
= " ".join([
486 get_base_configure_cmd(),
488 "--prefix=/opt/pdns-recursor",
492 "--enable-dns-over-tls",
495 res
= c
.run(configure_cmd
, warn
=True)
497 c
.run('cat config.log')
498 raise UnexpectedExit(res
)
502 def ci_dnsdist_configure(c
, features
):
503 additional_flags
= ''
504 if features
== 'full':
505 features_set
= '--enable-dnstap \
507 --enable-dns-over-tls \
508 --enable-dns-over-https \
509 --enable-dns-over-quic \
511 --prefix=/opt/dnsdist \
521 features_set
= '--disable-dnstap \
530 --without-libsodium \
535 additional_flags
= '-DDISABLE_COMPLETION \
536 -DDISABLE_DELAY_PIPE \
537 -DDISABLE_DYNBLOCKS \
538 -DDISABLE_PROMETHEUS \
540 -DDISABLE_BUILTIN_HTML \
543 -DDISABLE_DEPRECATED_DYNBLOCK \
544 -DDISABLE_LUA_WEB_HANDLERS \
545 -DDISABLE_NON_FFI_DQ_BINDINGS \
546 -DDISABLE_POLICIES_BINDINGS \
547 -DDISABLE_PACKETCACHE_BINDINGS \
548 -DDISABLE_DOWNSTREAM_BINDINGS \
549 -DDISABLE_COMBO_ADDR_BINDINGS \
550 -DDISABLE_CLIENT_STATE_BINDINGS \
551 -DDISABLE_QPS_LIMITER_BINDINGS \
552 -DDISABLE_SUFFIX_MATCH_BINDINGS \
553 -DDISABLE_NETMASK_BINDINGS \
554 -DDISABLE_DNSNAME_BINDINGS \
555 -DDISABLE_DNSHEADER_BINDINGS \
557 -DDISABLE_WEB_CACHE_MANAGEMENT \
558 -DDISABLE_WEB_CONFIG \
559 -DDISABLE_RULES_ALTERING_QUERIES \
560 -DDISABLE_ECS_ACTIONS \
561 -DDISABLE_TOP_N_BINDINGS \
562 -DDISABLE_OCSP_STAPLING \
563 -DDISABLE_HASHED_CREDENTIALS \
564 -DDISABLE_FALSE_SHARING_PADDING \
566 unittests
= get_unit_tests()
567 fuzztargets
= get_fuzzing_targets()
568 tools
= f
'''AR=llvm-ar-{clang_version} RANLIB=llvm-ranlib-{clang_version}''' if is_compiler_clang() else ''
569 configure_cmd
= " ".join([
571 get_base_configure_cmd(additional_c_flags
='', additional_cxx_flags
=additional_flags
, enable_systemd
=False, enable_sodium
=False),
575 ' --enable-lto=thin',
576 '--prefix=/opt/dnsdist'
579 res
= c
.run(configure_cmd
, warn
=True)
581 c
.run('cat config.log')
582 raise UnexpectedExit(res
)
586 c
.run(f
'make -j{get_build_concurrency()} -k V=1')
589 def ci_auth_make_bear(c
):
590 c
.run(f
'bear --append -- make -j{get_build_concurrency()} -k V=1')
594 c
.run(f
'make -j{get_build_concurrency()} -k V=1')
597 def ci_rec_make_bear(c
):
598 # Assumed to be running under ./pdns/recursordist/
599 c
.run(f
'bear --append -- make -j{get_build_concurrency()} -k V=1')
602 def ci_dnsdist_make(c
):
603 c
.run(f
'make -j{get_build_concurrency(4)} -k V=1')
606 def ci_dnsdist_make_bear(c
):
607 # Assumed to be running under ./pdns/dnsdistdist/
608 c
.run(f
'bear --append -- make -j{get_build_concurrency(4)} -k V=1')
611 def ci_auth_install_remotebackend_test_deps(c
):
612 with c
.cd('modules/remotebackend'):
613 # c.run('bundle config set path vendor/bundle')
614 c
.run('sudo ruby -S bundle install')
615 c
.sudo('apt-get install -y socat')
618 def ci_auth_run_unit_tests(c
):
619 res
= c
.run('make check', warn
=True)
621 c
.run('cat pdns/test-suite.log', warn
=True)
622 c
.run('cat modules/remotebackend/test-suite.log', warn
=True)
623 raise UnexpectedExit(res
)
626 def ci_rec_run_unit_tests(c
):
627 res
= c
.run('make check', warn
=True)
629 c
.run('cat test-suite.log')
630 raise UnexpectedExit(res
)
633 def ci_dnsdist_run_unit_tests(c
):
634 res
= c
.run('make check', warn
=True)
636 c
.run('cat test-suite.log')
637 raise UnexpectedExit(res
)
640 def ci_make_distdir(c
):
641 res
= c
.run('make distdir')
644 def ci_make_install(c
):
645 res
= c
.run('make install') # FIXME: this builds auth docs - again
648 def add_auth_repo(c
, dist_name
, dist_release_name
, pdns_repo_version
):
649 c
.sudo('apt-get install -y curl gnupg2')
650 if pdns_repo_version
== 'master':
651 c
.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/CBC8B383-pub.asc')
653 c
.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/FD380FBB-pub.asc')
654 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")
655 c
.run("echo 'Package: pdns-*' | sudo tee /etc/apt/preferences.d/pdns")
656 c
.run("echo 'Pin: origin repo.powerdns.com' | sudo tee -a /etc/apt/preferences.d/pdns")
657 c
.run("echo 'Pin-Priority: 600' | sudo tee -a /etc/apt/preferences.d/pdns")
658 c
.sudo('apt-get update')
661 def test_api(c
, product
, backend
=''):
662 if product
== 'recursor':
663 with c
.cd('regression-tests.api'):
664 c
.run(f
'PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor ./runtests recursor {backend}')
665 elif product
== 'auth':
666 with c
.cd('regression-tests.api'):
667 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}')
669 raise Failure('unknown product')
671 backend_regress_tests
= dict(
675 'bind-dnssec-nsec3-both',
676 'bind-dnssec-nsec3-optout-both',
677 'bind-dnssec-nsec3-narrow',
684 lua2
= ['lua2', 'lua2-dnssec'],
685 tinydns
= ['tinydns'],
687 'remotebackend-pipe',
688 'remotebackend-unix',
689 'remotebackend-http',
690 'remotebackend-zeromq',
691 'remotebackend-pipe-dnssec',
692 'remotebackend-unix-dnssec',
693 'remotebackend-http-dnssec',
694 'remotebackend-zeromq-dnssec'
697 'lmdb-nodnssec-both',
700 'lmdb-nsec3-optout-both',
705 'gmysql-nodnssec-both',
707 'gmysql-nsec3-optout-both',
708 'gmysql-nsec3-narrow',
713 'gpgsql-nodnssec-both',
715 'gpgsql-nsec3-optout-both',
716 'gpgsql-nsec3-narrow',
721 'gsqlite3-nodnssec-both',
722 'gsqlite3-nsec3-both',
723 'gsqlite3-nsec3-optout-both',
724 'gsqlite3-nsec3-narrow'
726 godbc_sqlite3
= ['godbc_sqlite3-nodnssec'],
729 'godbc_mssql-nodnssec',
731 'godbc_mssql-nsec3-optout',
732 'godbc_mssql-nsec3-narrow'
739 geoip_mmdb
= ['geoip'],
742 godbc_mssql_credentials
= {"username": "sa", "password": "SAsa12%%"}
748 Server={auth_backend_ip_addr}
753 [pdns-mssql-docker-nodb]
756 Server={auth_backend_ip_addr}
762 Database = pdns.sqlite3
766 Database = pdns.sqlite32
769 def setup_godbc_mssql(c
):
770 with
open(os
.path
.expanduser("~/.odbc.ini"), "a") as f
:
771 f
.write(godbc_config
)
772 c
.sudo('sh -c \'echo "Threading=1" | cat /usr/share/tdsodbc/odbcinst.ini - | tee -a /etc/odbcinst.ini\'')
773 c
.sudo('sed -i "s/libtdsodbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libtdsodbc.so/g" /etc/odbcinst.ini')
774 c
.run(f
'echo "create database pdns" | isql -v pdns-mssql-docker-nodb {godbc_mssql_credentials["username"]} {godbc_mssql_credentials["password"]}')
775 # FIXME: Skip 8bit-txt-unescaped test
776 c
.run('touch ${PWD}/regression-tests/tests/8bit-txt-unescaped/skip')
778 def setup_godbc_sqlite3(c
):
779 with
open(os
.path
.expanduser("~/.odbc.ini"), "a") as f
:
780 f
.write(godbc_config
)
781 c
.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini')
783 def setup_ldap_client(c
):
784 c
.sudo('DEBIAN_FRONTEND=noninteractive apt-get install -y ldap-utils')
785 c
.sudo(f
'sh -c \'echo "{auth_backend_ip_addr} ldapserver" | tee -a /etc/hosts\'')
787 def setup_softhsm(c
):
788 # Modify the location of the softhsm tokens and configuration directory.
789 # Enables token generation by non-root users (runner)
790 c
.run('mkdir -p /opt/pdns-auth/softhsm/tokens')
791 c
.run('echo "directories.tokendir = /opt/pdns-auth/softhsm/tokens" > /opt/pdns-auth/softhsm/softhsm2.conf')
794 def test_auth_backend(c
, backend
):
795 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'
797 if backend
== 'remote':
798 ci_auth_install_remotebackend_test_deps(c
)
800 if backend
== 'authpy':
801 c
.sudo(f
'sh -c \'echo "{auth_backend_ip_addr} kerberos-server" | tee -a /etc/hosts\'')
802 with c
.cd('regression-tests.auth-py'):
803 c
.run(f
'{pdns_auth_env_vars} WITHKERBEROS=YES ./runtests')
806 if backend
== 'bind':
808 with c
.cd('regression-tests'):
809 for variant
in backend_regress_tests
[backend
]:
810 c
.run(f
'{pdns_auth_env_vars} SOFTHSM2_CONF=/opt/pdns-auth/softhsm/softhsm2.conf ./start-test-stop 5300 {variant}')
813 if backend
== 'godbc_sqlite3':
814 setup_godbc_sqlite3(c
)
815 with c
.cd('regression-tests'):
816 for variant
in backend_regress_tests
[backend
]:
817 c
.run(f
'{pdns_auth_env_vars} GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 {variant}')
820 if backend
== 'godbc_mssql':
822 with c
.cd('regression-tests'):
823 for variant
in backend_regress_tests
[backend
]:
824 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}')
827 if backend
== 'ldap':
830 if backend
== 'geoip_mmdb':
831 with c
.cd('regression-tests'):
832 for variant
in backend_regress_tests
[backend
]:
833 c
.run(f
'{pdns_auth_env_vars} geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb ./start-test-stop 5300 {variant}')
836 with c
.cd('regression-tests'):
837 if backend
== 'lua2':
838 c
.run('touch trustedkeys') # avoid silly error during cleanup
839 for variant
in backend_regress_tests
[backend
]:
840 c
.run(f
'{pdns_auth_env_vars} ./start-test-stop 5300 {variant}')
842 if backend
== 'gsqlite3':
843 if os
.getenv('SKIP_IPV6_TESTS'):
844 pdns_auth_env_vars
+= ' context=noipv6'
845 with c
.cd('regression-tests.nobackend'):
846 c
.run(f
'{pdns_auth_env_vars} ./runtests')
847 c
.run('/opt/pdns-auth/bin/pdnsutil test-algorithms')
851 def test_ixfrdist(c
):
852 with c
.cd('regression-tests.ixfrdist'):
853 c
.run('IXFRDISTBIN=/opt/pdns-auth/bin/ixfrdist ./runtests')
857 c
.run('chmod +x /opt/dnsdist/bin/*')
858 c
.run('ls -ald /var /var/agentx /var/agentx/master')
859 c
.run('ls -al /var/agentx/master')
860 with c
.cd('regression-tests.dnsdist'):
861 c
.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist LD_LIBRARY_PATH=/opt/dnsdist/lib/ ./runtests')
864 def test_regression_recursor(c
):
865 c
.run('/opt/pdns-recursor/sbin/pdns_recursor --version')
866 c
.run('PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control ./build-scripts/test-recursor')
869 def test_bulk_recursor(c
, threads
, mthreads
, shards
):
870 # We run an extremely small version of the bulk test, as GH does not seem to be able to handle the UDP load
871 with c
.cd('regression-tests'):
872 c
.run('curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip')
873 c
.run('unzip top-1m.csv.zip -d .')
874 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
875 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}')
878 def install_swagger_tools(c
):
879 c
.run('npm install -g api-spec-converter')
882 def swagger_syntax_check(c
):
883 c
.run('api-spec-converter docs/http-api/swagger/authoritative-api-swagger.yaml -f swagger_2 -t openapi_3 -s json -c')
886 def install_coverity_tools(c
, project
):
887 token
= os
.getenv('COVERITY_TOKEN')
888 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)
891 def coverity_clang_configure(c
):
892 c
.sudo(f
'/usr/local/bin/cov-configure --template --comptype clangcc --compiler clang++-{clang_version}')
895 def coverity_make(c
):
896 c
.run('/usr/local/bin/cov-build --dir cov-int make -j8 -k')
899 def coverity_tarball(c
, tarball
):
900 c
.run(f
'tar caf {tarball} cov-int')
903 def coverity_upload(c
, email
, project
, tarball
):
904 token
= os
.getenv('COVERITY_TOKEN')
905 c
.run(f
'curl --form token={token} \
906 --form email="{email}" \
907 --form file=@{tarball} \
908 --form version="$(./builder-support/gen-version)" \
909 --form description="master build" \
910 https://scan.coverity.com/builds?project={project}', hide
=True)
913 def ci_build_and_install_quiche(c
):
914 # we have to pass -L because GitHub will do a redirect, sadly
915 c
.run(f
'curl -L -o quiche-{quiche_version}.tar.gz https://github.com/cloudflare/quiche/archive/{quiche_version}.tar.gz')
916 # Line below should echo two spaces between digest and name
917 c
.run(f
'echo {quiche_hash}" "quiche-{quiche_version}.tar.gz | sha256sum -c -')
918 c
.run(f
'tar xf quiche-{quiche_version}.tar.gz')
919 with c
.cd(f
'quiche-{quiche_version}'):
920 c
.run('cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche')
921 # cannot use c.sudo() inside a cd() context, see https://github.com/pyinvoke/invoke/issues/687
922 c
.run('sudo install -Dm644 quiche/include/quiche.h /usr/include')
923 c
.run('sudo install -Dm644 target/release/libquiche.so /usr/lib')
924 c
.run('install -D target/release/libquiche.so /opt/dnsdist/lib/libquiche.so')
925 c
.run(f
"""sudo install -Dm644 /dev/stdin /usr/lib/pkgconfig/quiche.pc <<PC
928 Description: quiche library
929 URL: https://github.com/cloudflare/quiche
930 Version: {quiche_version}
936 if '/usr/lib/ccache' not in os
.environ
['PATH']:
937 os
.environ
['PATH']='/usr/lib/ccache:'+os
.environ
['PATH']