From a3455b0e46a62b8e0e9010ebe77d6e161ef2445a Mon Sep 17 00:00:00 2001 From: Michal Josef Špaček Date: Apr 26 2021 12:04:20 +0000 Subject: [PATCH 1/2] Package tests --- diff --git a/perl-List-AllUtils.rpmlintrc b/perl-List-AllUtils.rpmlintrc index 380388c..e9e30c2 100644 --- a/perl-List-AllUtils.rpmlintrc +++ b/perl-List-AllUtils.rpmlintrc @@ -1,2 +1,3 @@ from Config import * addFilter("spelling-error .* (SomeUtils|Util)"); +addFilter("-tests\.noarch: W: no-documentation"); diff --git a/perl-List-AllUtils.spec b/perl-List-AllUtils.spec index 9449dac..d301d20 100644 --- a/perl-List-AllUtils.spec +++ b/perl-List-AllUtils.spec @@ -1,6 +1,6 @@ Name: perl-List-AllUtils Version: 0.19 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Combines List::Util and List::SomeUtils # CODE_OF_CONDUCT.md: CC-BY # lib/List/AllUtils.pm: Artistic 2.0 @@ -12,6 +12,7 @@ BuildRequires: coreutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(strict) BuildRequires: perl(warnings) @@ -29,14 +30,42 @@ BuildRequires: perl(Sub::Util) BuildRequires: perl(Test::More) >= 0.96 Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Remove under-specified dependencies +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(List::Util\\) >= 1\.56$ +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((Sub::Util|Test::More)\\)$ + %description Are you sick of trying to remember whether a particular helper is defined in List::Util or List::SomeUtils? I sure am. Now you don't have to remember. This module will export all of the functions that either of those two modules defines. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(List::Util) >= 1.56 +Requires: perl(Sub::Util) +Requires: perl(Test::More) >= 0.96 + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n List-AllUtils-%{version} +for F in \ + t/00-report-prereqs.dd \ + t/00-report-prereqs.t \ + ; do + rm "$F" + perl -i -ne 'print $_ unless m{\A\Q'"$F"'\E}' MANIFEST +done +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F" + chmod +x "$F" +done %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -44,7 +73,15 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} -%{_fixperms} $RPM_BUILD_ROOT/* +%{_fixperms} %{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 . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -55,7 +92,13 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Apr 26 2021 Michal Josef Špaček - 0.19-2 +- Package tests + * Mon Apr 26 2021 Michal Josef Špaček - 0.19-1 - 0.19 bump From 1c5d0cfa444609b53b60311ed4d8ea3517dc03f7 Mon Sep 17 00:00:00 2001 From: Michal Josef Špaček Date: Apr 26 2021 12:07:54 +0000 Subject: [PATCH 2/2] Add FMF tests and 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..282e16b --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !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} 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..9ae6117 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-List-AllUtils +require: perl-List-AllUtils-tests +test: /usr/libexec/perl-List-AllUtils/test