Update to RHEL test variant

This commit is contained in:
Petr Menšík 2022-09-09 17:30:26 +02:00
commit 85d8ed4279
5 changed files with 261 additions and 127 deletions

View file

@ -1,9 +1,10 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of tests/Run-internal-BIND-test-suite
# Makefile of /CoreOS/bind/Sanity/Run-internal-BIND-test-suite
# Description: Run internal BIND test suite
# Author: Martin Cermak <mcermak@redhat.com>
# Author: Petr Mensik <pemensik@redhat.com>
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
@ -26,7 +27,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/bind/Sanity/Run-internal-BIND-test-suite
export TESTVERSION=1.3
export TESTVERSION=1.7
BUILT_FILES=
@ -44,31 +45,31 @@ clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Owner: Petr Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Run internal BIND test suite" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 8h" >> $(METADATA)
@echo "TestTime: 14h" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind rpm-build bind-utils" >> $(METADATA)
@echo "Requires: perl-Net-DNS perl-Net-DNS-Nameserver" >> $(METADATA)
@echo "Requires: perl-Time-HiRes" >> $(METADATA)
@echo "Requires: bind-pkcs11 bind-pkcs11-utils softhsm" >> $(METADATA)
@echo "Requires: openssl-devel libtool autoconf" >> $(METADATA)
# Try to satisfy all build dependencies from here
@echo "Requires: bind-devel" >> $(METADATA)
@echo "Requires: net-tools" >> $(METADATA)
@echo "Requires: dnf-utils" >> $(METADATA)
@echo "Requires: kyua" >> $(METADATA)
@echo "Requires: libcmocka-devel" >> $(METADATA)
# Obsolete, uses cmocka
# @echo "Requires: libatf-c gcc-c++" >> $(METADATA)
@echo "Requires: perl perl(Net::DNS) perl(Net::DNS::Nameserver) perl(Time::HiRes)" >> $(METADATA)
@echo "Requires: perl(IO::Socket::INET6)" >> $(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)
@echo "Requires: yum-utils dnf-utils rng-tools" >> $(METADATA)
@echo "Requires: gcc-c++" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 642970" >> $(METADATA)
@echo "Bug: 642970 1832812 1869502 1956777" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,4 +1,4 @@
PURPOSE of tests/Run-internal-BIND-test-suite
PURPOSE of /CoreOS/bind/Sanity/Run-internal-BIND-test-suite
Description: Run internal BIND test suite
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: Run internal BIND test suite

View file

@ -1,2 +1 @@
A:System test dlz
A:System test idna

View file

@ -1,41 +1,73 @@
summary: Run internal BIND test suite
description: |+
description: |
Bug summary: Run internal BIND test suite
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=642970
contact: Petr Sklenar <psklenar@redhat.com>
component:
- bind
- bind
test: ./runtest.sh
require:
- bind
- rpm-build
- bind-utils
- perl-Net-DNS
- perl-Net-DNS-Nameserver
- perl-Time-HiRes
- bind-pkcs11
- bind-pkcs11-utils
- softhsm
- openssl-devel
- libtool
- autoconf
- bind-devel
- net-tools
- dnf-utils
- kyua
- libcmocka-devel
duration: 8h
framework: beakerlib
recommend:
- bind
- rpm-build
- bind-utils
- bind-pkcs11
- bind-pkcs11-utils
- softhsm
- openssl-devel
- libtool
- autoconf
- perl
- perl(Net::DNS)
- perl(Net::DNS::Nameserver)
- perl(Time::HiRes)
- perl(IO::Socket::INET6)
- libcap-devel
- libidn-devel
- libxml2-devel
- kyua
- openldap-devel
- postgresql-devel
- sqlite-devel
- krb5-devel
- net-tools
- iproute
- yum-utils
- dnf-utils
- rng-tools
- gcc-c++
duration: 14h
enabled: true
tag:
- CI-Tier-1
- TIPfail
- buildroot
- notier
- notip
- rhel8-buildroot
- source
- build
- CI-Tier-1
- TIPfail
- buildroot
- notier
- notip
- rhel-buildroot
- rhel8-buildroot
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=642970
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1832812
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1869502
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1956777
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=672514
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=703494
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1704328
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1876492
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=623122
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1679766
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1882040
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1683009
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=643012
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1683015
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=906312
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1679307
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1664863
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1832814
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=653817
extra-nitrate: TC#0126580
extra-summary: /CoreOS/bind/Sanity/Run-internal-BIND-test-suite
extra-task: /CoreOS/bind/Sanity/Run-internal-BIND-test-suite
extra-nitrate: TC#0126580

