Added FMF tests

This commit is contained in:
Jitka Plesnikova 2021-03-01 12:06:37 +01:00
parent 8f24b36bb5
commit 6f3bcba901
5 changed files with 64 additions and 1 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -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}

View File

@ -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 <jplesnik@redhat.com> - 4.51-3
- Package tests
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.51-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

5
plans/sanity.fmf Normal file
View File

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

5
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Upstream tests
component: perl-CGI
require: perl-CGI-tests
test: /usr/libexec/perl-CGI/test