From d14afcb392c86e7514e5d5a533cfa23ec4c87116 Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Mar 24 2021 21:48:39 +0000 Subject: init FMF CI gating --- 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..84b7773 --- /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: baseos-ci.brew-build.tier1.functional} +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.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/source-highlight-testsuite/Makefile b/tests/source-highlight-testsuite/Makefile new file mode 100644 index 0000000..252ffaa --- /dev/null +++ b/tests/source-highlight-testsuite/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/source-highlight/Sanity/source-highlight-testsuite +# Description: source-highlight testing by upstream testsuite +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/source-highlight/Sanity/source-highlight-testsuite +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: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: source-highlight testing by upstream testsuite" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 30m" >> $(METADATA) + @echo "RunFor: source-highlight" >> $(METADATA) + @echo "Requires: source-highlight rpm-build yum-utils gcc-c++" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/source-highlight-testsuite/PURPOSE b/tests/source-highlight-testsuite/PURPOSE new file mode 100644 index 0000000..27ef088 --- /dev/null +++ b/tests/source-highlight-testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/source-highlight/Sanity/source-highlight-testsuite +Description: source-highlight testing by upstream testsuite +Author: Michal Kolar diff --git a/tests/source-highlight-testsuite/main.fmf b/tests/source-highlight-testsuite/main.fmf new file mode 100644 index 0000000..850006d --- /dev/null +++ b/tests/source-highlight-testsuite/main.fmf @@ -0,0 +1,16 @@ +summary: source-highlight testing by upstream testsuite +description: '' +contact: +- Michal Kolar +component: +- source-highlight +test: ./runtest.sh +framework: beakerlib +recommend: +- source-highlight +- rpm-build +- yum-utils +- gcc-c++ +duration: 30m +extra-summary: /tools/source-highlight/Sanity/source-highlight-testsuite +extra-task: /tools/source-highlight/Sanity/source-highlight-testsuite diff --git a/tests/source-highlight-testsuite/runtest.sh b/tests/source-highlight-testsuite/runtest.sh new file mode 100755 index 0000000..a1e047d --- /dev/null +++ b/tests/source-highlight-testsuite/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 /tools/source-highlight/Sanity/source-highlight-testsuite +# Description: source-highlight testing by upstream testsuite +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +BUILD_USER=${BUILD_USER:-srchghlghtbld} +TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-100} +PACKAGE="source-highlight" +REQUIRES="$PACKAGE rpm-build gcc-c++" +if rlIsFedora; then + REQUIRES="$REQUIRES dnf-utils" +else + REQUIRES="$REQUIRES yum-utils" +fi + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm --all + rlRun "TmpDir=\$(mktemp -d)" + rlRun "pushd $TmpDir" + rlFetchSrcForInstalled $PACKAGE + rlRun "useradd -M -N $BUILD_USER" 0,9 + [ "$?" == "0" ] && rlRun "del=yes" + rlRun "chown -R $BUILD_USER:users $TmpDir" + rlPhaseEnd + + rlPhaseStartSetup "build source-highlight" + rlRun "rpm -D \"_topdir $TmpDir\" -U *.src.rpm" + rlRun "yum-builddep -y $TmpDir/SPECS/*.spec" + rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/rpmbuild.log" + rlRun "cd $TmpDir/BUILD/source-highlight-*" + rlRun "su -c './configure --build=`arch`-redhat-linux-gnu &>$TmpDir/configure.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/configure.log" + rlRun "cd tests" + rlPhaseEnd + + rlPhaseStartTest "run testsuite" + rlRun "su -c 'make -k PROGEXE=`which source-highlight` check &>$TmpDir/testsuite.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/testsuite.log" + rlPhaseEnd + + rlPhaseStartTest "evaluate results" + rlRun "cd $TmpDir" + rlRun "grep -E 'Makefile.+Error' testsuite.log" 1 + rlRun "tests_count=\$(grep -E '^`which source-highlight`' testsuite.log | wc -l)" + [ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + [ "$del" == "yes" ] && rlRun "userdel $BUILD_USER" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd