Package tests

epel9
Jitka Plesnikova 4 years ago
parent 11a7c38b06
commit 5863ab9214

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

@ -25,9 +25,6 @@ BuildRequires: perl(vars)
BuildRequires: perl(Data::Dumper) BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Test::More) BuildRequires: perl(Test::More)
BuildRequires: perl(warnings) BuildRequires: perl(warnings)
# Optional tests only
BuildRequires: perl(Test::Pod)
BuildRequires: perl(Test::Pod::Coverage)
Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version))
%description %description
@ -37,18 +34,50 @@ in order to create DateTime or DateTime::Duration objects, and it can take
a DateTime or DateTime::Duration object and produce a string representing a DateTime or DateTime::Duration object and produce a string representing
it in a format accepted by PostgreSQL. it in a format accepted by PostgreSQL.
%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 %prep
%setup -q -n DateTime-Format-Pg-%{version} %setup -q -n DateTime-Format-Pg-%{version}
# Help file to recognise the 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
# Remove optional tests
for F in t/99-pod.t t/99-pod-coverage.t; do
rm "$F"
perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST
done
%build %build
perl Build.PL --installdirs=vendor perl Build.PL --installdirs=vendor
./Build ./Build
%install %install
./Build install --destdir=%{buildroot} --create_packlist=0 ./Build install --destdir=%{buildroot} --create_packlist=0
# 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
%{_fixperms} %{buildroot}/* %{_fixperms} %{buildroot}/*
%check %check
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
./Build test ./Build test
%files %files
@ -57,9 +86,13 @@ perl Build.PL --installdirs=vendor
%{perl_vendorlib}/* %{perl_vendorlib}/*
%{_mandir}/man3/* %{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Tue Mar 16 2021 Jitka Plesnikova <jplesnik@redhat.com> - 0.16014-1 * Tue Mar 16 2021 Jitka Plesnikova <jplesnik@redhat.com> - 0.16014-1
- 0.16014 bump - 0.16014 bump
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16013-13 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16013-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

@ -0,0 +1,4 @@
summary: Upstream tests
component: perl-DateTime-Format-Pg
require: perl-DateTime-Format-Pg-tests
test: /usr/libexec/perl-DateTime-Format-Pg/test
Loading…
Cancel
Save