From 36cd4b33ed951c8d4bf066a173eaf106bc5578ad Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 9 Mar 2021 13:23:43 +0100 Subject: [PATCH] Package tests --- perl-Crypt-OpenSSL-Guess.spec | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/perl-Crypt-OpenSSL-Guess.spec b/perl-Crypt-OpenSSL-Guess.spec index 9d07af1..727cb10 100644 --- a/perl-Crypt-OpenSSL-Guess.spec +++ b/perl-Crypt-OpenSSL-Guess.spec @@ -1,6 +1,6 @@ Name: perl-Crypt-OpenSSL-Guess Version: 0.12 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Guess OpenSSL include path License: GPL+ or Artistic URL: https://metacpan.org/release/Crypt-OpenSSL-Guess/ @@ -33,18 +33,42 @@ Recommends: openssl Crypt::OpenSSL::Guess provides helpers to guess OpenSSL include path on any platforms. +%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 Crypt-OpenSSL-Guess-%{version} +# Help file to recognise the Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} %install %{make_install} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +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 %{_fixperms} $RPM_BUILD_ROOT/* %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 @@ -53,10 +77,15 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Tue Mar 09 2021 Jitka Plesnikova - 0.12-2 +- Package tests + * Mon Mar 08 2021 Jitka Plesnikova - 0.12-1 - 0.12 bump -- Package tests * Wed Jan 27 2021 Fedora Release Engineering - 0.11-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild