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.
This commit is contained in:
Petr Menšík 2023-01-29 14:02:50 +01:00
commit 2da9e653c8
2 changed files with 18 additions and 14 deletions

View file

@ -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)

View file

@ -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