Package the tests

This commit is contained in:
Petr Písař 2023-06-12 13:45:19 +02:00
parent fb69d591cf
commit 06e816aa29
2 changed files with 28 additions and 0 deletions

1
perl-FCGI.rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter('-tests\.noarch: W: no-documentation')

View File

@ -74,6 +74,16 @@ Provides: bundled(fcgi)
%description
%{summary}.
%package tests
Summary: Tests for %{name}
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%autosetup -p1 -n FCGI-%{version}
find . -type f -exec chmod -c -x {} +
@ -81,6 +91,11 @@ find . -type f -exec chmod -c -x {} +
rm -f t/02-unix_domain_socket.t
perl -i -ne 'print $_ unless m{^t/02-unix_domain_socket\.t}' MANIFEST
%endif
# Help generators to recognize Perl scripts
for F in t/*.t; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 \
@ -90,6 +105,14 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 \
%install
%make_install
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
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}')
@ -102,10 +125,14 @@ make test
%{perl_vendorarch}/FCGI.pm
%{_mandir}/man3/FCGI.3*
%files tests
%{_libexecdir}/%{name}
%changelog
* Mon Jun 12 2023 Petr Pisar <ppisar@redhat.com> - 1:0.82-6
- Specify all dependencies
- Package examples
- Package the tests
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.82-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild