From 55888d7121541b5657fe74a78eeb8a22c14fe968 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 18 May 2023 20:00:47 +0200 Subject: [PATCH] Package tests --- perl-threads-shared.spec | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/perl-threads-shared.spec b/perl-threads-shared.spec index 916d06c..ccae55b 100644 --- a/perl-threads-shared.spec +++ b/perl-threads-shared.spec @@ -58,6 +58,17 @@ thread gets a private copy of each existing variable. This module allows you to share variables across different threads (and pseudo-forks on Win32). It is used together with the threads module. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(POSIX) +Requires: perl(Time::HiRes) + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n threads-shared-%{base_version} %patch -P0 -p1 @@ -67,16 +78,32 @@ Win32). It is used together with the threads module. %patch -P4 -p1 %patch -P5 -p1 +# Help generators to recognize Perl scripts +for F in t/*.t t/*pl; 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 OPTIMIZE="$RPM_OPT_FLAGS" +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="%{optflags}" %{make_build} %install %{make_install} -find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete -%{_fixperms} $RPM_BUILD_ROOT/* +find %{buildroot} -type f -name '*.bs' -size 0 -delete +%{_fixperms} %{buildroot}/* + +# 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 %check +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') unset GIT_DIR PERL_BUILD_PACKAGING PERL_CORE PERL_RUNPERL_DEBUG \ RUN_MAINTAINER_TESTS make test @@ -87,9 +114,13 @@ make test %{perl_vendorarch}/threads* %{_mandir}/man3/threads::shared* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu May 18 2023 Jitka Plesnikova - 1.68-1 - Upgrade to 1.68 as provided in perl-5.37.11 +- Package tests * Fri Jan 20 2023 Fedora Release Engineering - 1.64-490 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild