From cbd466f09b0d67418689a0dcad187eada9baecfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 30 Aug 2019 10:56:17 +0200 Subject: [PATCH] Package tests --- perl-Locale-Codes.spec | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/perl-Locale-Codes.spec b/perl-Locale-Codes.spec index 4d8f210..500dd32 100644 --- a/perl-Locale-Codes.spec +++ b/perl-Locale-Codes.spec @@ -22,30 +22,41 @@ BuildRequires: perl(Exporter) BuildRequires: perl(if) BuildRequires: perl(utf8) # Tests: -# Cwd not used -# File::Basename not used -# File::Find::Rule not used -# IO::File not used -# lib not used +# Release tests are deleted BuildRequires: perl(Test::Inter) >= 1.09 -BuildRequires: perl(Test::More) -# Test::Pod 1.00 not used -# Test::Pod::Coverage 1.00 not used Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) # deprecate not used on perl < 5.27.7 # Filter dependencies on private modules, they are not provided. Generator: # for F in $(find lib -type f); do perl -e '$/ = undef; $_ = <>; if (/^package #\R([\w:]*);/m) { print qq{|^perl\\\\($1\\\\)} }' "$F"; done %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Locale::Codes::Country_Retired\\)|^perl\\(Locale::Codes::LangFam_Retired\\)|^perl\\(Locale::Codes::Script_Retired\\)|^perl\\(Locale::Codes::LangExt_Codes\\)|^perl\\(Locale::Codes::LangFam_Codes\\)|^perl\\(Locale::Codes::Script_Codes\\)|^perl\\(Locale::Codes::Language_Codes\\)|^perl\\(Locale::Codes::LangExt_Retired\\)|^perl\\(Locale::Codes::Currency_Codes\\)|^perl\\(Locale::Codes::LangVar_Retired\\)|^perl\\(Locale::Codes::Language_Retired\\)|^perl\\(Locale::Codes::Country_Codes\\)|^perl\\(Locale::Codes::LangVar_Codes\\)|^perl\\(Locale::Codes::Currency_Retired\\) +# Filter dependencies on test subscripts +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(do_tests\\.pl\\) %description Locale-Codes is a distribution containing a set of modules. The modules each deal with different types of codes which identify parts of the locale including languages, countries, currency, etc. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}-%{version}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Locale-Codes-%{version} chmod -x examples/* +chmod +x t/*.pl +# Delete release tests +rm t/_* +perl -i -lne 'print $_ unless m{\At/_}' MANIFEST +# Delete unused files +rm t/runtests t/runtests.bat +perl -i -lne 'print $_ unless m{\At/runtests}' MANIFEST %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -53,6 +64,13 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} +mkdir -p %{buildroot}/%{_libexecdir}/%{name} +cp -a t %{buildroot}/%{_libexecdir}/%{name} +cat > %{buildroot}/%{_libexecdir}/%{name}/test << 'EOF' +#!/usr/bin/sh +cd %{_libexecdir}/%{name} && exec prove -j $(getconf _NPROCESSORS_ONLN) +EOF +chmod +x %{buildroot}/%{_libexecdir}/%{name}/test %{_fixperms} %{buildroot}/* %check @@ -65,9 +83,13 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Fri Aug 30 2019 Petr Pisar - 3.62-1 - 3.62 bump +- Package tests * Fri Jul 26 2019 Fedora Release Engineering - 3.61-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild