Adjust --with SYSTEMTEST to recent source

Using testsock.pl and ifconfig.sh requires to be in their directory.
Ensure build directory is used, because it needs some configured files.
This commit is contained in:
Petr Menšík 2023-01-21 20:47:11 +01:00
parent 22ec60f6db
commit 4a655f56d7
1 changed files with 28 additions and 23 deletions

View File

@ -132,6 +132,7 @@ BuildRequires: softhsm
%if %{with SYSTEMTEST}
# bin/tests/system dependencies
BuildRequires: perl(Net::DNS) perl(Net::DNS::Nameserver) perl(Time::HiRes) perl(Getopt::Long)
BuildRequires: perl(English)
# manual configuration requires this tool
BuildRequires: iproute
%endif
@ -478,30 +479,34 @@ export TSAN_OPTIONS="log_exe_name=true log_path=ThreadSanitizer exitcode=0"
%if %{with SYSTEMTEST}
# 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
pushd build/bin/tests
chown -R ${USER} . # Can be unknown user
%make_build test 2>&1 | tee test.log
e=$?
pushd build/bin/tests/system/
if perl ./testsock.pl
then
CONFIGURED=already
else
CONFIGURED=
sh ./ifconfig.sh up
perl ./testsock.pl && CONFIGURED=build
fi
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 'SKIPPED: tests require root, CAP_NET_ADMIN or already configured test addresses.'
fi
if [ -n "$CONFIGURED" ]
then
set -e
pushd build/bin/tests
export CI_SYSTEM=yes # allow running tests as root
chown -R ${USER} . # Can be unknown user
%make_build test 2>&1 | tee test.log
e=$?
[ "$CONFIGURED" = build ] && sh ./ifconfig.sh down
popd
if [ "$e" -ne 0 ]; then
echo "ERROR: this build of BIND failed 'make test'. Aborting."
exit $e;
fi;
else
echo 'SKIPPED: tests require root, CAP_NET_ADMIN or already configured test addresses.'
fi
%endif
: