From 3d836c474ca7b2a9e6999497ed63fde3eb102099 Mon Sep 17 00:00:00 2001 From: Kaleemullah Siddiqui Date: Tue, 22 Jun 2021 15:43:19 +0530 Subject: [PATCH] Missing tier0 gating tests added Tier0 tests were part of RHEL8 which were not added in RHEL9 in following commit 96aed6bf631980202a2897a8854a409c24f8a543 Now added with this change which will execute the tier0 tests in osci Related: rhbz#1947473 Signed-off-by: Kaleemullah Siddiqui --- gating.yaml | 1 + tests/.fmf/version | 1 + tests/provision.fmf | 5 ++ tests/tests.yml | 18 ++++ .../Makefile | 72 ++++++++++++++++ .../PURPOSE | 3 + .../runtest.sh | 82 +++++++++++++++++++ 7 files changed, 182 insertions(+) create mode 100644 tests/.fmf/version create mode 100644 tests/provision.fmf create mode 100644 tests/tests.yml create mode 100644 tests/upstream-testsuite-execution-and-rebuild-test/Makefile create mode 100644 tests/upstream-testsuite-execution-and-rebuild-test/PURPOSE create mode 100644 tests/upstream-testsuite-execution-and-rebuild-test/runtest.sh diff --git a/gating.yaml b/gating.yaml index 6ab516d..f2b91b8 100644 --- a/gating.yaml +++ b/gating.yaml @@ -4,4 +4,5 @@ product_versions: - rhel-9 decision_context: osci_compose_gate rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} - !PassingTestCaseRule {test_case_name: idm-ci.brew-build.tier1.functional} diff --git a/tests/.fmf/version b/tests/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/provision.fmf b/tests/provision.fmf new file mode 100644 index 0000000..016a5e7 --- /dev/null +++ b/tests/provision.fmf @@ -0,0 +1,5 @@ +--- + +standard-inventory-qcow2: + qemu: + m: 2G diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..1353d98 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,18 @@ +--- +- hosts: localhost + tags: [ always ] + tasks: + - set_fact: + our_required_packages: + - wget # upstream-testsuite-execution-and-rebuild-test needs wget command + - yum-utils # upstream-testsuite-execution-and-rebuild-test needs yum-builddep command + - rpm-build # upstream-testsuite-execution-and-rebuild-test needs rpmbuild command + +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-beakerlib + tests: + - upstream-testsuite-execution-and-rebuild-test + required_packages: "{{ our_required_packages }}" diff --git a/tests/upstream-testsuite-execution-and-rebuild-test/Makefile b/tests/upstream-testsuite-execution-and-rebuild-test/Makefile new file mode 100644 index 0000000..d21fa95 --- /dev/null +++ b/tests/upstream-testsuite-execution-and-rebuild-test/Makefile @@ -0,0 +1,72 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/sudo/Sanity/upstream-testsuite-execution-and-rebuild-test +# Description: This test rebuild sudo source rpm and checks that rebuild is OK. The second - main - part is about upstream testsuite execution. +# Author: Ales Marecek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Based on sudo rebuild test + +export TEST=/CoreOS/certmonger/Sanity/upstream-testsuite-execution-and-rebuild-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Rob Crittenden " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: This test rebuild sudo source rpm and checks that rebuild is OK. The second - main - part is about upstream testsuite execution." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 30m" >> $(METADATA) + @echo "RunFor: sudo" >> $(METADATA) + @echo "Requires: sudo" >> $(METADATA) + @echo "Requires: sed" >> $(METADATA) + @echo "Requires: grep" >> $(METADATA) + @echo "Requires: rpm-build" >> $(METADATA) + @echo "Requires: yum-utils" >> $(METADATA) + @echo "Requires: make" >> $(METADATA) + @echo "Requires: libcap-devel" >> $(METADATA) + @echo "Requires: audit-libs-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/upstream-testsuite-execution-and-rebuild-test/PURPOSE b/tests/upstream-testsuite-execution-and-rebuild-test/PURPOSE new file mode 100644 index 0000000..162cdc5 --- /dev/null +++ b/tests/upstream-testsuite-execution-and-rebuild-test/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/certmonger/Sanity/upstream-testsuite-execution-and-rebuild-test +Description: This test rebuild certmonger source rpm and checks that rebuild is OK. The second - main - part is about upstream testsuite execution. +Author: Rob Crittenden diff --git a/tests/upstream-testsuite-execution-and-rebuild-test/runtest.sh b/tests/upstream-testsuite-execution-and-rebuild-test/runtest.sh new file mode 100644 index 0000000..9979e4e --- /dev/null +++ b/tests/upstream-testsuite-execution-and-rebuild-test/runtest.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/sudo/Sanity/upstream-testsuite-execution-and-rebuild-test +# Description: This test rebuild sudo source rpm and checks that rebuild is OK. The second - main - part is about upstream testsuite execution. +# Author: Ales Marecek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Based on sudo rebuild test + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="certmonger" +_SPEC_DIR="$(rpm --eval=%_specdir)" +_BUILD_DIR="$(rpm --eval=%_builddir)" +_LOG_REBUILD_F="${PACKAGE}-rebuild.log" +_LOG_TESTSUITE_F="${PACKAGE}-testsuite.log" + + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + # Source package is needed for code inspection + rlFetchSrcForInstalled "${PACKAGE}" || yumdownloader --source "${PACKAGE}" + rlRun "find . -size 0 -delete" 0 "Remove empty src.rpm-s" + rlRun "yum-builddep -y --nogpgcheck ${PACKAGE}-*.src.rpm" 0 "Installing build dependencies" + [ -d ${_BUILD_DIR} ] && rlRun "rm -rf ${_BUILD_DIR}/*" 0 "Cleaning build directory" + rlRun "rpm -ivh ${PACKAGE}-*.src.rpm" 0 "Installing source rpm" + rlPhaseEnd + + rlPhaseStartTest + rlRun "QA_RPATHS=0x0002 rpmbuild -ba ${_SPEC_DIR}/${PACKAGE}.spec" 0 "Test: Rebuild of source '${PACKAGE}' package" + rlGetPhaseState + if [ $? -eq 0 ]; then + cd ${_BUILD_DIR}/${PACKAGE}-* + rlRun -s "make check" 0 "Test: Upstream testsuite" + cd ${TmpDir} + while read -r I; do + if [[ "$I" =~ $(echo '([^:]+): .+ tests run, .+ errors, (.*)% success rate') ]]; then + [[ "${BASH_REMATCH[2]}" == "100" ]] + rlAssert0 "Test: Checking tests of '${BASH_REMATCH[1]}'" $? + elif [[ "$I" =~ $(echo "([^:]+): .+ tests passed; (.+)/.+ tests failed") ]]; then + [[ "${BASH_REMATCH[2]}" == "0" ]] + rlAssert0 "Test: Checking tests of '${BASH_REMATCH[1]}'" $? + fi + done < $rlRun_LOG + rm -f $rlRun_LOG + else + rlFail "Skipping testsuite part because rebuild part failed." + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd