Package tests

This commit is contained in:
Petr Písař 2021-02-19 17:59:24 +01:00
parent 90fa411ac2
commit c942f56ec8

View File

@ -57,11 +57,34 @@ Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(experimental)
Requires: perl(XS::Parse::Sublike) >= 0.10
# Filter private modules
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((ARole|BaseClass)\\)
# Filter under-specified dependencies
%global __requires_exclude %{__requires_exclude}|^perl\\(Test::More\\)$
%description
This Perl module provides a simple syntax for creating object classes, which
uses private variables that look like lexical variables for object member
fields.
%package tests
Summary: Tests for %{name}
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(strict)
Requires: perl(Test::More) >= 0.88
%if %{with perl_Object_Pad_enables_optional_test} && !%{defined perl_bootstrap}
Requires: perl(Future)
Requires: perl(Future::AsyncAwait) >= 0.40
Requires: perl(Syntax::Keyword::Dynamically) >= 0.04
Requires: perl(Test::MemoryGrowth)
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Object-Pad-%{version}
%if !%{with perl_Object_Pad_enables_optional_test} || %{defined perl_bootstrap}
@ -71,6 +94,7 @@ for F in t/08extends-Moo.t t/80async-method.t t/80dynamically+Object-Pad.t \
perl -i -ne 'print $_ unless m{^\Q'"$F"'\E\b}' MANIFEST
done
%endif
chmod +x t/*.t
%build
perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS"
@ -79,9 +103,22 @@ perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS"
%install
./Build install --destdir=$RPM_BUILD_ROOT --create_packlist=0
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
# Install tests
mkdir -p %{buildroot}/%{_libexecdir}/%{name}
cp -a t %{buildroot}/%{_libexecdir}/%{name}
%if %{with perl_Object_Pad_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
# Correct permissions
%{_fixperms} $RPM_BUILD_ROOT/*
%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
@ -91,9 +128,13 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{perl_vendorarch}/Object*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Fri Feb 19 2021 Petr Pisar <ppisar@redhat.com> - 0.36-1
- 0.36 bump
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.35-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild