Package tests

This commit is contained in:
Michal Josef Špaček 2023-03-27 12:44:48 +02:00
parent 1a7a09d5be
commit 768c4c1c38
5 changed files with 42 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

@ -7,7 +7,7 @@
Name: perl-IO-Socket-IP
Version: 0.41
Release: 492%{?dist}
Release: 493%{?dist}
Summary: Drop-in replacement for IO::Socket::INET supporting both IPv4 and IPv6
License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/IO-Socket-IP
@ -50,10 +50,24 @@ This module provides a protocol-independent way to use IPv4 and IPv6
sockets, intended as a replacement for IO::Socket::INET. Most constructor
arguments and methods are provided in a backward-compatible way.
%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 IO-Socket-IP-%{version}
cp %{SOURCE1} .
chmod -x lib/IO/Socket/IP.pm
# 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
@ -61,6 +75,15 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%install
%{make_install}
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
rm -f %{buildroot}%{_libexecdir}/%{name}/t/99pod.t*
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
@ -72,7 +95,13 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Mon Mar 27 2023 Michal Josef Špaček <mspacek@redhat.com> - 0.41-493
- Package tests
* Fri Mar 24 2023 Michal Josef Špaček <mspacek@redhat.com> - 0.41-492
- Remove not needed Socket6 package in build

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-IO-Socket-IP
require: perl-IO-Socket-IP-tests
test: /usr/libexec/perl-IO-Socket-IP/test