From 6b583bbe0e6515e93842940d7b8b52d13adcd671 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 24 Jul 2024 14:31:17 +0200 Subject: [PATCH] Add tests and gating.yaml --- .fmf/version | 1 + gating.yaml | 11 +++++++++++ perl-IPC-System-Simple.spec | 36 +++++++++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 5 +++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/sanity.fmf create mode 100644 tests/upstream-tests.fmf 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..5ba5a72 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,11 @@ +# Fedora +--- !Policy +id: fedora_policy +product_versions: + - fedora-* +decision_contexts: + - bodhi_update_push_testing + - bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/perl-IPC-System-Simple.spec b/perl-IPC-System-Simple.spec index d5de63f..0582fd6 100644 --- a/perl-IPC-System-Simple.spec +++ b/perl-IPC-System-Simple.spec @@ -7,7 +7,7 @@ Name: perl-IPC-System-Simple Version: 1.30 -Release: 14%{?dist} +Release: 15%{?dist} License: GPL-1.0-or-later OR Artistic-1.0-Perl Summary: Run commands simply, with detailed diagnostics URL: https://metacpan.org/release/IPC-System-Simple @@ -56,8 +56,22 @@ want to be really lazy, you can just write: and all of your "system" commands will either succeed (run to completion and return a zero exit value), or die with rich diagnostic messages. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n IPC-System-Simple-%{version} +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done # Avoid doc-file dependencies chmod -c -x examples/*.pl @@ -70,6 +84,20 @@ make %{?_smp_mflags} make pure_install DESTDIR=%{buildroot} find %{buildroot} -type f -name .packlist -delete %{_fixperms} -c %{buildroot} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -80,7 +108,13 @@ make test %{perl_vendorlib}/IPC/ %{_mandir}/man3/IPC::System::Simple.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Wed Jul 24 2024 Jitka Plesnikova - 1.30-15 +- Package tests + * Mon Jun 24 2024 Troy Dawson - 1.30-14 - Bump release for June 2024 mass rebuild diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..bcaa502 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,5 @@ +summary: Upstream tests +contact: Jitka Plesnikova +component: perl-IPC-System-Simple +require: perl-IPC-System-Simple-tests +test: /usr/libexec/perl-IPC-System-Simple/test