From e623e4f889e54436ca033681bc9c9d65ebe4aaaa Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 4 Jul 2024 12:43:46 +0200 Subject: [PATCH] Resolves: RHEL-43290 - Package tests --- .fmf/version | 1 + gating.yaml | 7 +++++++ perl-libxml-perl.spec | 44 +++++++++++++++++++++++++++++++++++++--- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 12 +++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) 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..1608530 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +# RHEL +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/perl-libxml-perl.spec b/perl-libxml-perl.spec index 760496b..fa5b0b1 100644 --- a/perl-libxml-perl.spec +++ b/perl-libxml-perl.spec @@ -1,6 +1,6 @@ Name: perl-libxml-perl Version: 0.08 -Release: 44%{?dist} +Release: 45%{?dist} Summary: A collection of Perl modules for working with XML License: (GPL+ or Artistic) and Public Domain URL: https://metacpan.org/release/libxml-perl @@ -9,6 +9,7 @@ BuildArch: noarch BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 # Run-time: BuildRequires: perl(:VERSION) >= 5.5.0 @@ -19,7 +20,6 @@ BuildRequires: perl(UNIVERSAL) BuildRequires: perl(vars) BuildRequires: perl(XML::Parser) >= 2.19 # Tests: -Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(XML::Parser) >= 2.19 # Filter out unversioned provides @@ -33,8 +33,22 @@ documents for working with XML in Perl. libxml-perl software works in combination with XML::Parser, PerlSAX, XML::DOM, XML::Grove and others. +%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 libxml-perl-%{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 NO_PERLLOCAL=1 @@ -43,6 +57,22 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests write into temporary files/directories. The easiest 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 make test @@ -51,9 +81,17 @@ make test %doc ChangeLog Changes README %{perl_vendorlib}/Data/ %{perl_vendorlib}/XML/ -%{_mandir}/man3/*.3* +%{_mandir}/man3/Data*.3* +%{_mandir}/man3/XML*.3* + +%files tests +%{_libexecdir}/%{name} %changelog +* Mon Jul 01 2024 Jitka Plesnikova - 0.08-45 +- Resolves: RHEL-43290 +- Package tests + * Mon Aug 09 2021 Mohan Boddu - 0.08-44 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 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..25022a8 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,12 @@ +summary: Upstream tests +contact: Jitka Plesnikova +component: perl-libxml-perl +require: perl-libxml-perl-tests +test: /usr/libexec/perl-libxml-perl/test +enabled: true +tag: + - rhel-buildroot +adjust: + - enabled: false + when: distro < rhel-9 or distro < centos-stream-9 + continue: false