]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
build and use libfaketime from source
authorromeroalx <alexis.romero@open-xchange.com>
Wed, 17 Dec 2025 17:09:53 +0000 (18:09 +0100)
committerromeroalx <alexis.romero@open-xchange.com>
Mon, 19 Jan 2026 11:48:16 +0000 (12:48 +0100)
regression-tests.nobackend/soa-edit/command
regression-tests.recursor-dnssec/runtests
tasks.py

index e935fdd98569935e1268486ff61be3fd611480e6..3ff8c78ca598b62a7fe99680d5030ec7acc29685 100755 (executable)
@@ -33,7 +33,7 @@ delta=$((now-1418860790)) # Wed Dec 17 23:59:50 2014 UTC
 
 $PDNSUTIL --config-dir=soa-edit create-bind-db soa-edit/bind-dnssec.db
 $PDNSUTIL --config-dir soa-edit/ set-meta minimal.com SOA-EDIT INCREMENT-WEEKS
-faketime -m -f -$delta $PDNS --config-dir=soa-edit &
+LD_PRELOAD=/usr/local/lib/faketime/libfaketime.so.1 FAKETIME=-$delta $PDNS --config-dir=soa-edit &
 bindwait
 
 $SDIG 127.0.0.1 $port minimal.com SOA | LC_ALL=C sort
index 6dadae6016c07f45d008cf3d65f8af354d0211e9..d83a3f67e716b0fd3202acb8c6779fed5abde15d 100755 (executable)
@@ -35,7 +35,7 @@ export PDNSMODULEDIR=${PDNSMODULEDIR:-${PWD}/../regression-tests/modules}
 export PDNSRECURSOR=${PDNSRECURSOR:-${PWD}/../pdns/recursordist/build/pdns_recursor}
 export RECCONTROL=${RECCONTROL:-${PWD}/../pdns/recursordist/build/rec_control}
 
-LIBFAKETIME_DEFAULT=/usr/lib/$(arch)-linux-gnu/faketime/libfaketimeMT.so.1 # ubuntu default
+LIBFAKETIME_DEFAULT=/usr/local/lib/faketime/libfaketimeMT.so.1 # location after building and installing from https://github.com/wolfcw/libfaketime
 LIBAUTHBIND_DEFAULT=/usr/lib/authbind/libauthbind.so.1
 if [ $(uname -s) = "Darwin" ]; then
   # macOS is not /really/ supported here; it works for some tests, and then you might need sudo.
@@ -73,7 +73,7 @@ fi
 # Run with -m 'not unreliable_on_gh' to skip tests that are unreliable on GitHUb
 # Run with -m 'not (external or unreliable_on_gh)' to skip both categories
 
-# LIBFAKETIME is only added to LD_PRELOAD by the pyton code when needed
+# LIBFAKETIME is only added to LD_PRELOAD by the python code when needed
 if [ "${LIBASAN}" != "" -o "${LIBAUTHBIND}" != "" ]; then
 LD_PRELOAD="${LIBASAN} ${LIBAUTHBIND}" authbind pytest --junitxml=pytest.xml "$@"
 else
index 87df630a136b281e2f4881f88a43c92c6040888b..a676da44eb30112b62cfff33bcdf9c3d021d6b7c 100644 (file)
--- a/tasks.py
+++ b/tasks.py
@@ -112,7 +112,6 @@ auth_test_deps = [   # FIXME: we should be generating some of these from shlibde
     'curl',
     'default-jre-headless',
     'bind9-dnsutils',
-    'faketime',
     'gawk',
     'krb5-user',
     'ldnsutils',
@@ -249,6 +248,13 @@ def setup_authbind(c):
     c.sudo('touch /etc/authbind/byport/!853')
     c.sudo('chmod 755 /etc/authbind/byport/!853')
 
+# Builds and installs libfaketime from wolfcw/libfaketime (master)
+def build_and_install_libfaketime(c):
+    c.run(f'git clone https://github.com/wolfcw/libfaketime.git {repo_home}/libfaketime')
+    with c.cd(f'{repo_home}/libfaketime'):
+        c.run('git checkout master')
+        c.run('make && sudo make install')
+
 auth_backend_test_deps = dict(
     gsqlite3=['sqlite3'],
     gmysql=['default-libmysqlclient-dev'],
@@ -273,6 +279,8 @@ def install_auth_test_deps_only(c, backend):
         extra.extend(auth_backend_test_deps[b])
     c.sudo('apt-get update')
     c.sudo('DEBIAN_FRONTEND=noninteractive apt-get -y install ' + ' '.join(extra+auth_test_deps))
+    # install libfaketime manually
+    build_and_install_libfaketime(c)
 
 @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend'])
 def install_auth_test_deps(c, backend): # FIXME: rename this, we do way more than apt-get
@@ -303,7 +311,7 @@ def install_rec_bulk_ubicloud_deps(c): # FIXME: rename this, we do way more than
 def install_rec_test_deps(c): # FIXME: rename this, we do way more than apt-get
     c.sudo('apt-get --no-install-recommends install -y ' + ' '.join(rec_bulk_deps) + ' \
               pdns-server pdns-backend-bind daemontools \
-              jq libfaketime lua-posix lua-socket bc authbind \
+              jq lua-posix lua-socket bc authbind \
               python3-venv python3-dev default-libmysqlclient-dev libpq-dev \
               protobuf-compiler snmpd prometheus')
     c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
@@ -314,6 +322,8 @@ def install_rec_test_deps(c): # FIXME: rename this, we do way more than apt-get
     c.sudo('/etc/init.d/snmpd restart')
     time.sleep(5)
     c.sudo('chmod 755 /var/agentx')
+    # install libfaketime manually
+    build_and_install_libfaketime(c)
 
 @task(optional=['skipXDP'])
 def install_dnsdist_test_deps(c, skipXDP=False): # FIXME: rename this, we do way more than apt-get