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-XML-Parser.spec b/perl-XML-Parser.spec index 0d48d42..34ae0c3 100644 --- a/perl-XML-Parser.spec +++ b/perl-XML-Parser.spec @@ -1,6 +1,6 @@ Name: perl-XML-Parser Version: 2.46 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Perl module for parsing XML documents License: GPL-1.0-or-later OR Artistic-1.0-Perl @@ -43,7 +43,9 @@ BuildRequires: perl(Test::More) BuildRequires: perl(warnings) Requires: perl(IO::File) Requires: perl(IO::Handle) - +Requires: perl(LWP::UserAgent) +Requires: perl(URI) +Requires: perl(URI::file) %{?perl_default_filter} %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}perl\\(XML::Parser\\)$ @@ -59,6 +61,15 @@ parse call. They can also be given as extra arguments to the parse methods, in which case they override options given at XML::Parser creation time. +%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 XML-Parser-%{version} chmod 644 samples/{canonical,xml*} @@ -68,6 +79,12 @@ perl -MConfig -pi -e 's|^#!/usr/local/bin/perl\b|$Config{startperl}|' samples/{c rm -r inc perl -i -ne 'print $_ unless m{^inc/}' MANIFEST +# 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 OPTIMIZE="$RPM_OPT_FLAGS" %{make_build} @@ -83,7 +100,25 @@ for file in samples/REC-xml-19980210.xml; do perl -i -pe "s/encoding='ISO-8859-1'/encoding='UTF-8'/" "$file" done +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t samples %{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 +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -92,8 +127,13 @@ make test %{perl_vendorarch}/auto/XML/ %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} %changelog +* Wed Sep 20 2023 Jitka Plesnikova - 2.46-16 +- Package tests + * Fri Jul 21 2023 Fedora Release Engineering - 2.46-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_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..65ae655 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-XML-Parser +require: perl-XML-Parser-tests +test: /usr/libexec/perl-XML-Parser/test