From d2c731e954c96dacf3432486103b70bf1c3b94cd Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Tue, 20 Apr 2021 11:26:00 +0000 Subject: [PATCH] init FMF CI gating --- .fmf/version | 1 + gating.yaml | 22 +++++++ plans/ci.fmf | 6 ++ tests/cmake-testsuite-sanity/Makefile | 63 ++++++++++++++++++ tests/cmake-testsuite-sanity/PURPOSE | 3 + tests/cmake-testsuite-sanity/main.fmf | 15 +++++ tests/cmake-testsuite-sanity/runtest.sh | 85 +++++++++++++++++++++++++ tests/cmake-testsuite-sanity/tests | 85 +++++++++++++++++++++++++ 8 files changed, 280 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/ci.fmf create mode 100644 tests/cmake-testsuite-sanity/Makefile create mode 100644 tests/cmake-testsuite-sanity/PURPOSE create mode 100644 tests/cmake-testsuite-sanity/main.fmf create mode 100755 tests/cmake-testsuite-sanity/runtest.sh create mode 100644 tests/cmake-testsuite-sanity/tests 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..9d32f2a --- /dev/null +++ b/gating.yaml @@ -0,0 +1,22 @@ +--- !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 +baseos-ci.brew-build.tier1.functional} +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional +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/cmake-testsuite-sanity/Makefile b/tests/cmake-testsuite-sanity/Makefile new file mode 100644 index 0000000..1202d64 --- /dev/null +++ b/tests/cmake-testsuite-sanity/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/cmake/Sanity/cmake-testsuite-sanity +# Description: cmake 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/cmake/Sanity/cmake-testsuite-sanity +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE tests + +.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: cmake testing by upstream testsuite" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 1h" >> $(METADATA) + @echo "RunFor: cmake" >> $(METADATA) + @echo "Requires: cmake dnf-utils rpm-build" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7 -RHEL8" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/cmake-testsuite-sanity/PURPOSE b/tests/cmake-testsuite-sanity/PURPOSE new file mode 100644 index 0000000..21b627e --- /dev/null +++ b/tests/cmake-testsuite-sanity/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/cmake/Sanity/cmake-testsuite-sanity +Description: cmake testing by upstream testsuite +Author: Michal Kolar diff --git a/tests/cmake-testsuite-sanity/main.fmf b/tests/cmake-testsuite-sanity/main.fmf new file mode 100644 index 0000000..298b6e2 --- /dev/null +++ b/tests/cmake-testsuite-sanity/main.fmf @@ -0,0 +1,15 @@ +summary: cmake testing by upstream testsuite +description: '' +contact: +- Michal Kolar +component: +- cmake +test: ./runtest.sh +framework: beakerlib +recommend: +- cmake +- dnf-utils +- rpm-build +duration: 1h +extra-summary: /tools/cmake/Sanity/cmake-testsuite-sanity +extra-task: /tools/cmake/Sanity/cmake-testsuite-sanity diff --git a/tests/cmake-testsuite-sanity/runtest.sh b/tests/cmake-testsuite-sanity/runtest.sh new file mode 100755 index 0000000..d76fdc0 --- /dev/null +++ b/tests/cmake-testsuite-sanity/runtest.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/cmake/Sanity/cmake-testsuite-sanity +# Description: cmake 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:-cmkbld} +TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-50} +PACKAGE="cmake" +REQUIRES="$PACKAGE rpm-build" +if rlIsFedora; then + REQUIRES="$REQUIRES dnf-utils" +else + REQUIRES="$REQUIRES yum-utils" +fi + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm --all + rlRun "TmpDir=`mktemp -d`" + rlRun "cp tests $TmpDir" + 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 cmake" + rlRun "rpm -D \"_topdir $TmpDir\" -U *.src.rpm" + rlRun "dnf 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/cmake*" + rlRun "su -c './bootstrap &>$TmpDir/bootstrap.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/bootstrap.log" + rlRun "ln -s /usr/bin/cmake bin/cmake" + rlPhaseEnd + + rlPhaseStartTest "run testsuite" + while read test; do + rlRun "su -c '/usr/bin/ctest -R \"$test\" &>>$TmpDir/testsuite.log' $BUILD_USER" + done <$TmpDir/tests + rlRun "rlFileSubmit $TmpDir/testsuite.log" + rlPhaseEnd + + rlPhaseStartTest "evaluate results" + rlRun "cd $TmpDir" + rlRun "grep -E '\*\*\*(F|f)ailed' testsuite.log" 1 "There should be no failure" + rlRun "tests_count=\$(grep -E 'Test #[0-9]+: .+\.\.\. (P|p)assed' 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 -f $BUILD_USER" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/cmake-testsuite-sanity/tests b/tests/cmake-testsuite-sanity/tests new file mode 100644 index 0000000..5f9ae48 --- /dev/null +++ b/tests/cmake-testsuite-sanity/tests @@ -0,0 +1,85 @@ +RunCMake.CMakeRoleGlobalProperty +RunCMake.CompilerChange +RunCMake.CompilerNotFound +RunCMake.DisallowedCommands +RunCMake.ExportCompileCommands +RunCMake.ExcludeFromAll +RunCMake.ExternalData +RunCMake.FeatureSummary +RunCMake.GeneratorInstance +RunCMake.GeneratorPlatform +RunCMake.GeneratorToolset +RunCMake.GetPrerequisites +RunCMake.GNUInstallDirs +RunCMake.Languages +RunCMake.LinkStatic +RunCMake.ParseImplicitIncludeInfo +RunCMake.ParseImplicitLinkInfo +RunCMake.ScriptMode +RunCMake.TargetObjects +RunCMake.TargetProperties +RunCMake.ToolchainFile +RunCMake.find_dependency +RunCMake.CompileDefinitions +RunCMake.PolicyScope +RunCMake.WriteBasicConfigVersionFile +RunCMake.SourceProperties +RunCMake.WorkingDirectory +RunCMake.add_custom_target +RunCMake.add_dependencies +RunCMake.add_executable +RunCMake.build_command +RunCMake.cmake_minimum_required +RunCMake.cmake_parse_arguments +RunCMake.continue +RunCMake.ctest_cmake_error +RunCMake.ctest_configure +RunCMake.ctest_coverage +RunCMake.ctest_start +RunCMake.ctest_disabled_test +RunCMake.ctest_skipped_test +RunCMake.ctest_update +RunCMake.ctest_upload +RunCMake.file-CHMOD +RunCMake.find_file +RunCMake.find_library +RunCMake.find_path +RunCMake.find_program +RunCMake.foreach +RunCMake.function +RunCMake.get_filename_component +RunCMake.get_property +RunCMake.if +RunCMake.include +RunCMake.include_directories +RunCMake.include_guard +RunCMake.load_cache +RunCMake.math +RunCMake.message +RunCMake.option +RunCMake.project_injected +RunCMake.return +RunCMake.separate_arguments +RunCMake.set_property +RunCMake.string +RunCMake.test_include_dirs +RunCMake.BundleUtilities +RunCMake.try_run +RunCMake.set +RunCMake.variable_watch +RunCMake.while +RunCMake.TargetPolicies +RunCMake.no_install_prefix +RunCMake.SymlinkTrees +RunCMake.File_Archive +RunCMake.File_Configure +RunCMake.ExportWithoutLanguage +RunCMake.target_compile_definitions +RunCMake.target_compile_options +RunCMake.target_include_directories +RunCMake.target_sources +RunCMake.CommandLineTar +RunCMake.CPackCommandLine +RunCMake.CacheNewline +RunCMake.CPackSymlinks +RunCMake.CTestCommandExpandLists