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/perl-File-MimeInfo.rpmlintrc b/perl-File-MimeInfo.rpmlintrc new file mode 100644 index 0000000..3c67f8c --- /dev/null +++ b/perl-File-MimeInfo.rpmlintrc @@ -0,0 +1,2 @@ +from Config import * +addFilter("-tests.noarch: W: no-documentation"); diff --git a/perl-File-MimeInfo.spec b/perl-File-MimeInfo.spec index a869e01..fcc6681 100644 --- a/perl-File-MimeInfo.spec +++ b/perl-File-MimeInfo.spec @@ -81,8 +81,29 @@ Recommends: shared-mime-info This module can be used to determine the mime type of a file. It tries to implement the freedesktop specification for a shared MIME database. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: desktop-file-utils +Requires: perl-Test-Harness +Requires: shared-mime-info + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n File-MimeInfo-%{version} +# Remove test, which tests tool app in different place. +rm -f t/11mimeinfo.t +# Fix permissions +chmod -x t/default/binary_file +chmod -x t/magic/application_x-executable +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F" + chmod +x "$F" +done %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -91,6 +112,14 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} %{_fixperms} $RPM_BUILD_ROOT/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check unset EXTENDED_TESTING @@ -104,9 +133,13 @@ make test %{_mandir}/man1/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Mon Mar 07 2022 Michal Josef Špaček - 0.32-1 - 0.32 bump +- Package tests * Fri Jan 21 2022 Fedora Release Engineering - 0.31-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_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..447424e --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-File-MimeInfo +require: perl-File-MimeInfo-tests +test: /usr/libexec/perl-File-MimeInfo/test