diff --git a/perl-CBOR-XS.rpmlintrc b/perl-CBOR-XS.rpmlintrc index b277353..0d3e525 100644 --- a/perl-CBOR-XS.rpmlintrc +++ b/perl-CBOR-XS.rpmlintrc @@ -1 +1,2 @@ addFilter('spelling-error .* (versa|superset)') +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-CBOR-XS.spec b/perl-CBOR-XS.spec index bbaf582..b3893f8 100644 --- a/perl-CBOR-XS.spec +++ b/perl-CBOR-XS.spec @@ -54,6 +54,17 @@ format that aims to use an (almost) superset of the JSON data model, i.e. when you can represent something useful in JSON, you should be able to represent it in CBOR. +%package tests +Summary: Tests for %{name} +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Math::BigInt::FastCalc) + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %autosetup -p1 -n CBOR-XS-%{version} # Remove bundled libecb @@ -66,10 +77,19 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_ %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}') make test %files @@ -79,9 +99,13 @@ make test %{perl_vendorarch}/CBOR* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu Oct 21 2021 Petr Pisar - 1.84-1 - 1.84 bump +- Package the tests * Thu Jul 22 2021 Fedora Release Engineering - 1.83-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild