From 2da9e653c85febe4a8a757704d730af796052250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sun, 29 Jan 2023 14:02:50 +0100 Subject: [PATCH] Adapt test to run even for different than bind pkg We already have multiple packages with different versions of bind. They can be in RHEL or Fedora. Attempt to support even alternative packages run by overriding PACKAGE environment variable to different base SRPM name. --- Sanity/Run-internal-BIND-test-suite/Makefile | 7 +++--- .../Run-internal-BIND-test-suite/runtest.sh | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Sanity/Run-internal-BIND-test-suite/Makefile b/Sanity/Run-internal-BIND-test-suite/Makefile index 49f400a..4c84b47 100644 --- a/Sanity/Run-internal-BIND-test-suite/Makefile +++ b/Sanity/Run-internal-BIND-test-suite/Makefile @@ -32,6 +32,7 @@ export TESTVERSION=1.7 BUILT_FILES= FILES=$(METADATA) runtest.sh Makefile PURPOSE knownerror* setup-named-softhsm.sh bind-systest-filter.sh +PACKAGE?=bind .PHONY: all install download clean @@ -55,9 +56,9 @@ $(METADATA): Makefile @echo "Description: Run internal BIND test suite" >> $(METADATA) @echo "Type: Sanity" >> $(METADATA) @echo "TestTime: 14h" >> $(METADATA) - @echo "RunFor: bind" >> $(METADATA) - @echo "Requires: bind rpm-build bind-utils" >> $(METADATA) - @echo "Requires: bind-pkcs11 bind-pkcs11-utils softhsm" >> $(METADATA) + @echo "RunFor: $(PACKAGE)" >> $(METADATA) + @echo "Requires: $(PACKAGE) rpm-build $(PACKAGE)-utils $(PACKAGE)-devel" >> $(METADATA) + @echo "Requires: $(PACKAGE)-pkcs11 $(PACKAGE)-pkcs11-utils softhsm" >> $(METADATA) @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) diff --git a/Sanity/Run-internal-BIND-test-suite/runtest.sh b/Sanity/Run-internal-BIND-test-suite/runtest.sh index 4e743c3..59f830e 100755 --- a/Sanity/Run-internal-BIND-test-suite/runtest.sh +++ b/Sanity/Run-internal-BIND-test-suite/runtest.sh @@ -37,11 +37,13 @@ # Include rhts environment . /usr/share/beakerlib/beakerlib.sh || exit 1 -PACKAGE="" +: ${PACKAGE:=bind} USER="user$RANDOM" CORES=1 -rpm -q bind && PACKAGE="bind" -rpm -q bind97 && PACKAGE="bind97" +for PACKAGE in $PACKAGE bind bind97 bind9.16 bind9-next +do + rpm -q "$PACKAGE" && break +done rlJournalStart rlPhaseStartSetup @@ -52,6 +54,7 @@ rlJournalStart # package assertions rlAssertRpm $PACKAGE rlAssertRpm rpm-build + rlRun "rpm -q $PACKAGE-devel || yum install -y $PACKAGE-devel $PACKAGE-utils" rlServiceStart "rngd" rngd -r /dev/urandom -o /dev/random sleep 60 @@ -120,16 +123,16 @@ rlJournalStart fi # download src rpm - BINDVER=$(rpm -q bind) + BINDVER=$(rpm -q $PACKAGE) SRPM="${BINDVER%%.$(arch)}.src.rpm" if [ -f "$ORIG/$SRPM" ]; then rlLog "Found predownloaded package $ORIG/$SRPM" rlRun "rpm -i \"$ORIG/$SRPM\"" else rlFetchSrcForInstalled "$PACKAGE" - if ! ls bind*.src.rpm; then - rlRun "yumdownloader --source bind" 0 "Trying alternative fetch from repository" - rlRun "rpm -i bind*.src.rpm" + if ! ls ${PACKAGE}*.src.rpm; then + rlRun "yumdownloader --source ${PACKAGE}" 0 "Trying alternative fetch from repository" + rlRun "rpm -i ${PACKAGE}*.src.rpm" fi fi @@ -153,8 +156,8 @@ rlJournalStart fi #DEBUG smtg - rpm -q softshm || yum install softshm -y --enablerepo=\* - rpm -q kyua || yum install softshm -y --enablerepo=\* + 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=\* # stop bind if it is running service named stop @@ -163,10 +166,10 @@ rlJournalStart rlPhaseStartTest if [ "$REUSE_BUILD" = y ] && ls -1 "$TOPDIR/BUILD"/bind* > /dev/null then - rlLog "Skipping bind build" + rlLog "Skipping $PACKAGE build" else # rebuild from source - rlRun "rpmbuild -ba *.spec &> $TMPDIR/build.txt" 0 "Building bind" + rlRun "rpmbuild -ba --noclean *.spec &> $TMPDIR/build.txt" 0 "Building $PACKAGE" fi # the test