From 6f3bcba9018f1fe90025cace0684e380ba867f1f Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Mon, 1 Mar 2021 12:06:37 +0100 Subject: [PATCH] Added FMF tests --- .fmf/version | 1 + gating.yaml | 7 ++++++ perl-CGI.spec | 47 +++++++++++++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 5 +++++ 5 files changed, 64 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-CGI.spec b/perl-CGI.spec index 819722c..c17986b 100644 --- a/perl-CGI.spec +++ b/perl-CGI.spec @@ -4,7 +4,7 @@ Name: perl-CGI Summary: Handle Common Gateway Interface requests and responses Version: 4.51 -Release: 2%{?dist} +Release: 3%{?dist} License: Artistic 2.0 Source0: https://cpan.metacpan.org/authors/id/L/LE/LEEJO/CGI-%{version}.tar.gz URL: https://metacpan.org/release/CGI @@ -63,6 +63,11 @@ Requires: perl(Text::ParseWords) %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(MultipartBuffer\\)$ %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(Fh\\) +# Filter modules bundled for tests +%global __requires_exclude %{__requires_exclude}|^perl\\(Apache)\s*$ +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} + + %description CGI.pm is a stable, complete and mature solution for processing and preparing HTTP requests and responses. Major features including processing form @@ -73,21 +78,55 @@ HTML generation utilities are included as well. CGI.pm performs very well in in a vanilla CGI.pm environment and also comes with built-in support for mod_perl and mod_perl2 as well as FastCGI. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Test::CPAN::Changes) + +%description tests +Tests from %{name}-%{version}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n CGI-%{version} iconv -f iso8859-1 -t utf-8 < Changes > Changes.1 mv Changes.1 Changes chmod -c -x examples/* +# Help file to recognise the Perl scripts +for F in `find t -name *.t`; do + if grep -q "^#!.*perl" "$F" ; then + perl -MConfig -pi -e 's|^#!.*perl\b|$Config{startperl}|' "$F" + else + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F" + fi + chmod +x "$F" +done + +# Remove release tests +rm t/compiles_pod.t t/changes.t +perl -i -ne 'print $_ unless m{^t/compiles_pod\.t}' MANIFEST +perl -i -ne 'print $_ unless m{^t/changes\.t}' MANIFEST + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} %install %{make_install} +# 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}/* %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 @@ -96,7 +135,13 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Mar 01 2021 Jitka Plesnikova - 4.51-3 +- Package tests + * Tue Jan 26 2021 Fedora Release Engineering - 4.51-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_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..c0eebcf --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,5 @@ +summary: Upstream tests +component: perl-CGI +require: perl-CGI-tests +test: /usr/libexec/perl-CGI/test +