diff --git a/perl-Future-AsyncAwait.rpmlintrc b/perl-Future-AsyncAwait.rpmlintrc index 2adaa88..1eb1d5c 100644 --- a/perl-Future-AsyncAwait.rpmlintrc +++ b/perl-Future-AsyncAwait.rpmlintrc @@ -1,2 +1,3 @@ from Config import * addFilter("spelling-error .* (Awaitable|subtests)"); +addFilter("-tests.noarch: W: no-documentation"); diff --git a/perl-Future-AsyncAwait.spec b/perl-Future-AsyncAwait.spec index 89edcab..899fc90 100644 --- a/perl-Future-AsyncAwait.spec +++ b/perl-Future-AsyncAwait.spec @@ -68,7 +68,7 @@ Recommends: perl(Role::Tiny) %endif # Remove under-specified dependencies -%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Future|Test::More)\\)$ +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Future|Syntax::Keyword::Try|Test::More)\\)$ %description This Perl module provides syntax for deferring and resuming subroutines while @@ -89,6 +89,34 @@ Future::AsyncAwait::Awaitable role. It runs tests that simulate various ways in which Future::AsyncAwait will try to use an instance of this class, to check that the implementation is valid. +%package tests +Summary: Tests for %{name} +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: %{name}-Test = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Future) >= 0.43 +%if %{with perl_Future_AsyncAwait_enables_role} +Requires: perl(Role::Tiny) +Requires: perl(Role::Tiny::With) +%endif +Requires: perl(Test::More) >= 0.88 +%if %{with perl_Future_AsyncAwait_enables_optional_test} +%if %{with perl_Future_AsyncAwait_enables_Devel_MAT} +Requires: perl(Devel::MAT) +Requires: perl(Devel::MAT::Dumper) +%endif +Requires: perl(IO::Async::Loop) +Requires: perl(Object::Pad) >= 0.15 +Requires: perl(Syntax::Keyword::Dynamically) >= 0.04 +Requires: perl(Syntax::Keyword::Try) >= 0.18 +Requires: perl(Test::Pod) >= 1.00 +%endif + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Future-AsyncAwait-%{version} for F in \ @@ -97,7 +125,7 @@ for F in \ %endif %if !%{with perl_Future_AsyncAwait_enables_optional_test} t/80await+dynamically.t t/80await+try.t t/81async-method+dynamically.t \ - t/81memory-growth.t \ + t/81memory-growth.t t/99pod.t \ %endif %if !%{with perl_Future_AsyncAwait_enables_role} t/51awaitable-role.t \ @@ -106,6 +134,7 @@ for F in \ rm "$F" perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST done +chmod +x t/*.t %build perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS" @@ -118,8 +147,20 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete # Move Test subpackage content to a noarch location install -m 0755 -d ${RPM_BUILD_ROOT}%{perl_vendorlib} mv ${RPM_BUILD_ROOT}%{perl_vendorarch}/Test ${RPM_BUILD_ROOT}%{perl_vendorlib} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +%if %{with perl_Future_AsyncAwait_enables_optional_test} +rm %{buildroot}%{_libexecdir}/%{name}/t/99pod.t +%endif +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 +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') ./Build test %files @@ -135,9 +176,13 @@ mv ${RPM_BUILD_ROOT}%{perl_vendorarch}/Test ${RPM_BUILD_ROOT}%{perl_vendorlib} %{perl_vendorlib}/Test %{_mandir}/man3/Test::* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu Feb 25 2021 Petr Pisar - 0.49-1 - 0.49 bump +- Package tests * Wed Feb 03 2021 Petr Pisar - 0.48-1 - 0.48 bump