From 6ef8178d2a4e1e519168a9ef3f80919f5e105521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= Date: Tue, 3 Aug 2021 13:59:10 +0200 Subject: [PATCH] Package tests --- .fmf/version | 1 + gating.yaml | 7 +++++++ perl-Algorithm-C3.rpmlintrc | 1 + perl-Algorithm-C3.spec | 34 +++++++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 6 files changed, 51 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..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/perl-Algorithm-C3.rpmlintrc b/perl-Algorithm-C3.rpmlintrc index b0a5556..ed518fc 100644 --- a/perl-Algorithm-C3.rpmlintrc +++ b/perl-Algorithm-C3.rpmlintrc @@ -1,2 +1,3 @@ from Config import * addFilter("spelling-error %description -l en_US metamodels -> ") +addFilter("-tests\.noarch: W: no-documentation"); diff --git a/perl-Algorithm-C3.spec b/perl-Algorithm-C3.spec index 4ea0127..36a9e11 100644 --- a/perl-Algorithm-C3.spec +++ b/perl-Algorithm-C3.spec @@ -1,6 +1,6 @@ Name: perl-Algorithm-C3 Version: 0.11 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Module for merging hierarchies using the C3 algorithm License: GPL+ or Artistic URL: https://metacpan.org/release/Algorithm-C3 @@ -22,14 +22,32 @@ BuildRequires: perl(Test::More) >= 0.47 # Runtime Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Remove under-specified dependencies +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Test::More)\\)$ + %description This module implements the C3 algorithm. Most of the uses I have for C3 revolve around class building and metamodels but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precedence orderings. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Test::More) >= 0.47 + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Algorithm-C3-%{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 @@ -39,6 +57,14 @@ 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/sh +cd %{_libexecdir}/%{name} && exec prove -r -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -49,7 +75,13 @@ make test %{perl_vendorlib}/Algorithm/ %{_mandir}/man3/Algorithm::C3.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Tue Aug 03 2021 Michal Josef Špaček - 0.11-5 +- Package tests + * Thu Jul 22 2021 Fedora Release Engineering - 0.11-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_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..6721f57 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Algorithm-C3 +require: perl-Algorithm-C3 +test: /usr/libexec/perl-Algorithm-C3/test