diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..282e16b --- /dev/null +++ b/gating.yaml @@ -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} diff --git a/perl-Compress-Bzip2.rpmlintrc b/perl-Compress-Bzip2.rpmlintrc new file mode 100644 index 0000000..3c67f8c --- /dev/null +++ b/perl-Compress-Bzip2.rpmlintrc @@ -0,0 +1,2 @@ +from Config import * +addFilter("-tests.noarch: W: no-documentation"); diff --git a/perl-Compress-Bzip2.spec b/perl-Compress-Bzip2.spec index d2945da..6fc35c7 100644 --- a/perl-Compress-Bzip2.spec +++ b/perl-Compress-Bzip2.spec @@ -63,12 +63,30 @@ library. A relevant subset of the functionality provided by Bzip2 is available in Compress::Bzip2. Compress::Bzip2 is not well integrated into PerlIO, use the preferred IO::Compress::Bzip2 instead. +%package tests +Summary: Tests for %{name} +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: bash +Requires: bzip2 +Requires: coreutils +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Compress-Bzip2-%{version} # Remove bundled bzip2 library find bzlib-src -mindepth 1 -type f \! -name 'sample*' -delete perl -i -ne 'print $_ unless m{^bzlib-src/}' MANIFEST find bzlib-src -type f >>MANIFEST +# Help generators to recognize 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 %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 \ @@ -77,6 +95,31 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 \ %install %make_install +# Install tests +mkdir -p %{buildroot}/%{_libexecdir}/%{name} +cp -a t %{buildroot}/%{_libexecdir}/%{name} +# Remove author tests +rm -f %{buildroot}/%{_libexecdir}/%{name}/t/900* +# Remove memory usage test +rm -f %{buildroot}/%{_libexecdir}/%{name}/t/090-memory-usage.pl +mkdir -p %{buildroot}/%{_libexecdir}/%{name}/bzlib-src +for F in sample0.bz2 sample0.ref sample1.bz2 sample1.ref sample2.bz2 sample2.ref sample3.bz2 sample3.ref; do + cp "bzlib-src/$F" %{buildroot}/%{_libexecdir}/%{name}/bzlib-src/ +done +cp -a config.in %{buildroot}/%{_libexecdir}/%{name}/ +cat > %{buildroot}/%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests write into temporary files/directories. The easiest solution +# is to copy the tests into a writable directory and execute them from there. +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}/%{_libexecdir}/%{name}/test %{_fixperms} %{buildroot} %check @@ -89,9 +132,13 @@ make test %{perl_vendorarch}/auto/Compress/ %{_mandir}/man3/*.3pm* +%files tests +%{_libexecdir}/%{name} + %changelog * Fri Nov 25 2022 Michal Josef Špaček - 2.28-11 - Cleanup build in spec file +- Package tests - Update license to SPDX format * Fri Jul 22 2022 Fedora Release Engineering - 2.28-10 diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..3b10a0e --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Compress-Bzip2 +require: perl-Compress-Bzip2-tests +test: /usr/libexec/perl-Compress-Bzip2/test