From 5b80f4c84e06ac6cfdda7bb19ef08c0f68c2f726 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Jul 07 2023 08:46:58 +0000 Subject: Package the tests --- diff --git a/perl-IO-Interactive.rpmlintrc b/perl-IO-Interactive.rpmlintrc new file mode 100644 index 0000000..a5d5f5e --- /dev/null +++ b/perl-IO-Interactive.rpmlintrc @@ -0,0 +1 @@ +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-IO-Interactive.spec b/perl-IO-Interactive.spec index 280134c..d1c6265 100644 --- a/perl-IO-Interactive.spec +++ b/perl-IO-Interactive.spec @@ -41,10 +41,23 @@ BuildRequires: perl(Test::Pod::Coverage) >= 1.04 %endif Requires: perl(Carp) +# Filter underspecified dependencies +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$ + %description This module provides utility subroutines that make it easier to develop interactive applications. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Test::More) >= 1 + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n IO-Interactive-%{version} install -m 0644 %{SOURCE1} . @@ -52,6 +65,7 @@ install -m 0644 %{SOURCE1} . rm t/pod* perl -i -ne 'print $_ unless m{^t/pod}' MANIFEST %endif +chmod +x t/*.t %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -60,6 +74,17 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +%if %{with perl_IO_Interactive_enables_optional_test} +rm %{buildroot}%{_libexecdir}/%{name}/t/pod* +%endif +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}') @@ -72,9 +97,13 @@ make test %{perl_vendorlib}/IO/Interactive.pm %{_mandir}/man3/IO::Interactive.* +%files tests +%{_libexecdir}/%{name} + %changelog * Mon Apr 17 2023 Petr Pisar - 1.023-7 - Convert a licene tag to an SPDX format +- Package the tests * Fri Jul 22 2022 Fedora Release Engineering - 1.023-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild