Added FMF tests

This commit is contained in:
Jitka Plesnikova 2023-03-08 10:57:21 +01:00
parent 60e801bad3
commit ea39eca6db
5 changed files with 63 additions and 3 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

@ -1,6 +1,6 @@
Name: perl-Archive-Zip
Version: 1.68
Release: 10%{?dist}
Release: 11%{?dist}
Summary: Perl library for accessing Zip archives
# lib/Archive/Zip/Member.pm: (GPL-1.0-or-later OR Artistic-1.0-Perl) and Info-ZIP
# (The _mapPermissionsToUnix() comments are
@ -14,8 +14,8 @@ BuildRequires: coreutils
# For a Git binary patch
BuildRequires: git-core
BuildRequires: make
BuildRequires: perl-interpreter
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(:VERSION) >= 5.4
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
@ -54,6 +54,9 @@ Requires: perl(File::Spec) >= 0.80
# Remove under-specified dependencies
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(File::Spec\\)$
# Filter modules bundled for tests
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
%global __requires_exclude %{__requires_exclude}|^perl\\(common\\)
%description
The Archive::Zip module allows a Perl program to create, manipulate,
@ -66,6 +69,17 @@ or other attributes queried or modified. Their data can be compressed
or uncompressed as needed. Members can be created from members in
existing Zip files, or from existing directories, files, or strings.
%package tests
Summary: Tests for %{name}
License: GPL-1.0-or-later OR Artistic-1.0-Perl
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: unzip
Requires: zip
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%autosetup -S git -n Archive-Zip-%{version}
@ -73,15 +87,38 @@ for F in examples/*.pl; do
perl -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(q{$F})"
done
# 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 NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
%install
%{make_install}
%{_fixperms} $RPM_BUILD_ROOT/*
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t examples %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/bash
set -e
# Some tests write into temporary files/directories. The 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
%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
@ -90,8 +127,13 @@ make test
%{perl_vendorlib}/Archive/
%{_mandir}/man3/Archive*.3*
%files tests
%{_libexecdir}/%{name}
%changelog
* Wed Mar 08 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.68-11
- Package tests
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.68-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_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-Archive-Zip
require: perl-Archive-Zip-tests
test: /usr/libexec/perl-Archive-Zip/test