From 3dc32a5a10f3fc9db09046bfbdb554179c7905f0 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Mon, 19 Apr 2021 18:48:58 +0200 Subject: [PATCH] Package tests --- .fmf/version | 1 + gating.yaml | 7 ++++++ perl-XML-LibXML.spec | 48 ++++++++++++++++++++++++++++++++++++++++ plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 5 files changed, 65 insertions(+) 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..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-LibXML.spec b/perl-XML-LibXML.spec index b73bebd..b60bfb8 100644 --- a/perl-XML-LibXML.spec +++ b/perl-XML-LibXML.spec @@ -85,6 +85,15 @@ Provides: perl-XML-LibXML-Common = %{version} Obsoletes: perl-XML-LibXML-Common <= 0.13 %{?perl_default_filter} +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Collector\\)\s*$ +%global __requires_exclude %{__requires_exclude}|^perl\\(Counter)\s*$ +%global __requires_exclude %{__requires_exclude}|^perl\\(Stacker)\s*$ +%global __requires_exclude %{__requires_exclude}|^perl\\(TestHelpers)\s*$ +%if 0%{?rhel} +%global __requires_exclude %{__requires_exclude}|^perl\\(Test::LeakTrace)\s*$ +%endif %description This module implements a Perl interface to the GNOME libxml2 library @@ -92,6 +101,19 @@ which provides interfaces for parsing and manipulating XML files. This module allows Perl programmers to make use of the highly capable validating XML parser and the high performance DOM implementation. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +%if %{with thread_test} +Requires: perl(threads) +Requires: perl(threads::shared) +%endif + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n XML-LibXML-%{version} %patch0 -p1 @@ -101,6 +123,12 @@ for i in Changes; do /usr/bin/iconv -f iso8859-1 -t utf-8 $i > $i.conv && /bin/mv -f $i.conv $i done +# Help file to recognise the 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 SKIP_SAX_INSTALL=1 INSTALLDIRS=vendor \ OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -111,7 +139,23 @@ perl Makefile.PL SKIP_SAX_INSTALL=1 INSTALLDIRS=vendor \ find %{buildroot} -type f -name '*.bs' -empty -delete %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a example t test %{buildroot}%{_libexecdir}/%{name} +for F in cpan-changes.t 11memory.t pod.t pod-files-presence.t release-kwalitee.t style-trailing-space.t; do + rm -f %{buildroot}%{_libexecdir}/%{name}/t/"$F" +done +perl -i -pe 's{example/(testrun.xml)}{/tmp/$1}' %{buildroot}%{_libexecdir}/%{name}/t/03doc.t +cat > %{buildroot}%{_libexecdir}/%{name}/tests << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && THREAD_TEST=0%{?with_thread_test:1} exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/tests + + %check +unset AUTHOR_TESTING RELEASE_TESTING +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') THREAD_TEST=0%{?with_thread_test:1} make test %triggerin -- perl-XML-SAX @@ -135,9 +179,13 @@ fi %{perl_vendorarch}/XML %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} + %changelog * Mon Apr 19 2021 Jitka Plesnikova - 1:2.0207-1 - 2.0207 bump +- Package tests * Wed Jan 27 2021 Fedora Release Engineering - 1:2.0206-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_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..724f76b --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-XML-LibXML +require: perl-XML-LibXML-tests +test: /usr/libexec/perl-XML-LibXML/tests