From 8e0683cc134299cbdbe825b80796427acdabdc67 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 10 Dec 2020 17:51:10 +0100 Subject: [PATCH] Introduce CI gating --- .fmf/version | 1 + gating.yaml | 19 +++++ plans/ci.fmf | 6 ++ tests/README | 2 + tests/Regression/identify/Makefile | 71 ++++++++++++++++ tests/Regression/identify/PURPOSE | 3 + tests/Regression/identify/main.fmf | 21 +++++ tests/Regression/identify/runtest.sh | 42 ++++++++++ .../lto-preprocessor-options/Makefile | 64 ++++++++++++++ .../lto-preprocessor-options/PURPOSE | 3 + .../lto-preprocessor-options/main.fmf | 15 ++++ .../lto-preprocessor-options/runtest.sh | 41 +++++++++ tests/Regression/testsuite/Makefile | 78 +++++++++++++++++ tests/Regression/testsuite/PURPOSE | 3 + tests/Regression/testsuite/main.fmf | 27 ++++++ tests/Regression/testsuite/runtest.sh | 83 +++++++++++++++++++ tests/Sanity/smoke/Makefile | 59 +++++++++++++ tests/Sanity/smoke/PURPOSE | 3 + tests/Sanity/smoke/main.fmf | 15 ++++ tests/Sanity/smoke/runtest.sh | 44 ++++++++++ 20 files changed, 600 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/ci.fmf create mode 100644 tests/README create mode 100644 tests/Regression/identify/Makefile create mode 100644 tests/Regression/identify/PURPOSE create mode 100644 tests/Regression/identify/main.fmf create mode 100755 tests/Regression/identify/runtest.sh create mode 100644 tests/Regression/lto-preprocessor-options/Makefile create mode 100644 tests/Regression/lto-preprocessor-options/PURPOSE create mode 100644 tests/Regression/lto-preprocessor-options/main.fmf create mode 100755 tests/Regression/lto-preprocessor-options/runtest.sh create mode 100644 tests/Regression/testsuite/Makefile create mode 100644 tests/Regression/testsuite/PURPOSE create mode 100644 tests/Regression/testsuite/main.fmf create mode 100755 tests/Regression/testsuite/runtest.sh create mode 100644 tests/Sanity/smoke/Makefile create mode 100644 tests/Sanity/smoke/PURPOSE create mode 100644 tests/Sanity/smoke/main.fmf create mode 100755 tests/Sanity/smoke/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..ce3cdc1 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,19 @@ +--- !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} +--- !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/README b/tests/README new file mode 100644 index 0000000..9ad59d4 --- /dev/null +++ b/tests/README @@ -0,0 +1,2 @@ +The test's Makefiles are not used in Fedora CI infrastructure. But are kept here +for backward compatibility with traditional beakerlib test harness in RHEL. diff --git a/tests/Regression/identify/Makefile b/tests/Regression/identify/Makefile new file mode 100644 index 0000000..f62f325 --- /dev/null +++ b/tests/Regression/identify/Makefile @@ -0,0 +1,71 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/annobin/Regression/identify +# Description: identify +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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/annobin/Regression/identify +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) + +requires = annobin + +# https://mojo.redhat.com/docs/DOC-1072127 +dtsver = $(shell seq -s, 10 11) +dtsreq = $(shell echo {dev,gcc-}toolset-{$(dtsver)}{,-annocheck}) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: identify" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 48h" >> $(METADATA) + @echo "RunFor: annobin" >> $(METADATA) + $(foreach package, $(requires) $(dtsreq), \ + echo "Requires: $(package)" >> $(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/Regression/identify/PURPOSE b/tests/Regression/identify/PURPOSE new file mode 100644 index 0000000..3471618 --- /dev/null +++ b/tests/Regression/identify/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/annobin/Regression/identify +Description: identify +Author: Martin Cermak diff --git a/tests/Regression/identify/main.fmf b/tests/Regression/identify/main.fmf new file mode 100644 index 0000000..a10e87d --- /dev/null +++ b/tests/Regression/identify/main.fmf @@ -0,0 +1,21 @@ +summary: identify +description: '' +contact: +- Martin Cermak +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- annobin +- devtoolset-10 +- devtoolset-10-annocheck +- devtoolset-11 +- devtoolset-11-annocheck +- gcc-toolset-10 +- gcc-toolset-10-annocheck +- gcc-toolset-11 +- gcc-toolset-11-annocheck +duration: 48h +extra-summary: /tools/annobin/Regression/identify +extra-task: /tools/annobin/Regression/identify diff --git a/tests/Regression/identify/runtest.sh b/tests/Regression/identify/runtest.sh new file mode 100755 index 0000000..d1b3b5f --- /dev/null +++ b/tests/Regression/identify/runtest.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/annobin/Regression/identify +# Description: identify +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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 + +PACKAGE="annobin" + +rlJournalStart + rlPhaseStartTest + rlRun "tool_v=$(annocheck --version | awk '/^annocheck: Version/ {print $3}')" + rlRun "__RPM=$(rpm --queryformat='%{name}\n' -qf $(man -w annobin))" + rlRun "rpm_v=$(rpm -q --queryformat='%{version}\n' $__RPM)" + # Following fails for annobin-8.89-2.el8 + rlRun "[[ "x${tool_v}" == "x${rpm_v}." ]]" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/lto-preprocessor-options/Makefile b/tests/Regression/lto-preprocessor-options/Makefile new file mode 100644 index 0000000..777e9de --- /dev/null +++ b/tests/Regression/lto-preprocessor-options/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/annobin/Regression/lto-preprocessor-options +# Description: lto-preprocessor-options +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 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/annobin/Regression/lto-preprocessor-options +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: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: lto-preprocessor-options" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 48h" >> $(METADATA) + @echo "RunFor: annobin" >> $(METADATA) + @echo "Requires: annobin annobin-annocheck redhat-rpm-config" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1743635" >> $(METADATA) + @echo "Releases: -RHEL4 -RHEL6 -RHEL7 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/lto-preprocessor-options/PURPOSE b/tests/Regression/lto-preprocessor-options/PURPOSE new file mode 100644 index 0000000..c595c5e --- /dev/null +++ b/tests/Regression/lto-preprocessor-options/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/annobin/Regression/lto-preprocessor-options +Description: lto-preprocessor-options +Author: Martin Cermak diff --git a/tests/Regression/lto-preprocessor-options/main.fmf b/tests/Regression/lto-preprocessor-options/main.fmf new file mode 100644 index 0000000..e76679d --- /dev/null +++ b/tests/Regression/lto-preprocessor-options/main.fmf @@ -0,0 +1,15 @@ +summary: lto-preprocessor-options +description: '' +contact: +- Martin Cermak +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- annobin +- annobin-annocheck +- redhat-rpm-config +duration: 48h +extra-summary: /tools/annobin/Regression/lto-preprocessor-options +extra-task: /tools/annobin/Regression/lto-preprocessor-options diff --git a/tests/Regression/lto-preprocessor-options/runtest.sh b/tests/Regression/lto-preprocessor-options/runtest.sh new file mode 100755 index 0000000..315169d --- /dev/null +++ b/tests/Regression/lto-preprocessor-options/runtest.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/annobin/Regression/lto-preprocessor-options +# Description: lto-preprocessor-options +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 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 + +PACKAGE="annobin" + +rlJournalStart + rlPhaseStartTest + b=`mktemp` + rlRun "echo 'int main (void) { return 0; }' | gcc -xc -o $b `rpm --eval "%build_cflags %build_ldflags"` -flto - " + rlRun "annocheck -v $b" + rm $b + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/testsuite/Makefile b/tests/Regression/testsuite/Makefile new file mode 100644 index 0000000..94a9500 --- /dev/null +++ b/tests/Regression/testsuite/Makefile @@ -0,0 +1,78 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/annobin/Regression/testsuite +# Description: testsuite +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 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/annobin/Regression/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) + +requires = annobin binutils-devel gcc-c++ elfutils elfutils-devel make rpm-build \ +rpm-devel gcc-plugin-devel yum yum-utils bzip2-devel + +# https://mojo.redhat.com/docs/DOC-1072127 +dtsver = $(shell seq -s, 9 11) +dtsreq = $(shell echo {dev,gcc-}toolset-{$(dtsver)}-{build,elfutils{,-devel},gcc{,-c++,-plugin-devel},binutils{,-devel},annobin{,-annocheck}}) + + +installdeps: + yum -y install $(requires) + +showdeps: + echo $(requires) + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: testsuite" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 48h" >> $(METADATA) + @echo "RunFor: annobin" >> $(METADATA) + $(foreach package, $(requires) $(dtsreq), \ + echo "Requires: $(package)" >> $(METADATA); \ + ) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/testsuite/PURPOSE b/tests/Regression/testsuite/PURPOSE new file mode 100644 index 0000000..d639443 --- /dev/null +++ b/tests/Regression/testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/annobin/Regression/testsuite +Description: testsuite +Author: Martin Cermak diff --git a/tests/Regression/testsuite/main.fmf b/tests/Regression/testsuite/main.fmf new file mode 100644 index 0000000..78271da --- /dev/null +++ b/tests/Regression/testsuite/main.fmf @@ -0,0 +1,27 @@ +summary: testsuite +description: '' +contact: +- Martin Cermak +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- annobin +- annobin-annocheck +- binutils-devel +- gcc +- gcc-c++ +- elfutils +- elfutils-devel +- make +- rpm-build +- rpm-devel +- gcc-plugin-devel +- yum +- dnf +- yum-utils +- bzip2-devel +duration: 48h +extra-summary: /tools/annobin/Regression/testsuite +extra-task: /tools/annobin/Regression/testsuite diff --git a/tests/Regression/testsuite/runtest.sh b/tests/Regression/testsuite/runtest.sh new file mode 100755 index 0000000..4a92cd9 --- /dev/null +++ b/tests/Regression/testsuite/runtest.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/annobin/Regression/testsuite +# Description: testsuite +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 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 + +PACKAGE="${PACKAGE:-$(rpm -qf --queryformat=%{name} $(man -w annobin))}" +export PACKAGE + +GCC="${GCC:-$(which gcc)}" + + +rlJournalStart + rlPhaseStartSetup + rlLogInfo "PACKAGES=$PACKAGES" + rlLogInfo "REQUIRES=$REQUIRES" + rlLogInfo "COLLECTIONS=$COLLECTIONS" + rlLogInfo "X_SCLS=$X_SCLS" + rlLogInfo "GCC=$GCC" + + # In case more than one devtoolset- or gcc-toolset -build package is + # installed (they can co-exist from the packaging persp, but their + # coexistence causes unexpected results with rpm macros), then we have + # a mess of defined rpm macros coming e.g. from + # /etc/rpm/macros.gcc-toolset-10-config + # /etc/rpm/macros.gcc-toolset-9-config etc. To have just the needed + # macros (respective to given SCL under test) defined without + # uninstalling unneeded RPMs, we'll need an override mechanism. The + # following assumes just one SCL *enabled* (more than one installed), + # and doesn't care of a (useless) revert: + echo ${X_SCLS} | fgrep toolset && \ + rlRun "cat /etc/rpm/*${X_SCLS%\ }* > ~/.rpmmacros" + + rlAssertRpm $PACKAGE + rlRun "TMP=\$(mktemp -d)" + rlRun "pushd $TMP" + + rlFetchSrcForInstalled $PACKAGE + rlRun "yum-builddep -y *src.rpm" + rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm" + rlRun "rpmbuild --define='_topdir $TMP' -bc SPECS/annobin.spec" + rlPhaseEnd + + rlPhaseStartTest + rlRun "pushd BUILD/annobin-*" + set -o pipefail + rlRun "make check |& tee $TMP/check.log" + rlRun -l "grep '^PASS:' $TMP/check.log" 0 + rlRun -l "grep '^FAIL:' $TMP/check.log" 1 + PASSCOUNT=$(grep '^PASS:' $TMP/check.log | wc -l) + rlRun "[[ $PASSCOUNT -ge 7 ]]" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Sanity/smoke/Makefile b/tests/Sanity/smoke/Makefile new file mode 100644 index 0000000..0ed8978 --- /dev/null +++ b/tests/Sanity/smoke/Makefile @@ -0,0 +1,59 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/annobin/Sanity/smoke +# Description: smoke test for annobin plugin +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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/annobin/Sanity/smoke +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: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: smoke test for annobin plugin" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 48h" >> $(METADATA) + @echo "License: GPL" >> $(METADATA) + @echo "RunFor: annobin" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/smoke/PURPOSE b/tests/Sanity/smoke/PURPOSE new file mode 100644 index 0000000..ad364a5 --- /dev/null +++ b/tests/Sanity/smoke/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/annobin/Sanity/smoke +Description: smoke test for annobin plugin +Author: Martin Cermak diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf new file mode 100644 index 0000000..5c30808 --- /dev/null +++ b/tests/Sanity/smoke/main.fmf @@ -0,0 +1,15 @@ +summary: smoke test for annobin plugin +description: '' +contact: +- Martin Cermak +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- man-db +- annobin +- annobin-annocheck +duration: 48h +extra-summary: /tools/annobin/Sanity/smoke +extra-task: /tools/annobin/Sanity/smoke diff --git a/tests/Sanity/smoke/runtest.sh b/tests/Sanity/smoke/runtest.sh new file mode 100755 index 0000000..0f39938 --- /dev/null +++ b/tests/Sanity/smoke/runtest.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/annobin/Sanity/smoke +# Description: smoke test for annobin plugin +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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 + +PACKAGE="annobin" + +rlJournalStart + rlPhaseStartSetup + rlRun "which gcc" + rlRun "man -w annobin" + rlRun "echo $X_SCLS" + rlPhaseEnd + + rlPhaseStartTest + rlRun "echo 'int main() {return 0;}' | gcc -xc -fplugin=annobin -o /dev/null -" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd