From 9c662818d202174569b2101d84060d6db37deaf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 17 Jan 2022 15:03:40 +0100 Subject: [PATCH] Package the tests --- Filesys-Df-0.92-Fix-test-plan.patch | 44 +++++++++++++++++++++++++++++ perl-Filesys-Df.rpmlintrc | 4 +-- perl-Filesys-Df.spec | 31 ++++++++++++++++++-- 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 Filesys-Df-0.92-Fix-test-plan.patch diff --git a/Filesys-Df-0.92-Fix-test-plan.patch b/Filesys-Df-0.92-Fix-test-plan.patch new file mode 100644 index 0000000..7cc4182 --- /dev/null +++ b/Filesys-Df-0.92-Fix-test-plan.patch @@ -0,0 +1,44 @@ +From 1617b20950624b199d3aaceff7e1f2967e558950 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 17 Jan 2022 14:57:40 +0100 +Subject: [PATCH] Fix test plan +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The test plan was wrong: + +$ prove test.pl +test.pl .. All 2 subtests passed + +Test Summary Report +------------------- +test.pl (Wstat: 0 Tests: 3 Failed: 1) + Failed test: 3 + Parse errors: Bad plan. You planned 2 tests but ran 3. +Files=1, Tests=3, 0 wallclock secs ( 0.01 usr + 0.02 sys = 0.03 CPU) +Result: FAIL + +This patch updates it to include the third test. + +Signed-off-by: Petr Písař +--- + test.pl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test.pl b/test.pl +index c25b2cb..94f776c 100644 +--- a/test.pl ++++ b/test.pl +@@ -6,7 +6,7 @@ + # Change 1..1 below to 1..last_test_to_print . + # (It may become useful if the test is moved to ./t subdirectory.) + +-BEGIN { $| = 1; print "1..2\n"; } ++BEGIN { $| = 1; print "1..3\n"; } + END {print "not ok 1\n" unless $loaded;} + require 5.006; + use Config qw(%Config); +-- +2.34.1 + diff --git a/perl-Filesys-Df.rpmlintrc b/perl-Filesys-Df.rpmlintrc index 717433c..d750216 100644 --- a/perl-Filesys-Df.rpmlintrc +++ b/perl-Filesys-Df.rpmlintrc @@ -1,2 +1,2 @@ -from Config import * -addFilter("spelling-error .* DfPortable"); +addFilter('spelling-error .* DfPortable') +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-Filesys-Df.spec b/perl-Filesys-Df.spec index 2463837..2cd8a6c 100644 --- a/perl-Filesys-Df.spec +++ b/perl-Filesys-Df.spec @@ -1,10 +1,13 @@ Name: perl-Filesys-Df Version: 0.92 -Release: 42%{?dist} +Release: 43%{?dist} Summary: Perl extension for filesystem disk space information License: GPL+ or Artistic URL: https://metacpan.org/release/Filesys-Df Source0: https://cpan.metacpan.org/modules/by-module/Filesys/Filesys-Df-%{version}.tar.gz +# Fix a test plan, CPAN RT#140742, proposed to the upstream +Patch0: Filesys-Df-0.92-Fix-test-plan.patch +BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc BuildRequires: make @@ -29,8 +32,18 @@ for Unix and Windows, use Filesys::DfPortable. The only major benefit of using Filesys::Df over Filesys::DfPortable, is that Filesys::Df supports the use of open file handles as arguments. +%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 -%setup -q -n Filesys-Df-%{version} +%autosetup -p1 -n Filesys-Df-%{version} #readme is with dos EOL, convert it to unix perl -i -pe 's/\r//' README @@ -42,6 +55,14 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_install} find %{buildroot} -type f -name '*.bs' -empty -delete %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a test.pl %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && exec prove -I . test.pl +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -51,7 +72,13 @@ make test %{perl_vendorarch}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Jan 17 2022 Petr Pisar - 0.92-43 +- Package the tests + * Thu Jul 22 2021 Fedora Release Engineering - 0.92-42 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild