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.
This commit is contained in:
Petr Menšík 2024-09-04 22:41:13 +02:00
commit c43a4c844a
3 changed files with 22 additions and 15 deletions

View file

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

View file

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

View file

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