Improve a bit ability to run testsuite from mockbuild

Intended to be run like:
centpkg mockbuild --with SYSTEMTEST -N --enable-network

Do fail when it does not pass. But allow running tests as root.

Related: RHEL-77103
This commit is contained in:
Petr Menšík 2025-02-14 21:16:11 +01:00
parent 2e48ec71f0
commit 991c7d570b

View File

@ -6,6 +6,8 @@
# bcond_without is built by default, unless --without X is passed
# bcond_with is built only when --with X is passed to build
%bcond_with SYSTEMTEST
# enable RSA1 during SYSTEMTEST
%bcond_with CRYPTO_POLICY_RSA1
%bcond_without GSSTSIG
# it is not possible to build the package without PKCS11 sub-package
# due to extensive changes to Makefiles
@ -211,6 +213,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)
BuildRequires: python-dns
# manual configuration requires this tool
BuildRequires: iproute
@ -522,6 +525,10 @@ done
%endif
sed -e 's|"$TOP/config.guess"|"$TOP_SRCDIR/config.guess"|' -i bin/tests/system/ifconfig.sh
# allow running as root from mock or test machines
sed -e 's, "enable-developer",& \&\& systemctl is-system-running \&>/dev/null \&\& ! [ -e /mnt/tests ],' \
-i bin/tests/system/run.sh
:;
@ -696,15 +703,29 @@ else
sh bin/tests/system/ifconfig.sh up
perl bin/tests/system/testsock.pl && CONFIGURED=build
fi
if [ -n "$CONFIGURED" ]
then
set -e
%if %{with CRYPTO_POLICY_RSA1}
# Override crypto-policy to allow RSASHA1 key operations
OPENSSL_CONF="$(mktemp openssl-XXXXXX.cnf)"
cat > "$OPENSSL_CONF" << 'EOF'
.include = /etc/ssl/openssl.cnf
[evp_properties]
rh-allow-sha1-signatures = yes
EOF
export OPENSSL_CONF
%endif
pushd build/bin/tests
chown -R ${USER} . # Can be unknown user
%make_build test 2>&1 | tee test.log
%make_build test
e=$?
popd
[ "$CONFIGURED" = build ] && sh bin/tests/system/ifconfig.sh down
%if %{with CRYPTO_POLICY_RSA1}
export -b OPENSSL_CONF
%endif
if [ "$e" -ne 0 ]; then
echo "ERROR: this build of BIND failed 'make test'. Aborting."
exit $e;