From 4a655f56d7e7beea52db68f418cb3caeca2bb00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sat, 21 Jan 2023 20:47:11 +0100 Subject: [PATCH] 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. --- bind9-next.spec | 51 +++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/bind9-next.spec b/bind9-next.spec index 10897d4..339d680 100644 --- a/bind9-next.spec +++ b/bind9-next.spec @@ -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 :