diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/perl-IO-Socket-IP.rpmlintrc b/perl-IO-Socket-IP.rpmlintrc new file mode 100644 index 0000000..3c67f8c --- /dev/null +++ b/perl-IO-Socket-IP.rpmlintrc @@ -0,0 +1,2 @@ +from Config import * +addFilter("-tests.noarch: W: no-documentation"); diff --git a/perl-IO-Socket-IP.spec b/perl-IO-Socket-IP.spec index 26e6465..57ff4e7 100644 --- a/perl-IO-Socket-IP.spec +++ b/perl-IO-Socket-IP.spec @@ -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 - 0.41-493 +- Package tests + * Fri Mar 24 2023 Michal Josef Špaček - 0.41-492 - Remove not needed Socket6 package in build diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..19b44bc --- /dev/null +++ b/tests/upstream-tests.fmf @@ -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