From 9ad7841d2e9469c33716204bd77bc0d1d7d70c5a Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 21 Dec 2022 15:43:51 +0100 Subject: [PATCH] Package tests --- .fmf/version | 1 + gating.yaml | 7 +++++++ perl-Bit-Vector.spec | 39 ++++++++++++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/sanity.fmf create mode 100644 tests/upstream-tests.fmf 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-Bit-Vector.spec b/perl-Bit-Vector.spec index 9ffb63a..4283b72 100644 --- a/perl-Bit-Vector.spec +++ b/perl-Bit-Vector.spec @@ -1,12 +1,13 @@ Name: perl-Bit-Vector Version: 7.4 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Efficient bit vector, set of integers and "big int" math library # Outdated FSF address reported, rt#85827 # Clarified by a private mail from the author: License: ( GPL-2.0-or-later OR Artistic-1.0-Perl ) AND LGPL-2.0-or-later URL: https://metacpan.org/release/Bit-Vector Source0: https://cpan.metacpan.org/authors/id/S/ST/STBEY/Bit-Vector-%{version}.tar.gz +BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc BuildRequires: make @@ -41,12 +42,27 @@ The library is efficient (in terms of algorithmic complexity) and therefore fast (in terms of execution speed) for instance through the widespread use of divide-and-conquer algorithms. +%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 Bit-Vector-%{version} chmod -c 644 examples/*.pl perl -MConfig -pi -e 's|^#!.*perl\b|$Config{startperl}|' \ examples/{benchmk{1,2,3},primes,SetObject}.pl +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" \ NO_PERLLOCAL=1 NO_PACKLIST=1 @@ -57,7 +73,23 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" \ 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/bash +set -e +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 + %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 @@ -67,8 +99,13 @@ make test %{perl_vendorarch}/auto/Bit/ %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} %changelog +* Wed Dec 21 2022 Jitka Plesnikova - 7.4-28 +- Package tests + * Fri Jul 22 2022 Fedora Release Engineering - 7.4-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild 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..4157217 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Bit-Vector +require: perl-Bit-Vector-tests +test: /usr/libexec/perl-Bit-Vector/test