diff --git a/bind.spec b/bind.spec index 56f028c..de42151 100644 --- a/bind.spec +++ b/bind.spec @@ -207,7 +207,9 @@ BuildRequires: softhsm %endif %if %{with SYSTEMTEST} # bin/tests/system dependencies -BuildRequires: net-tools perl(Net::DNS) perl(Net::DNS::Nameserver) +BuildRequires: perl(Net::DNS) perl(Net::DNS::Nameserver) perl(Time::HiRes) perl(Getopt::Long) +# manual configuration requires this tool +BuildRequires: iproute %endif %if %{with GSSTSIG} BuildRequires: krb5-devel @@ -843,25 +845,32 @@ sed -e "/^\s*include(/ d" -e 's/^-- use //' \ %endif %if %{with SYSTEMTEST} -if [ "`whoami`" = 'root' ]; then +# Runs system test if ip addresses are already configured +# or it is able to configure them +if perl bin/tests/system/testsock.pl +then + CONFIGURED=already +else + CONFIGURED= + sh bin/tests/system/ifconfig.sh up + perl bin/tests/system/testsock.pl && CONFIGURED=build +fi +if [ -n "$CONFIGURED" ] +then set -e - chmod -R a+rwX . - pushd bin/tests - pushd system - ./ifconfig.sh up - popd - make test + pushd build/bin/tests + chown -R ${USER} . # Can be unknown user + make test %{?_smp_mflags} 2>&1 | tee test.log e=$? - pushd system - ./ifconfig.sh down - popd popd + [ "$CONFIGURED" = build ] && sh bin/tests/system/ifconfig.sh down if [ "$e" -ne 0 ]; then echo "ERROR: this build of BIND failed 'make test'. Aborting." exit $e; fi; else - echo 'only root can run the tests (they require an ifconfig).' + echo 'SKIPPED: tests require root, CAP_NET_ADMIN or already configured test addresses.' +fi %endif :