View file

@ -2,9 +2,9 @@
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of tests/Run-internal-BIND-test-suite
# runtest.sh of /CoreOS/bind/Sanity/Run-internal-BIND-test-suite
# Description: Run internal BIND test suite
# Author: Martin Cermak <mcermak@redhat.com>
# Authors: pemensik@redhat.com psklenar@redhat.com mcermak@redhat.com
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
@ -25,99 +25,149 @@
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Usable variables:
# override make target to start testing on more threads
# MAKE_TEST='-j4 test'
# Do not clean existing build if already built
# REUSE_BUILD=y
# Make retest faster, skip build if possible
# QUICK=y
# Include rhts environment
. /usr/lib/beakerlib/beakerlib.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
# Set those variables to n to skip tests on variants
#DEFAULT_VARIANTS="normal pkcs11 sdb"
DEFAULT_VARIANTS="normal"
#TEST_VARIANTS="normal"
#
# Runs test suite and checks known errors
# Prepared to be repeated with another variants
run_testsuite()
{
local RESULT_TEXT="$TMPDIR/test${NAMED_VARIANT}.txt"
local FOUNDERROR=`mktemp found-XXXXXXXX.err`
local KNOWNERROR=/dev/null
if [ -f "$ORIG/knownerror${NAMED_VARIANT}.$TAG" ]; then
KNOWNERROR=`readlink -f $ORIG/knownerror.$TAG`
elif [ -f "$ORIG/knownerror${NAMED_VARIANT}" ]; then
KNOWNERROR=`readlink -f $ORIG/knownerror`
fi
# Sometime it can fail. Report just failures that are not known
rlRun "make test -j${CORES:-1} &> $RESULT_TEXT" 0-255 "Perform the test."
rlRun "grep -C 10 FAIL $RESULT_TEXT" 0-255 "Quickly show the test error (if any)."
rlRun "$FILTER $RESULT_TEXT" 0 "Showing unsuccessful tests"
rlRun "$FILTER -s $RESULT_TEXT > $FOUNDERROR" 0
rlRun "ls $KNOWNERROR $FOUNDERROR $RESULT_TEXT" 0 'check if there is needed files'
rlLog "`cat $FOUNDERROR`"
rlAssertLesserOrEqual "Checking number of found errors is in limits" "$(grep '^FAIL' $FOUNDERROR | wc -l)" "$(wc -l <$KNOWNERROR)"
cat $FOUNDERROR | while read STATUS TEST ; do
if [ "$STATUS" = FAIL ]; then
rlRun "grep '$TEST' $KNOWNERROR" 0 "Check $TEST failure is expected"
else
rlLog "$STATUS $TEST"
fi
done
}
PACKAGE=""
USER="user$RANDOM"
CORES=1
rpm -q bind && PACKAGE="bind"
rpm -q bind97 && PACKAGE="bind97"
rlJournalStart
rlPhaseStartSetup
rlRun "useradd $USER"
rlLog "Available entropy: $(cat /proc/sys/kernel/random/entropy_avail)"
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 rpm-build
rlAssertRpm perl-Net-DNS-Nameserver
rlServiceStart "rngd"
rngd -r /dev/urandom -o /dev/random
sleep 60
rlLog "Available entropy: $(cat /proc/sys/kernel/random/entropy_avail)"
#pwd
ORIG=`pwd`
FOUNDERROR=`mktemp`
SETUP_SOFTHSM=`readlink -f setup-named-softhsm.sh`
FILTER=`readlink -f bind-systest-filter.sh`
CORES=`grep 'processor\s*:' /proc/cpuinfo | wc -l`
TAG=generic
if [ -f /etc/os-release ]; then
# extract platform tag
VERSION_ID=`(source /etc/os-release && echo ${ID}-${VERSION_ID})`
TAG=`(source /etc/os-release && echo ${PLATFORM_ID#platform:})`
else
rlIsRHEL '6' && TAG=el6
fi
if [ -f "knownerror.$VERSION_ID" ]; then
KNOWNERROR=`readlink -f knownerror.$VERSION_ID`
elif [ -f "knownerror.$TAG" ]; then
KNOWNERROR=`readlink -f knownerror.$TAG`
elif [ -f "knownerror" ]; then
KNOWNERROR=`readlink -f knownerror`
fi
if [ -z "$CORES" ]; then
rlRun "CORES=$(grep '^processor\s*:' /proc/cpuinfo | wc -l)" 0 "Count available CPU cores"
fi
if [ -n "$QUICK" ]; then
REUSE_BUILD=y
MAKE_TEST="test -j$CORES"
fi
#tempdir
rlRun "TMPDIR=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TMPDIR"
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
fi
# topdir
TOPDIR=`rpm -E '%{_topdir}'`
if rlIsRHEL 3 || rlIsRHEL 4 || rlIsRHEL 5; then
TOPDIR="/usr/src/redhat"
else
TOPDIR="/root/rpmbuild"
fi
# cleanup in topdir
mkdir -p $TOPDIR/{BUILD,SOURCES,SPECS}
rm -rf $TOPDIR/{BUILD,SOURCES,SPECS}/*
if [ "$REUSE_BUILD" != y ]
then
rlRun "rm -rf $TOPDIR/{BUILD,SOURCES,SPECS}/*"
else
rlLog "Not cleaning previous build"
fi
# download src rpm
if ! ls bind*.src.rpm; then
rlRun "dnf --enablerepo='*-source' download --source bind" 0 "Fetch source from repository"
rlRun "rpm -i bind*.src.rpm"
BINDVER=$(rpm -q bind)
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"
fi
fi
rlRun "rpm --define '_topdir $TOPDIR' -Uvh *rpm &> $TMPDIR/install.txt"
rlRun "cd $TOPDIR/SPECS"
rlRun "dnf -y builddep *.spec"
# softhsm is no longer in normal repository. Enable idm module on RHEL8 to make softhsm module available
if rlIsRHEL 8
then
rlLog "this can fail at rhel8 zstream as no module in profiles"
dnf module reset idm:DL1 -y
rlRun "dnf -y module enable idm:DL1"
fi
if dnf builddep --help >/dev/null; then
rlRun "dnf -y builddep --nobest *.spec --enablerepo=\* --skip-unavailable"
elif which yum-builddep; then
rlRun "yum-builddep -y *.spec"
else
rlWarn "there is nor yum-utils neither dnf-utils for install dependencies, ENJOY!"
fi
#DEBUG smtg
rpm -q softshm || yum install softshm -y --enablerepo=\*
rpm -q kyua || yum install softshm -y --enablerepo=\*
rpm -q perl-IO-Socket-INET6 || yum install -y 'perl(IO::Socket::INET6)' --enablerepo=\*
# stop bind if it is running
rlServiceStop named
service named stop
rlPhaseEnd
rlPhaseStartTest
# rebuild from source
rlRun "rpmbuild -ba *.spec &> $TMPDIR/build.txt"
if [ "$REUSE_BUILD" = y ] && ls -1 "$TOPDIR/BUILD"/bind* > /dev/null
then
rlLog "Skipping bind build"
else
# rebuild from source
rlRun "rpmbuild -ba *.spec &> $TMPDIR/build.txt" 0 "Building bind"
fi
# the test
rlRun "cd $TOPDIR/BUILD/bind*"
@ -126,8 +176,8 @@ rlJournalStart
rlRun "chown -R root ."
if [ -x "$SETUP_SOFTHSM" ] && [ -n "$(type -p pkcs11-tokens)" ]; then
rlRun "eval \"$(bash $SETUP_SOFTHSM -A)\"" 0 "Preparing PKCS#11 token slot"
if [ -x "$SETUP_SOFTHSM" ] && type -p pkcs11-tokens; then
rlRun "eval $(bash $SETUP_SOFTHSM -A)" 0 "Preparing PKCS#11 token slot"
rlRun "pkcs11-tokens" 0 "Testing token slot availability"
else
rlLog "PKCS#11 not initialized"
@ -139,46 +189,98 @@ rlJournalStart
BUILD=.
fi
rlRun "./bin/tests/system/ifconfig.sh up" 0 "Setup fake network interfaces."
HOMEPERM=$(stat --printf='%a' "$HOME")
if [ "$HOMEPERM" != "${HOMEPERM%0}" ]; then
# runtime tests under root requires access for nobody user
rlLog "Enabling access to $HOME"
rlRun "chmod o+x \"$HOME\""
fi
# required by idna test
export LC_ALL=en_US.UTF-8
rlRun "pushd $BUILD"
rlRun "./bin/tests/system/ifconfig.sh up" 0 "Setup fake network interfaces."
if echo "${TEST_VARIANTS:-$DEFAULT_VARIANTS}" | grep -q normal; then
rlLog "Running normal variant"
export NAMED_VARIANT= DNSSEC_VARIANT=
run_testsuite
rlLog "Finished normal variant"
# keep separate results on 9.11+
rlRun "sed -e 's/testsummary.sh/& -n/' -i bin/tests/system/Makefile" 0 "Modify to keep results"
# dlz test is broken because specific build way we use. It is supported only by named-sdb
# but that is not even tested by testsuite
rlRun "sed -e 's/ dlz / /' -i bin/tests/system/Makefile" 0 "Skip always failing dlz test"
###### T:cds:1:A ../conf.sh: line 40: DNSSEC_VARIANT: unbound variable
###### remove later (today 2021 Aug)
sed -ie 's/set -eu/set -e/' bin/tests/system/cds/setup.sh
# 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
# 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`
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"
else
rlLog "No failed tests"
fi
else
FAILED_TESTS=:any:
rlRun "tar czf $TMPDIR/failed-artifacts.tar.gz bin/tests/system" 0 "Archiving all system tests"
fi
if echo "${TEST_VARIANTS:-$DEFAULT_VARIANTS}" | grep -q sdb; then
rlLog "Running sdb variant"
export NAMED_VARIANT=-sdb DNSSEC_VARIANT=
run_testsuite
rlLog "Finished sdb variant"
fi
if echo "${TEST_VARIANTS:-$DEFAULT_VARIANTS}" | grep -q pkcs11; then
rlLog "Running pkcs11 variant"
# Unfortunately, PKCS11 variant uses shared key storage
# It cannot use more threads for that reason
export NAMED_VARIANT=-pkcs11 DNSSEC_VARIANT=-pkcs11
CORES=1 run_testsuite
rlLog "Finished pkcs11 variant"
fi
rlRun "popd"
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)."
#list of failures:
rlRun "$FILTER $TMPDIR/test.txt" 0 "Showing unsuccessful tests"
rlRun "$FILTER -s $TMPDIR/test.txt > $FOUNDERROR" 0
rlRun "ls $KNOWNERROR $FOUNDERROR $TMPDIR/test.txt" 0 'check if there are needed files'
rlLog "`echo list;cat $FOUNDERROR`"
FAILED_FOUND="$(grep '^FAIL' $FOUNDERROR | wc -l)"
FAILED_KNOWN="$(wc -l <$KNOWNERROR)"
rlAssertLesserOrEqual "Checking number of found errors is in limits" "$FAILED_FOUND" "$FAILED_KNOWN"
cat $FOUNDERROR | while read STATUS TEST ; do
if [ "$STATUS" = FAIL ]; then
rlRun "grep '$TEST' $KNOWNERROR" 0 "Check $TEST failure is expected"
else
rlLog "$STATUS $TEST"
fi
done
if [ "$FAILED_TESTS" = ':any:' ] && [ "$FAILED_FOUND" -le "$FAILED_KNOWN" ]
then
# Newer version produces archive only when some error occured
rlLog "No error found, not uploading artifacts"
rm -f "$TMPDIR/failed-artifacts.tar.gz"
fi
if [ "$HOMEPERM" != "${HOMEPERM%0}" ]; then
rlLog "Restoring home access rights to $HOMEPERM"
rlRun "chmod 0${HOMEPERM} \"$HOME\""
fi
rlPhaseEnd
rlPhaseStartCleanup "`echo Cores:$CORES;echo ' RESULT_' ;cat $FOUNDERROR|grep 'FAIL'`"
#this phase is only due to report to webUI without needs of open file
rlLog "`echo RESULT_ ;cat $FOUNDERROR|grep FAIL`"
rlPhaseEnd
rlPhaseStartCleanup
rlBundleLogs "BUILD_LOGS" "$TMPDIR/install.txt" "$TMPDIR/builddeps.txt" "$TMPDIR/build.txt"
rlBundleLogs "TEST_LOGS" "$TMPDIR"/test*.txt
rlBundleLogs "TEST_LOGS" "$TMPDIR/install.txt" "$TMPDIR/builddeps.txt" "$TMPDIR/build.txt" "$TMPDIR/test.txt"
if [ -r "$TMPDIR/failed-artifacts.tar.gz" ]; then
rlFileSubmit "$TMPDIR/failed-artifacts.tar.gz" failed-artifacts.tar.gz
fi
rlRun "popd"
rlServiceRestore "rngd"
rlRun "rm -r $TMPDIR" 0 "Removing tmp directory"
rlRun "rm -rf $FOUNDERROR"
rlRun "userdel -f -r $USER"
rlPhaseEnd
rlJournalEnd