Package tests

This commit is contained in:
Petr Písař 2021-03-19 09:00:35 +01:00
parent 50c08b2654
commit d269c753a1
2 changed files with 41 additions and 1 deletions

2
perl-Net-HTTP.rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
from Config import *
addFilter("-tests\.noarch: W: no-documentatio");

View File

@ -18,6 +18,7 @@ BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(:VERSION) >= 5.6.2
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(strict)
@ -32,6 +33,7 @@ BuildRequires: perl(IO::Socket::IP)
BuildRequires: perl(IO::Socket)
%endif
%if %{with perl_Net_HTTP_enables_ssl}
# IO::Socket::SSL or Net::SSL
BuildRequires: perl(IO::Socket::SSL) >= 2.012
%endif
BuildRequires: perl(IO::Uncompress::Gunzip)
@ -66,8 +68,31 @@ Net::HTTP class represents a connection to an HTTP server. The HTTP
protocol is described in RFC 2616. The Net::HTTP class supports HTTP/1.0
and HTTP/1.1.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
%if %{with perl_Net_HTTP_enables_network_test}
%if %{with perl_Net_HTTP_enables_ssl}
Requires: perl(IO::Socket::SSL) >= 2.012
%endif
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Net-HTTP-%{version}
%if %{without perl_Net_HTTP_enables_network_test}
rm t/live*.t
perl -i -ne 'print $_ unless m{^t/live.*\.t}' MANIFEST
%endif
# Help generators to recognize a Perl code
for F in t/*.t; do
perl -i -MConfig -pe 'print qq{$Config{startperl}\n} if $. == 1 && !s{\A#!.*\bperl}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
@ -76,9 +101,18 @@ 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
set -e
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%check
export NO_NETWORK_TESTING=%{without perl_Net_HTTP_enables_network_test}
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
make test
%files
@ -87,9 +121,13 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Fri Mar 19 2021 Petr Pisar <ppisar@redhat.com> - 6.21-1
- 6.21 bump
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.20-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild