From 6763ed0c12048ccef914b965e619da9de0d8a4aa Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 10 Jan 2024 14:00:07 +0100 Subject: [PATCH] Package tests --- .fmf/version | 1 + gating.yaml | 16 ++++++++++++++++ perl-Date-Manip.spec | 39 +++++++++++++++++++++++++++++++++++++++ plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 5 files changed, 65 insertions(+) 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..3b56a2d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,16 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_testing +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + +# Rawhide +--- !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-Date-Manip.spec b/perl-Date-Manip.spec index c8cfc91..e368795 100644 --- a/perl-Date-Manip.spec +++ b/perl-Date-Manip.spec @@ -11,6 +11,7 @@ BuildRequires: coreutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(strict) BuildRequires: perl(warnings) @@ -46,6 +47,9 @@ Obsoletes: perl-DateManip < 5.48-1 %{?perl_default_filter} +# Filter modules bundled for tests +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(tests.pl\\) + %description Date::Manip is a series of modules designed to make any common date/time operation easy to do. Operations such as comparing two times, determining @@ -54,9 +58,24 @@ are all easily done. It deals with time as it is used in the Gregorian calendar (the one currently in use) with full support for time changes due to daylight saving time. +%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 Date-Manip-%{version} +# Help generators to recognize Perl scripts +for F in t/*.t t/*.pl; 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 NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -65,6 +84,22 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +# Remove release tests +rm -f %{buildroot}%{_libexecdir}/%{name}/t/_pod* +rm -f %{buildroot}%{_libexecdir}/%{name}/t/_version.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +unset DATE_MANIP DATE_MANIP_DEBUG DATE_MANIP_DEBUG_ABBREVS \ + DATE_MANIP_DEBUG_ZONES Date_Manip_RELEASE_TESTING DATE_MANIP_TEST_DM5 \ + OS MULTINET_TIMEZONE 'SYS$TIMEZONE_DIFFERENTIAL' 'SYS$TIMEZONE_NAME' \ + 'SYS$TIMEZONE_RULE' 'TCPIP$TZ' 'UCX$TZ' +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + %check unset DATE_MANIP DATE_MANIP_DEBUG DATE_MANIP_DEBUG_ABBREVS \ DATE_MANIP_DEBUG_ZONES Date_Manip_RELEASE_TESTING DATE_MANIP_TEST_DM5 \ @@ -84,9 +119,13 @@ make test %{_mandir}/man3/Date::Manip::*.3* %{_bindir}/dm_* +%files tests +%{_libexecdir}/%{name} + %changelog * Wed Jan 10 2024 Jitka Plesnikova - 6.94-1 - 6.94 bump (rhbz#2257491) +- Package tests * Wed Jan 03 2024 Petr Pisar - 6.93-2 - Adapt test envinronment guard to changes in 6.93 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..4269836 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Date-Manip +require: perl-Date-Manip-tests +test: /usr/libexec/perl-Date-Manip/test