From 6047bb48f8c3b7d83f09fdd99a91cc2296a45a7f Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 20 Dec 2022 17:28:37 +0100 Subject: [PATCH] Package tests --- ...-building-on-Perl-without-dot-in-INC.patch | 8 ----- perl-DBICx-TestDatabase.spec | 35 +++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) delete mode 100644 DBICx-TestDatabase-0.05-Fix-building-on-Perl-without-dot-in-INC.patch diff --git a/DBICx-TestDatabase-0.05-Fix-building-on-Perl-without-dot-in-INC.patch b/DBICx-TestDatabase-0.05-Fix-building-on-Perl-without-dot-in-INC.patch deleted file mode 100644 index 10e0a28..0000000 --- a/DBICx-TestDatabase-0.05-Fix-building-on-Perl-without-dot-in-INC.patch +++ /dev/null @@ -1,8 +0,0 @@ -diff -up DBICx-TestDatabase-0.05/Makefile.PL.orig DBICx-TestDatabase-0.05/Makefile.PL ---- DBICx-TestDatabase-0.05/Makefile.PL.orig 2017-05-26 13:28:09.152226934 +0200 -+++ DBICx-TestDatabase-0.05/Makefile.PL 2017-05-26 13:29:02.488834875 +0200 -@@ -1,3 +1,4 @@ -+BEGIN { push @INC, '.'; } - use inc::Module::Install; - - name 'DBICx-TestDatabase'; diff --git a/perl-DBICx-TestDatabase.spec b/perl-DBICx-TestDatabase.spec index 46c13dd..e451d0d 100644 --- a/perl-DBICx-TestDatabase.spec +++ b/perl-DBICx-TestDatabase.spec @@ -11,6 +11,7 @@ BuildRequires: coreutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(inc::Module::Install) BuildRequires: perl(Module::Install::Metadata) BuildRequires: perl(Module::Install::WriteAll) @@ -35,6 +36,11 @@ Requires: perl(SQL::Translator) %{?perl_default_filter} +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(MySchema.*\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(TestDatabase\\) + %description This module creates a temporary SQLite database, deploys your DBIC schema, and then connects to it. This lets you easily test your DBIC @@ -42,6 +48,14 @@ schema. Since you have a fresh database for every test, you don't have to worry about cleaning up after your tests, ordering of tests affecting failure, etc. +%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 DBICx-TestDatabase-%{version} @@ -50,6 +64,12 @@ rm -r inc perl -i -ne 'print $_ unless m{^inc/}' MANIFEST find -type f -exec chmod -x {} + +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -58,7 +78,18 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +rm -rf %{buildroot}%{_libexecdir}/%{name}/t/author +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}') make test %files @@ -66,10 +97,14 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} + %changelog * Tue Dec 20 2022 Jitka Plesnikova - 0.05-25 - Update license to SPDX format - Use macros %%make_* +- Package tests * Fri Jul 22 2022 Fedora Release Engineering - 0.05-24 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild