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 56e9c97..0e259fa 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 @@ -32,6 +30,7 @@ recommend: - rng-tools - gcc-c++ - python3-dns + - python3-pytest adjust+: - enabled: false when: distro == rhel @@ -48,6 +47,10 @@ 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 diff --git a/Sanity/named/Run-internal-BIND-test-suite/runtest.sh b/Sanity/named/Run-internal-BIND-test-suite/runtest.sh index 7277646..f434b64 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 @@ -48,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" @@ -92,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 @@ -144,32 +145,49 @@ 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 -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 #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 [ -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 ] && [ -d "$BIND_BUILD" ] > /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 $BIND_BUILD" rlLogInfo "Test takes place in `pwd`" @@ -184,6 +202,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 +219,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,16 +237,24 @@ 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 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" @@ -229,13 +263,17 @@ 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 + + [ "$DEBUG" = y ] && PS1="posttest-debug $PS1" bash -i rlRun "./bin/tests/system/ifconfig.sh down" 0 "Remove fake network interfaces." 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"