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 1/3] 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" From 678901e01041bed1f5df216c884007b9f51222fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 4 Sep 2024 20:01:53 +0200 Subject: [PATCH 2/3] Require pytest, do not require databases on Fedora Database were used by bind-sdb only, which is not built on Fedora anymore. There are still some bind-dlz-* plugins, but even Postgresql is not used anymore. --- Sanity/named/Run-internal-BIND-test-suite/main.fmf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sanity/named/Run-internal-BIND-test-suite/main.fmf b/Sanity/named/Run-internal-BIND-test-suite/main.fmf index 56e9c97..0f38d1b 100644 --- a/Sanity/named/Run-internal-BIND-test-suite/main.fmf +++ b/Sanity/named/Run-internal-BIND-test-suite/main.fmf @@ -3,7 +3,6 @@ description: | Bug summary: Run internal BIND test suite Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=642970 - contact: Petr Sklenar test: ./runtest.sh framework: beakerlib @@ -22,7 +21,6 @@ recommend: - libidn2-devel - libxml2-devel - openldap-devel - - postgresql-devel - sqlite-devel - krb5-devel - net-tools @@ -48,9 +46,17 @@ adjust+: - kyua when: distro < fedora-37 or distro <= rhel-9 or distro <= centos-9 because: only bind <=9.16 uses kyua for unit tests + - recommend+: + - postgresql-devel + when: component == bind and distro < fedora-33 or distro < rhel-9 or distro < centos-9 + because: only bind-sdb in bind <=9.11 needs those databases - recommend+: - libidn-devel when: distro < rhel-8 or distro < centos-8 + - recommend+: + - python3-pytest + when: distro >= fedora-39 or distro >= rhel-9 or distro >= centos-9 + because: bind 9.18+ uses it to run tests duration: 14h enabled: true tag: From c43a4c844a1ec5a79aded5d22daabf5532d37ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 4 Sep 2024 22:41:13 +0200 Subject: [PATCH 3/3] More changes to upstream test suite Use smarter way to enable repositories present. List disabled repositories and enable those we need. Enable _with_SYSTEMTEST when installing build dependencies. Should help with installing correct dependencies for each build directly from the package spec. --- .../Run-internal-BIND-test-suite/Makefile | 1 + .../Run-internal-BIND-test-suite/main.fmf | 5 +-- .../Run-internal-BIND-test-suite/runtest.sh | 31 ++++++++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Sanity/named/Run-internal-BIND-test-suite/Makefile b/Sanity/named/Run-internal-BIND-test-suite/Makefile index 4c84b47..ef0d6e4 100644 --- a/Sanity/named/Run-internal-BIND-test-suite/Makefile +++ b/Sanity/named/Run-internal-BIND-test-suite/Makefile @@ -62,6 +62,7 @@ $(METADATA): Makefile @echo "Requires: openssl-devel libtool autoconf" >> $(METADATA) @echo "Requires: perl perl(Net::DNS) perl(Net::DNS::Nameserver) perl(Time::HiRes)" >> $(METADATA) @echo "Requires: perl(IO::Socket::INET6)" >> $(METADATA) + @echo "Requires: python3-pytest" >> $(METADATA) @echo "Requires: libcap-devel libidn-devel libxml2-devel kyua" >> $(METADATA) @echo "Requires: openldap-devel postgresql-devel" >> $(METADATA) @echo "Requires: sqlite-devel krb5-devel net-tools iproute" >> $(METADATA) diff --git a/Sanity/named/Run-internal-BIND-test-suite/main.fmf b/Sanity/named/Run-internal-BIND-test-suite/main.fmf index 0f38d1b..0e259fa 100644 --- a/Sanity/named/Run-internal-BIND-test-suite/main.fmf +++ b/Sanity/named/Run-internal-BIND-test-suite/main.fmf @@ -30,6 +30,7 @@ recommend: - rng-tools - gcc-c++ - python3-dns + - python3-pytest adjust+: - enabled: false when: distro == rhel @@ -53,10 +54,6 @@ adjust+: - recommend+: - libidn-devel when: distro < rhel-8 or distro < centos-8 - - recommend+: - - python3-pytest - when: distro >= fedora-39 or distro >= rhel-9 or distro >= centos-9 - because: bind 9.18+ uses it to run tests duration: 14h enabled: true tag: diff --git a/Sanity/named/Run-internal-BIND-test-suite/runtest.sh b/Sanity/named/Run-internal-BIND-test-suite/runtest.sh index 01bed2b..f434b64 100755 --- a/Sanity/named/Run-internal-BIND-test-suite/runtest.sh +++ b/Sanity/named/Run-internal-BIND-test-suite/runtest.sh @@ -49,7 +49,7 @@ rlJournalStart rpm -q perl-Net-DNS-Nameserver || yum install -y perl-Net-DNS-Nameserver rlLog "`rpm -q perl-Net-DNS-Nameserver`" # package assertions - rlAssertRpm $PACKAGE + rlAssertRpm $PACKAGE rlAssertRpm rpm-build rlRun "rpm -q $PACKAGE-devel || yum install -y $PACKAGE-devel $PACKAGE-utils" rlServiceStart "rngd" @@ -93,14 +93,14 @@ rlJournalStart rlRun "TMPDIR=\`mktemp -d\`" 0 "Creating tmp directory" rlRun "pushd $TMPDIR" - if rlIsRHEL 8 && dnf config-manager --help >/dev/null; then + if rlIsRHEL '>= 8' && dnf config-manager --help >/dev/null; then # Some build dependencies are not in repositories enabled # by default: libidn2-devel, softshm - dnf config-manager --set-enabled rhel-buildroot - dnf config-manager --set-enabled rhel-CRB - dnf config-manager --set-enabled beaker-CRB - dnf config-manager --set-enabled beaker-buildroot - #not checking return code: 1mt and beaker uses different names for repo + # 1mt and beaker uses different names for repo, find those present + for REPO in $(dnf -q repolist --disabled {rhel,beaker}-{buildroot,CRB} | awk '$1 != "repo" && $2 != "id" { print $1 }') + do + rlRun "dnf config-manager --set-enabled $REPO" + done fi # topdir @@ -148,9 +148,9 @@ rlJournalStart 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" + rlRun "dnf -y builddep -D '_with_SYSTEMTEST 1' --nobest *.spec $SKIP" elif which yum-builddep; then - rlRun "yum-builddep -y *.spec" + rlRun "yum-builddep -y -D '_with_SYSTEMTEST 1' *.spec" else rlWarn "there is nor yum-utils neither dnf-utils for install dependencies, ENJOY!" fi @@ -171,8 +171,14 @@ rlJournalStart if [ -z "$RPM_BUILD_DIR" ]; then RPM_BUILD_DIR="$TOPDIR/BUILD" fi + if [ -n "$RPM_NAME" ] && [ -n "$RPM_VER" ]; then + BIND_BUILD="$RPM_BUILD_DIR/$RPM_NAME-$RPM_VER" + else + rlRun "rmdir $RPM_BUILD_DIR/bind*-SPECPARTS" 0-255 "Cleanup specparts" + BIND_BUILD="$(ls -l "$RPM_BUILD_DIR"/bind*)" + fi - if [ "$REUSE_BUILD" = y ] && ls -1 "$RPM_BUILD_DIR"/bind* > /dev/null + if [ "$REUSE_BUILD" = y ] && [ -d "$BIND_BUILD" ] > /dev/null then rlLog "Skipping $PACKAGE build" else @@ -181,7 +187,7 @@ rlJournalStart fi # the test - rlRun "cd $RPM_BUILD_DIR/bind*" + rlRun "cd $BIND_BUILD" rlLogInfo "Test takes place in `pwd`" @@ -248,6 +254,7 @@ rlJournalStart # This would catch just errors on 9.11+ if [ -f bin/tests/system/testsummary.sh ]; then FAILED_TESTS=`grep '^R:[a-z0-9_-][a-z0-9_-]*:FAIL' $TMPDIR/test.txt | cut -d':' -f2 | sort | xargs echo` + PASSED_TESTS=`grep '^R:[a-z0-9_-][a-z0-9_-]*:PASS' $TMPDIR/test.txt | cut -d':' -f2 | sort | xargs echo` if [ -n "$FAILED_TESTS" ]; then rlLog "Failed tests: $FAILED_TESTS" rlRun "tar czf $TMPDIR/failed-artifacts.tar.gz -C bin/tests/system $FAILED_TESTS" 0 "Archiving failed artifacts in tests" @@ -256,6 +263,7 @@ rlJournalStart fi else FAILED_TESTS=:any: + PASSED_TESTS=:any: rlRun "tar czf $TMPDIR/failed-artifacts.tar.gz bin/tests/system" 0 "Archiving all system tests" fi @@ -265,6 +273,7 @@ rlJournalStart rlRun "popd" rlRun "grep -C 10 FAIL $TMPDIR/test.txt" 0-255 "Quickly show the test error (if any)." + rlRun "grep PASS $TMPDIR/test.txt" 0 "Quickly show passed tests." #list of failures: rlRun "$FILTER $TMPDIR/test.txt" 0 "Showing unsuccessful tests"