From 052ea012a3907683e39729793d8c502559203c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= Date: Mon, 12 Dec 2022 09:49:23 +0100 Subject: [PATCH] Package tests --- .fmf/version | 1 + gating.yaml | 7 +++++++ perl-Object-HashBase.rpmlintrc | 1 + perl-Object-HashBase.spec | 29 ++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 6 files changed, 46 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-Object-HashBase.rpmlintrc b/perl-Object-HashBase.rpmlintrc index 566a4a4..a109cdd 100644 --- a/perl-Object-HashBase.rpmlintrc +++ b/perl-Object-HashBase.rpmlintrc @@ -1,2 +1,3 @@ from Config import * addFilter("spelling-error .* (accessor|getters|inlined)"); +addFilter("-tests\.noarch: W: no-documentation"); diff --git a/perl-Object-HashBase.spec b/perl-Object-HashBase.spec index 70929b1..a84a28c 100644 --- a/perl-Object-HashBase.spec +++ b/perl-Object-HashBase.spec @@ -28,6 +28,7 @@ Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) %global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$ # Remove private modules %global __requires_exclude %{__requires_exclude}|^perl\\(Object::HashBase::Test::HBase.* +%global __requires_exclude %{__requires_exclude}|^perl\\(My::Prefix::HashBase\\)$ %description This package is used to generate classes based on hash references. Using this @@ -37,6 +38,15 @@ be generated for you. You also get constants for each accessor (all caps) which return the key into the hash for that accessor. Single inheritance is also supported. +%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". + %package tools Summary: Generate inlined Object::HashBase Perl module Requires: %{name} = %{version}-%{release} @@ -51,6 +61,11 @@ also generate the tests for it. %prep %setup -q -n Object-HashBase-%{version} %patch0 -p1 +# 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 @@ -58,7 +73,15 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} -%{_fixperms} $RPM_BUILD_ROOT/* +# 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 +%{_fixperms} %{buildroot}/* %check make test @@ -71,6 +94,9 @@ make test %{_mandir}/man3/* %exclude %{_mandir}/man3/Object::HashBase::* +%files tests +%{_libexecdir}/%{name} + %files tools %{_bindir}/hashbase_inc.pl %{perl_vendorlib}/Object/HashBase @@ -78,6 +104,7 @@ make test %changelog * Mon Dec 12 2022 Michal Josef Špaček - 0.009-11 +- Package tests - Update license to SPDX format * Fri Jul 22 2022 Fedora Release Engineering - 0.009-10 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..9668544 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Object-HashBase +require: perl-Object-HashBase-tests +test: /usr/libexec/perl-Object-HashBase/test