From 0ab3ac0f83eee84dcb6994fc9bd06dfdf7955320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= Date: Tue, 11 May 2021 17:08:58 +0200 Subject: [PATCH] Package tests --- perl-Net-DNS.rpmlintrc | 1 + perl-Net-DNS.spec | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/perl-Net-DNS.rpmlintrc b/perl-Net-DNS.rpmlintrc index ea37699..81de58e 100644 --- a/perl-Net-DNS.rpmlintrc +++ b/perl-Net-DNS.rpmlintrc @@ -1,2 +1,3 @@ from Config import * addFilter("spelling-error .* (gethostbyaddr|gethostbyname)"); +addFilter("-tests\.noarch: W: no-documentation"); diff --git a/perl-Net-DNS.spec b/perl-Net-DNS.spec index 254ddf8..8ad8c86 100644 --- a/perl-Net-DNS.spec +++ b/perl-Net-DNS.spec @@ -115,10 +115,31 @@ Recommends: perl(IO::Socket::IP) >= 0.32 %description Nameserver Instances of the "Net::DNS::Nameserver" class represent DNS server objects. +%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 Net-DNS-%{version} chmod -x demo/* perl -MConfig -i -pe 's{^#!/usr/local/bin/perl}{$Config{startperl}}' demo/* +# Remove author tests +for F in \ + t/00-install.t \ + t/00-pod.t \ + ; do + rm "$F" + perl -i -ne 'print $_ unless m{\A\Q'"$F"'\E}' MANIFEST +done +# Help generators to recognize Perl scripts +for F in t/*.t; do + chmod +x "$F" +done %build export PERL_MM_USE_DEFAULT=yes @@ -129,6 +150,14 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 --no-online-tes %{make_install} find %{buildroot} -type f -name '*.bs' -a -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 make test @@ -149,8 +178,12 @@ make test %{perl_vendorlib}/Net/DNS/Nameserver.pm %{_mandir}/man3/Net::DNS::Nameserver* +%files tests +%{_libexecdir}/%{name} + %changelog * Tue Feb 22 2022 Michal Josef Špaček - 1.33-2 +- Package tests - Remove obsolete dependency to Net::DNS::SEC There was dependency until 1.29 version and it was used for tests.