Add tests and gating.yaml

This commit is contained in:
Jitka Plesnikova 2024-07-23 16:20:55 +02:00
parent 2734e3eb66
commit 260799377c
5 changed files with 73 additions and 8 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
# RHEL
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -7,15 +7,17 @@
Name: perl-File-DesktopEntry
Version: 0.22
Release: 26%{?dist}
Release: 27%{?dist}
Summary: Object to handle .desktop files
License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/File-DesktopEntry
Source0: https://cpan.metacpan.org/authors/id/M/MI/MICHIELB/File-DesktopEntry-%{version}.tar.gz
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: make
BuildRequires: perl-interpreter
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
@ -47,26 +49,64 @@ is specified by the freedesktop "Desktop Entry" specification. This module
can parse these files but also knows how to run the applications defined by
these files. For this module version 1.0 of the specification was used.
%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 File-DesktopEntry-%{version}
# 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
make %{?_smp_mflags}
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
%install
make pure_install DESTDIR=$RPM_BUILD_ROOT
%{_fixperms} $RPM_BUILD_ROOT/*
%{make_install}
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a MANIFEST t %{buildroot}%{_libexecdir}/%{name}
rm %{buildroot}%{_libexecdir}/%{name}/t/*_pod*
rm %{buildroot}%{_libexecdir}/%{name}/t/06_changes.t
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
%doc Changes
%{perl_vendorlib}/*
%{_mandir}/man3/*
%{perl_vendorlib}/File*
%{_mandir}/man3/File::DesktopEntry*
%files tests
%{_libexecdir}/%{name}
%changelog
* Tue Jul 23 2024 Jitka Plesnikova <jplesnik@redhat.com> - 0.22-27
- Package tests
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.22-26
- Bump release for June 2024 mass rebuild

5
plans/sanity.fmf Normal file
View File

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

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

@ -0,0 +1,12 @@
summary: Upstream tests
contact: Jitka Plesnikova <jplesnik@redhat.com>
component: perl-File-DesktopEntry
require: perl-File-DesktopEntry-tests
test: /usr/libexec/perl-File-DesktopEntry/test
enabled: true
tag:
- rhel-buildroot
adjust:
- enabled: false
when: distro < rhel-10 or distro < centos-stream-10
continue: false