Improve SYSTEMTEST running on build time

Use parallel execution on test run. Support already configured
interfaces without special permissions on build. It can either use
already present addresses or configure it on build time. If it has no
rights to configure it, just skip the test and continue.
This commit is contained in:
Petr Menšík 2019-11-05 12:15:58 +01:00
parent 63bb1cf127
commit cba49a643a
1 changed files with 21 additions and 12 deletions

View File

@ -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
: