From 0f20ac28a83dae3546563c24fff4ededbd219d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Wed, 14 Apr 2021 20:13:14 +0200 Subject: [PATCH] enable CI gating --- .fmf/version | 1 + gating.yaml | 20 +++++++ plans/ci.fmf | 6 ++ tests/sanity_test/Makefile | 66 ++++++++++++++++++++++ tests/sanity_test/PURPOSE | 7 +++ tests/sanity_test/main.fmf | 19 +++++++ tests/sanity_test/runtest.sh | 106 +++++++++++++++++++++++++++++++++++ 7 files changed, 225 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/ci.fmf create mode 100644 tests/sanity_test/Makefile create mode 100644 tests/sanity_test/PURPOSE create mode 100644 tests/sanity_test/main.fmf create mode 100755 tests/sanity_test/runtest.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6107f0d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,20 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: baseos-qe.koji-build.scratch-build.validation} +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..1ad2c12 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,6 @@ +summary: CI Gating Plan +discover: + how: fmf + directory: tests +execute: + how: beakerlib diff --git a/tests/sanity_test/Makefile b/tests/sanity_test/Makefile new file mode 100644 index 0000000..cd0b171 --- /dev/null +++ b/tests/sanity_test/Makefile @@ -0,0 +1,66 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/tbb/Sanity/upstream +# Description: Test for package tbb that tests the whole library +# Author: Filip Holec +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/tbb/Sanity/upstream +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: Filip Holec " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for package tbb that tests the whole library" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: tbb" >> $(METADATA) + @echo "Requires: tbb tbb-devel rpm-build gcc-c++" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 844976" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + @echo "Architectures: x86_64 ppc64le aarch64 s390x" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/sanity_test/PURPOSE b/tests/sanity_test/PURPOSE new file mode 100644 index 0000000..9a18128 --- /dev/null +++ b/tests/sanity_test/PURPOSE @@ -0,0 +1,7 @@ +PURPOSE of /tools/tbb/Sanity/upstream +Description: Test for package tbb that tests the whole library +Author: Filip Holec +Bug summary: [RFE] Provide tbb (dependency of suitesparse, SciPy) +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=844976 + +Test for package tbb that tests the whole library diff --git a/tests/sanity_test/main.fmf b/tests/sanity_test/main.fmf new file mode 100644 index 0000000..bb4a449 --- /dev/null +++ b/tests/sanity_test/main.fmf @@ -0,0 +1,19 @@ +summary: Test for package tbb that tests the whole library +description: | + Bug summary: [RFE] Provide tbb (dependency of suitesparse, SciPy) + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=844976 + + Test for package tbb that tests the whole library +contact: Filip Holec +component: +- tbb +test: ./runtest.sh +framework: beakerlib +recommend: +- tbb +- tbb-devel +- rpm-build +- gcc-c++ +duration: 5m +extra-summary: /tools/tbb/Sanity/upstream +extra-task: /tools/tbb/Sanity/upstream diff --git a/tests/sanity_test/runtest.sh b/tests/sanity_test/runtest.sh new file mode 100755 index 0000000..2e9f995 --- /dev/null +++ b/tests/sanity_test/runtest.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/tbb/Sanity/upstream +# Description: Test for package tbb that tests the whole library +# Author: Filip Holec +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh + +PACKAGES=${PACKAGES:-tbb} +REQUIRES=${REQUIRES:-tbb-devel} + +rlJournalStart + rlPhaseStartSetup + # Determine what architecture is the test running on + ARCH=$(rlGetPrimaryArch) + + # work around https://bugzilla.redhat.com/show_bug.cgi?id=1374681 + sed -i 's/\/mnt\/redhat\/scripts\/rel-eng\/utility\/find_package/\/usr\/bin\/find_package/' /usr/share/beakerlib/plugins/rh-internal.sh + wget -O /usr/bin/find_package http://nfs.englab.brq.redhat.com/scratch/mcermak/conf/find_package + chmod a+rx /usr/bin/find_package + # Supported architectures are i386 and x86_64 + if [ $ARCH = "i386" -o $ARCH="x86_64" ] ; then + # Check if RPMs are installed + rlAssertRpm --all + + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + + # Download tests from lookaside and decompress them + PY_COLLECTION=$(echo $COLLECTIONS | egrep -o 'python\w+') + if [[ -n $PY_COLLECTION ]] && rlIsRHEL 6 + then + echo "${PY_COLLECTION}-tbb" + rlRun "rlFetchSrcForInstalled ${PY_COLLECTION}-tbb" \ + 0 "Download tbb source RPM" + + if [ "$PY_COLLECTION" == "python27" ] + then + FLAGS="CXXFLAGS='-I/opt/rh/python27/root/usr/include/ -L/opt/rh/python27/root/usr/lib64'" + tbb_prefix="/tbb" + else + FLAGS="CXXFLAGS='-I/opt/rh/python33/root/usr/include/ -L/opt/rh/python33/root/usr/lib64'" + tbb_prefix="" + fi + + else + FLAGS="" + echo tbb + rlRun "rlFetchSrcForInstalled tbb" \ + 0 "Download tbb source RPM" + fi + rlRun "rpm --define '_topdir $TmpDir' -i *src.rpm" \ + 0 "Installing the source rpm" + rlRun "mkdir BUILD" 0 "Creating BUILD directory" + rlRun "rpmbuild --nodeps --define '_topdir $TmpDir' -bp $TmpDir/SPECS/*spec" \ + 0 "Preparing sources" + rlRun "pushd ./BUILD/" 0 "Go to source directory" + else + rlLog "tbb is not available for $ARCH, skipping the test" + fi + rlPhaseEnd + + rlPhaseStartTest + # Test if architecture is supported + if [ $ARCH = "i386" -o $ARCH="x86_64" ] ; then + # Make and make fibonacci + rlRun "pushd .${tbb_prefix}/oneTBB*/examples/test_all/fibonacci; make ${FLAGS}" 0 \ + "Enter fibonacci example directory and make" + # Run the fibonacci test + rlRun "./fibonacci" 0 \ + "Testing fibonacci (which is complex testing of nearly all tbb library)" + fi + rlPhaseEnd + + rlPhaseStartCleanup + # Test if architecture is supported + if [ $ARCH = "i386" -o $ARCH="x86_64" ] ; then + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + fi + rlPhaseEnd +rlJournalPrintText +rlJournalEnd