From 7dc753fbfa893f288f8a470ec525d2610793de97 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 23 Jul 2024 12:39:25 +0200 Subject: [PATCH] Add tests and gating.yaml --- .fmf/version | 1 + gating.yaml | 7 ++++++ perl-Data-Section.spec | 50 ++++++++++++++++++++++++++++++++++------ plans/sanity.fmf | 5 ++++ tests/upstream-tests.fmf | 12 ++++++++++ 5 files changed, 68 insertions(+), 7 deletions(-) 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..1608530 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +# RHEL +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/perl-Data-Section.spec b/perl-Data-Section.spec index f4ab12b..5a5458b 100644 --- a/perl-Data-Section.spec +++ b/perl-Data-Section.spec @@ -10,7 +10,7 @@ Name: perl-Data-Section Version: 0.200008 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Read multiple hunks of data out of your DATA section License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Data-Section @@ -22,7 +22,8 @@ BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter -BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl(Config) +BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 # Runtime BuildRequires: perl(Encode) BuildRequires: perl(MRO::Compat) >= 0.09 @@ -45,22 +46,51 @@ BuildRequires: perl(Test::Pod) >= 1.41 %endif # Dependencies +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(I::.*\\) +%global __requires_exclude %{__requires_exclude}|^perl\\((Child|End|Godfather|Grandchild)\\) +%global __requires_exclude %{__requires_exclude}|^perl\\((Header|Latin1|Mother|Relaxed|No.*)\\) +%global __requires_exclude %{__requires_exclude}|^perl\\((Unicode_.*pragma|WindowsNewlines)\\) + %description Data::Section provides an easy way to access multiple named chunks of line-oriented data in your module's DATA section. It was written to allow modules to store their own templates, but probably has other uses. +%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 Data-Section-%{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 %build -perl Makefile.PL INSTALLDIRS=vendor -make %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} %install -make pure_install DESTDIR=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name .packlist -delete -%{_fixperms} -c $RPM_BUILD_ROOT +%{make_install} +%{_fixperms} -c %{buildroot} + +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && exec prove -I . -r -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -74,7 +104,13 @@ make test TEST_FILES="$(echo $(find xt/ -name '*.t'))" %{perl_vendorlib}/Data/ %{_mandir}/man3/Data::Section.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Tue Jul 23 2024 Jitka Plesnikova - 0.200008-7 +- Package tests + * Mon Jun 24 2024 Troy Dawson - 0.200008-6 - 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..56fbf9a --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,12 @@ +summary: Upstream tests +contact: Jitka Plesnikova +component: perl-Data-Section +require: perl-Data-Section-tests +test: /usr/libexec/perl-Data-Section/test +enabled: true +tag: + - rhel-buildroot +adjust: + - enabled: false + when: distro < rhel-10 or distro < centos-stream-10 + continue: false