Package tests

epel9
Petr Písař 4 years ago
parent dbc7dd16fd
commit 2ffb0cd237

@ -0,0 +1,2 @@
from Config import *
addFilter("-tests\.noarch: W: no-documentation")

@ -59,6 +59,17 @@ This Perl class parses Perl string literals and things that are reasonably
like string literals. Its real reason for being is to find interpolated
variables for Perl::Critic policies and similar code.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(open)
Requires: perl(PPI::Document) >= 1.117
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n PPIx-QuoteLike-%{version}
# Fix shell bang and permissions
@ -67,6 +78,11 @@ for F in eg/{pqldump,variables}; do
"$F"
chmod -x "$F"
done
# Help generators to recognize Perl scripts
for F in t/*.t; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
@ -75,8 +91,17 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%install
%{make_install}
%{_fixperms} $RPM_BUILD_ROOT/*
# 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}')
make test
%files
@ -85,9 +110,13 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Fri Mar 26 2021 Petr Pisar <ppisar@redhat.com> - 0.016-1
- 0.016 bump
- Package tests
* Fri Feb 05 2021 Petr Pisar <ppisar@redhat.com> - 0.015-1
- 0.015 bump

Loading…
Cancel
Save