#!/bin/sh
+PYTHON=${PYTHON:-python2}
+
if [ ! -d .venv ]; then
- virtualenv -p python2 .venv
+ virtualenv -p ${PYTHON} .venv
fi
. .venv/bin/activate
python -V
+pip install -U pip
pip install -r requirements.txt
+protoc -I=../pdns/ --python_out=. ../pdns/dnsmessage.proto
+protoc -I=../pdns/ --python_out=. ../pdns/dnstap.proto
+
+
mkdir -p configs
[ -f ./vars ] && . ./vars
export PDNSUTIL=${PDNSUTIL:-${PWD}/../pdns/pdnsutil}
export PDNSRECURSOR=${PDNSRECURSOR:-${PWD}/../pdns/recursordist/pdns_recursor}
export RECCONTROL=${RECCONTROL:-${PWD}/../pdns/recursordist/rec_control}
-export LIBFAKETIME=${LIBFAKETIME:-/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1} # ubuntu default
-export PREFIX=10.0.3
+LIBFAKETIME_DEFAULT=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 # ubuntu default
+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.
+ LIBFAKETIME_DEFAULT=/usr/local/lib/faketime/libfaketime.1.dylib
+ LIBAUTHBIND_DEFAULT=""
+fi
+if [ $(uname -s) = "OpenBSD" ]; then
+ # OpenBSD is not /really/ supported here; it works for some tests, and then you might need sudo.
+ LIBFAKETIME_DEFAULT=""
+ LIBAUTHBIND_DEFAULT=""
+fi
+
+export LIBFAKETIME=${LIBFAKETIME:-$LIBFAKETIME_DEFAULT}
+export LIBAUTHBIND=${LIBAUTHBIND:-$LIBAUTHBIND_DEFAULT}
+export PREFIX=127.0.0
+
+for bin in "$PDNS" "$PDNSUTIL" "$PDNSRECURSOR" "$RECCONTROL" "$LIBFAKETIME" "$LIBAUTHBIND"; do
+ if [ -n "$bin" -a ! -e "$bin" ]; then
+ echo "E: Required binary $bin not found. Please install the binary and/or edit ./vars."
+ exit 1
+ fi
+done
set -e
if [ "${PDNS_DEBUG}" = "YES" ]; then
set -x
fi
-LD_PRELOAD="/usr/lib/authbind/libauthbind.so.1 ${LIBFAKETIME}" nosetests -I test_WellKnown.py --with-xunit $@
+
+if ! "$PDNSRECURSOR" --version 2>&1 | grep Features | grep -q dnstap-framestream; then
+ export NODNSTAPTESTS=1
+fi
+
+if [ "${LIBAUTHBIND}" != "" -o "${LIBFAKETIME}" != "" ]; then
+LD_PRELOAD="${LIBASAN} ${LIBAUTHBIND} ${LIBFAKETIME}" nosetests -I test_WellKnown.py --with-xunit $@
+else
+nosetests -I test_WellKnown.py --with-xunit $@
+fi