Package the tests

epel9
Petr Písař 3 years ago
parent 4378da5281
commit d4f0b4caec

@ -1,3 +1,6 @@
# Perform optional tests
%bcond_without perl_Crypt_URandom_enables_optional_test
Name: perl-Crypt-URandom
Version: 0.36
Release: 21%{?dist}
@ -23,8 +26,11 @@ BuildRequires: perl(FileHandle)
# Win32::API::Type not used
# Tests:
BuildRequires: perl(Test::More)
%if %{with perl_Crypt_URandom_enables_optional_test}
# Optional tests:
BuildRequires: perl(Encode)
BuildRequires: perl(Test::Pod) >= 1.14
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(FileHandle)
@ -32,8 +38,24 @@ Requires: perl(FileHandle)
This Module is intended to provide an interface to the strongest available
source of non-blocking randomness on the current platform.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
%if %{with perl_Crypt_URandom_enables_optional_test}
Requires: perl(Encode)
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Crypt-URandom-%{version}
%if !%{with perl_Crypt_URandom_enables_optional_test}
rm t/pod.t
perl -i -ne 'print $_ unless m{^t/pod.t}' MANIFEST
%endif
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
@ -41,9 +63,21 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%install
%{make_install}
%{_fixperms} $RPM_BUILD_ROOT/*
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
%if %{with perl_Crypt_URandom_enables_optional_test}
rm %{buildroot}%{_libexecdir}/%{name}/t/pod.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}')
make test
%files
@ -51,9 +85,13 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Fri Dec 17 2021 Petr Pisar <ppisar@redhat.com> - 0.36-21
- Modernize a spec file
- Package the tests
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.36-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

Loading…
Cancel
Save