Package tests

This commit is contained in:
Petr Písař 2019-08-26 16:26:02 +02:00
parent 55872062da
commit fc84f8df7a

View File

@ -9,7 +9,7 @@
Name: perl-LDAP Name: perl-LDAP
Version: 0.66 Version: 0.66
Release: 4%{?dist} Release: 5%{?dist}
Epoch: 1 Epoch: 1
Summary: LDAP Perl module Summary: LDAP Perl module
License: GPL+ or Artistic License: GPL+ or Artistic
@ -108,6 +108,55 @@ writes DSML entry and schema entities. Reading DSML entities is a future
project. project.
%endif %endif
%package tests
Summary: Tests for %{name}
Requires: coreutils
Requires: perl-LDAP = %{?epoch:%{epoch}:}%{version}-%{release}
# perl-Test-Harness for "prove" command
Requires: perl-Test-Harness
Requires: perl(Convert::ASN1) >= 0.2
Requires: perl(File::Basename)
Requires: perl(File::Compare)
Requires: perl(File::Path)
Requires: perl(File::Spec)
Requires: perl(IO::File)
Requires: perl(Net::LDAP)
Requires: perl(Net::LDAP::ASN)
Requires: perl(Net::LDAP::Constant)
Requires: perl(Net::LDAP::Control::Assertion)
Requires: perl(Net::LDAP::Control::ManageDsaIT)
Requires: perl(Net::LDAP::Control::MatchedValues)
Requires: perl(Net::LDAP::Control::PostRead)
Requires: perl(Net::LDAP::Control::PreRead)
Requires: perl(Net::LDAP::Control::ProxyAuth)
Requires: perl(Net::LDAP::Control::Sort)
Requires: perl(Net::LDAP::Entry)
Requires: perl(Net::LDAP::Extension::Cancel)
Requires: perl(Net::LDAP::Filter)
Requires: perl(Net::LDAP::FilterMatch)
Requires: perl(Net::LDAP::LDIF)
Requires: perl(Net::LDAP::Schema)
Requires: perl(Net::LDAP::Util)
Requires: perl(Net::LDAPI)
Requires: perl(Test::More)
# Prefer core Text::Soundex
Requires: perl(Text::Soundex)
%if %{with perl_LDAP_enables_xml}
Requires: perl(Net::LDAP::DSML)
Requires: perl(XML::SAX::Base)
Requires: perl(XML::SAX::Writer)
%endif
%if %{with perl_LDAP_enables_optional_test}
# Optional tests:
Requires: openldap-servers
Requires: perl(IO::Socket::SSL) >= 1.26
Requires: perl(Net::LDAPS)
Requires: perl(LWP::UserAgent)
%endif
%description tests
Tests from %{name}-%{version}. Execute them with "%{_libexecdir}/%{name}/test".
%prep %prep
%setup -q -n perl-ldap-%{version} %setup -q -n perl-ldap-%{version}
@ -118,6 +167,11 @@ perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/*
# Remove bundled libraries # Remove bundled libraries
rm -rf inc rm -rf inc
sed -i -e '/^inc\// d' MANIFEST sed -i -e '/^inc\// d' MANIFEST
# Remove tests specific for XML support if the support is disabled
%if !%{with perl_LDAP_enables_xml}
rm t/05dsml.t
sed -i -e '/^t\/05dsml\.t/ d' MANIFEST
%endif
find -type f -exec chmod -x {} + find -type f -exec chmod -x {} +
%build %build
@ -127,6 +181,22 @@ make %{?_smp_mflags}
%install %install
make pure_install DESTDIR=%{buildroot} make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete find %{buildroot} -type f -name .packlist -delete
mkdir -p %{buildroot}/%{_libexecdir}/%{name}
# FIXME: Generators should scan these non-executable files
cp -a data t test.cfg %{buildroot}/%{_libexecdir}/%{name}
cat > %{buildroot}/%{_libexecdir}/%{name}/test <<EOF
#!/bin/sh
set -e
# t/common.pl reads from ./data and writes into ./temp. The easiest solution
# is to copy the tests into a writable directory and execute the from there.
DIR=$(mktemp)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
prove -I .
popd
rm -rf "$DIR"
EOF
chmod +x %{buildroot}/%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/* %{_fixperms} %{buildroot}/*
%check %check
@ -148,7 +218,13 @@ make test
%{_mandir}/man3/Net::LDAP::DSML.3pm* %{_mandir}/man3/Net::LDAP::DSML.3pm*
%endif %endif
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Mon Aug 26 2019 Petr Pisar <ppisar@redhat.com> - 1:0.66-5
- Package tests
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.66-4 * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.66-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild