Package the tests

This commit is contained in:
Petr Písař 2021-05-03 11:35:29 +02:00
parent 37830db254
commit 179840c1fe
2 changed files with 40 additions and 1 deletions

View File

@ -1,2 +1,3 @@
from Config import *
addFilter("spelling-error .* accessors");
addFilter("spelling-error .* accessors")
addFilter("-tests\.noarch: W: no-documentation")

View File

@ -48,6 +48,9 @@ Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# specified by boot_xs_parse_keyword() argument in Dynamically.xs
Requires: perl(XS::Parse::Keyword)
# Remove under-specified dependencies
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$
%description
This Perl module provides a syntax plugin that implements a single keyword,
dynamically, which alters the behavior of a scalar assignment operation.
@ -56,6 +59,24 @@ local, but is implemented somewhat differently to give two key advantages over
regular local: You can dynamically assign to left-value functions and
accessors, and you can dynamically assign to regular lexical variables.
%package tests
Summary: Tests for %{name}
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(Test::More) >= 0.88
%if %{with perl_Syntax_Keyword_Dynamically_enables_optional_test} && !%{defined perl_bootstrap}
# A cycle: perl-Future-AsyncAwait → perl-Syntax-Keyword-Dynamically
Requires: perl(Future)
Requires: perl(Future::AsyncAwait) >= 0.31
Requires: perl(Object::Pad) >= 0.15
Requires: perl(Sentinel)
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Syntax-Keyword-Dynamically-%{version}
%if !%{with perl_Syntax_Keyword_Dynamically_enables_optional_test} || %{defined perl_bootstrap}
@ -66,6 +87,7 @@ do
perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST
done
%endif
chmod +x t/*.t
%build
perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS"
@ -75,8 +97,20 @@ perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS"
./Build install --destdir=$RPM_BUILD_ROOT --create_packlist=0
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{_fixperms} $RPM_BUILD_ROOT/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
%if %{with perl_Syntax_Keyword_Dynamically_enables_optional_test} && !%{defined perl_bootstrap}
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
@ -86,9 +120,13 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{perl_vendorarch}/Syntax*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Mon May 03 2021 Petr Pisar <ppisar@redhat.com> - 0.08-1
- 0.08 bump
- Package the tests
* Wed Feb 03 2021 Petr Pisar <ppisar@redhat.com> - 0.07-1
- 2.07 bump