Package tests
This commit is contained in:
parent
491368d6f2
commit
467f79c9de
|
@ -1,2 +1,4 @@
|
|||
from Config import *
|
||||
addFilter("spelling-error .* (config|pc)");
|
||||
addFilter("-tests\.noarch: W: no-documentation")
|
||||
addFilter("-tests\.noarch: W: devel-file-in-non-devel-package .*/corpus/")
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# Disabled by default because it creates a build cycle (perl-Alien-pkgconf →
|
||||
# perl-Alien-Build → perl-PkgConfig-LibPkgConf).
|
||||
%bcond_with perl_PkgConfig_LibPkgConf_enables_Alien_pkgconf
|
||||
# Perform optional tests
|
||||
%bcond_without perl_PkgConfig_LibPkgConf_enables_optional_test
|
||||
|
||||
Name: perl-PkgConfig-LibPkgConf
|
||||
Version: 0.11
|
||||
|
@ -44,19 +46,45 @@ BuildRequires: perl(File::Basename)
|
|||
BuildRequires: perl(File::Path)
|
||||
BuildRequires: perl(File::Temp)
|
||||
BuildRequires: perl(Test::More) >= 0.98
|
||||
%if %{with perl_PkgConfig_LibPkgConf_enables_optional_test}
|
||||
# Optional tests:
|
||||
BuildRequires: perl(YAML)
|
||||
%endif
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
|
||||
Requires: perl(Carp)
|
||||
|
||||
# Filter under-specified dependencies
|
||||
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$
|
||||
|
||||
%description
|
||||
Many libraries in compiled languages such as C or C++ provide *.pc files to
|
||||
specify the flags required for compiling and linking against those libraries.
|
||||
Traditionally, the command line program pkg-config is used to query these
|
||||
files. This package provides a Perl-level API using libpkgconf to these files.
|
||||
|
||||
%package tests
|
||||
Summary: Tests for %{name}
|
||||
BuildArch: noarch
|
||||
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Requires: coreutils
|
||||
Requires: perl-Test-Harness
|
||||
Requires: perl(Cwd)
|
||||
Requires: perl(Test::More) >= 0.98
|
||||
%if %{with perl_PkgConfig_LibPkgConf_enables_optional_test}
|
||||
Requires: perl(YAML)
|
||||
%endif
|
||||
|
||||
%description tests
|
||||
Tests from %{name}. Execute them
|
||||
with "%{_libexecdir}/%{name}/test".
|
||||
|
||||
%prep
|
||||
%setup -q -n PkgConfig-LibPkgConf-%{version}
|
||||
# Help generators to recognize Perl scripts
|
||||
for F in t/*.t; do
|
||||
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F"
|
||||
chmod +x "$F"
|
||||
done
|
||||
|
||||
%build
|
||||
unset FFI_PLATYPUS_DEBUG
|
||||
|
@ -67,9 +95,25 @@ 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
|
||||
# Install tests
|
||||
mkdir -p %{buildroot}%{_libexecdir}/%{name}
|
||||
cp -a corpus t %{buildroot}%{_libexecdir}/%{name}
|
||||
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
# audit_set_log() in t/client.t writed into CWD
|
||||
DIR=$(mktemp -d)
|
||||
cp -a %{_libexecdir}/%{name}/* "$DIR"
|
||||
pushd "$DIR"
|
||||
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
popd
|
||||
rm -r "$DIR"
|
||||
EOF
|
||||
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
|
||||
%{_fixperms} $RPM_BUILD_ROOT/*
|
||||
|
||||
%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,10 +123,14 @@ make test
|
|||
%{perl_vendorarch}/PkgConfig*
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%files tests
|
||||
%{_libexecdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Tue Mar 23 2021 Petr Pisar <ppisar@redhat.com> - 0.11-5
|
||||
- Break build cycle (perl-Alien-pkgconf → perl-Alien-Build
|
||||
→ perl-PkgConfig-LibPkgConf)
|
||||
- Package tests
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.11-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
|
Loading…
Reference in New Issue