From 79139926a35157b9eeae0fb54957063ccfb42921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Fri, 2 Aug 2024 23:05:50 +0200 Subject: [PATCH] Changes to upstream test suite for 9.18 Make working test suite again for rawhide builds. Allow writing into sourcedir of bin/tests/system also, because out of tree builds needs that. They execute tests in source directory instead of build copy, because test as directories are not recognized in build directory well. That makes every part run in source directory instead. --- .../Run-internal-BIND-test-suite/runtest.sh | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/Sanity/named/Run-internal-BIND-test-suite/runtest.sh b/Sanity/named/Run-internal-BIND-test-suite/runtest.sh index 7277646..01bed2b 100755 --- a/Sanity/named/Run-internal-BIND-test-suite/runtest.sh +++ b/Sanity/named/Run-internal-BIND-test-suite/runtest.sh @@ -40,6 +40,7 @@ : ${PACKAGE:=bind} USER="user$RANDOM" CORES=1 +: ${WITHOUT:=--without DOC --without EXPORT_LIBS} rlJournalStart rlPhaseStartSetup @@ -144,7 +145,10 @@ rlJournalStart fi if dnf builddep --help >/dev/null; then - rlRun "dnf -y builddep --nobest *.spec --enablerepo=\* --skip-unavailable" + SKIP='' + #rhel81 doesnt now --skip-unavailable option + dnf builddep --skip-unavailable --help 2>/dev/null && SKIP="--skip-unavailable" + rlRun "dnf -y builddep --nobest *.spec --enablerepo=\* $SKIP" elif which yum-builddep; then rlRun "yum-builddep -y *.spec" else @@ -152,24 +156,32 @@ rlJournalStart fi #DEBUG smtg - rpm -q softhsm || yum install softhsm -y --enablerepo=\* - rpm -q kyua || yum install kyua -y --enablerepo=\* - rpm -q perl-IO-Socket-INET6 || yum install -y 'perl(IO::Socket::INET6)' --enablerepo=\* + rlRun "rpm -q softhsm || yum install softhsm -y --enablerepo=\*" 0-255 + rlRun "rpm -q perl-IO-Socket-INET6 || yum install -y 'perl(IO::Socket::INET6)' --enablerepo=\*" 0-255 # stop bind if it is running service named stop rlPhaseEnd rlPhaseStartTest - if [ "$REUSE_BUILD" = y ] && ls -1 "$TOPDIR/BUILD"/bind* > /dev/null + rlRun "rpmbuild -bc $WITHOUT --short-circuit --define '__spec_build_pre echo RPM_BUILD_DIR=%{_builddir}; echo RPM_NAME=%{name}; echo RPM_VER=%{version}; echo RPM_REL=%{release}; exit 0' *.spec > $TMPDIR/build.env" 0 "Obtain some build variables" + rlRun "eval $(grep '^\w\+=' $TMPDIR/build.env)" + if [ -z "$RPM_BUILD_DIR" ]; then + RPM_BUILD_DIR=$(rpm -E %_builddir) + fi + if [ -z "$RPM_BUILD_DIR" ]; then + RPM_BUILD_DIR="$TOPDIR/BUILD" + fi + + if [ "$REUSE_BUILD" = y ] && ls -1 "$RPM_BUILD_DIR"/bind* > /dev/null then rlLog "Skipping $PACKAGE build" else # rebuild from source - rlRun "rpmbuild -ba --noclean *.spec &> $TMPDIR/build.txt" 0 "Building $PACKAGE" + rlRun "rpmbuild -bc $WITHOUT --noclean *.spec &> $TMPDIR/build.txt" 0 "Building bind" fi # the test - rlRun "cd $TOPDIR/BUILD/bind*" + rlRun "cd $RPM_BUILD_DIR/bind*" rlLogInfo "Test takes place in `pwd`" @@ -184,6 +196,9 @@ rlJournalStart if [ -d build ]; then BUILD=build + # In case tests are executed in srcdir, put conf.sh there also + # Happens with 9.18 + rlRun "cp -p $BUILD/bin/tests/system/conf.sh bin/tests/system" else BUILD=. fi @@ -198,8 +213,13 @@ rlJournalStart # required by idna test export LC_ALL=en_US.UTF-8 + # bin/tests/system receives logs by mistake, but allow it for now. + rlRun "chgrp -R $USER $BUILD bin/tests/system/" + rlRun "chmod g+rw -R $BUILD bin/tests/system/" rlRun "pushd $BUILD" + rlRun "ls -l ./bin/tests/system/ifconfig.sh" rlRun "./bin/tests/system/ifconfig.sh up" 0 "Setup fake network interfaces." + rlRun "chown -R $USER:$USER bin/tests/system/" # keep separate results on 9.11+ rlRun "sed -e 's/testsummary.sh/& -n/' -i bin/tests/system/Makefile" 0 "Modify to keep results" @@ -211,12 +231,19 @@ rlJournalStart ###### remove later (today 2021 Aug) sed -ie 's/set -eu/set -e/' bin/tests/system/cds/setup.sh + rlRun "chmod a+x bin/tests/system/*.sh" 0 "Ensure all test shell scripts are executable" + UMASK_ORIG=$(umask) + rlRun "umask 0002" + + [ "$DEBUG" = y ] && PS1="pretest-debug $PS1" bash -i + # Try to fix tssgsig failures on some machines, do not use system kerberos configuration export KRB5_CONFIG=/dev/null chmod a+rw -R /root #running as a USER RHEL9HACK="sudo -u $USER" rlRun "${RHEL9HACK} make ${MAKE_TEST:-test -j$CORES} &> $TMPDIR/test.txt" 0-255 "Perform the test, --init-task=/distribution/install/rhel-buildroot is needed" export -n KRB5_CONFIG + rlRun "umask $UMASK_ORIG" 0 "Return original umask" # This would catch just errors on 9.11+ if [ -f bin/tests/system/testsummary.sh ]; then @@ -232,6 +259,8 @@ rlJournalStart rlRun "tar czf $TMPDIR/failed-artifacts.tar.gz bin/tests/system" 0 "Archiving all system tests" fi + + [ "$DEBUG" = y ] && PS1="posttest-debug $PS1" bash -i rlRun "./bin/tests/system/ifconfig.sh down" 0 "Remove fake network interfaces." rlRun "popd"