Package tests

This commit is contained in:
Michal Josef Špaček 2023-03-17 13:46:07 +01:00
parent c354a795d5
commit f504c079d2
5 changed files with 44 additions and 1 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

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

View File

@ -63,23 +63,50 @@ Requires: perl(IO::Multiplex) >= 1.05
# RHBZ#1395714: Optional dependency, including it so that the build matches runtime
Requires: perl(IO::Socket::IP)
# Remove private test modules
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(NetServerTest\\)$
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(NetServerTest\\)$
%description
An extensible, class oriented module written in perl and intended to
be the back end layer of internet protocol servers.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Net-Server-%{version}
# Do not want to pull in any packaging deps here.
chmod -c 644 examples/*
# Help generators to recognize Perl scripts
for F in $(find t/ -name '*.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 NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
%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
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" -r
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%check
make test
@ -92,8 +119,12 @@ make test
%{_bindir}/net-server
%{_mandir}/man1/net-server.1*
%files tests
%{_libexecdir}/%{name}
%changelog
* Fri Mar 17 2023 Michal Josef Špaček <mspacek@redhat.com> - 2.014-2
- Package tests
- Update license to SPDX format
* Fri Mar 17 2023 Michal Josef Špaček <mspacek@redhat.com> - 2.014-1

5
plans/sanity.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

4
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,4 @@
summary: Upstream tests
component: perl-Net-Server
require: perl-Net-Server-tests
test: /usr/libexec/perl-Net-Server/test