Package tests

This commit is contained in:
Jitka Plesnikova 2021-04-19 18:48:58 +02:00
parent 9663058465
commit 3dc32a5a10
5 changed files with 65 additions and 0 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

@ -85,6 +85,15 @@ Provides: perl-XML-LibXML-Common = %{version}
Obsoletes: perl-XML-LibXML-Common <= 0.13 Obsoletes: perl-XML-LibXML-Common <= 0.13
%{?perl_default_filter} %{?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 %description
This module implements a Perl interface to the GNOME libxml2 library 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 module allows Perl programmers to make use of the highly capable
validating XML parser and the high performance DOM implementation. 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 %prep
%setup -q -n XML-LibXML-%{version} %setup -q -n XML-LibXML-%{version}
%patch0 -p1 %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 /usr/bin/iconv -f iso8859-1 -t utf-8 $i > $i.conv && /bin/mv -f $i.conv $i
done 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 %build
perl Makefile.PL SKIP_SAX_INSTALL=1 INSTALLDIRS=vendor \ perl Makefile.PL SKIP_SAX_INSTALL=1 INSTALLDIRS=vendor \
OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1 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 find %{buildroot} -type f -name '*.bs' -empty -delete
%{_fixperms} %{buildroot}/* %{_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 %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 THREAD_TEST=0%{?with_thread_test:1} make test
%triggerin -- perl-XML-SAX %triggerin -- perl-XML-SAX
@ -135,9 +179,13 @@ fi
%{perl_vendorarch}/XML %{perl_vendorarch}/XML
%{_mandir}/man3/*.3* %{_mandir}/man3/*.3*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Mon Apr 19 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1:2.0207-1 * Mon Apr 19 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1:2.0207-1
- 2.0207 bump - 2.0207 bump
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0206-3 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0206-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

5
plans/sanity.fmf Normal file
View File

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

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

@ -0,0 +1,4 @@
summary: Upstream tests
component: perl-XML-LibXML
require: perl-XML-LibXML-tests
test: /usr/libexec/perl-XML-LibXML/tests