Package tests

This commit is contained in:
Michal Josef Špaček 2022-03-08 00:37:41 +01:00
parent 1d273c5680
commit 64e3850293
5 changed files with 45 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,2 @@
from Config import *
addFilter("-tests.noarch: W: no-documentation");

View File

@ -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 <mspacek@redhat.com> - 0.32-1
- 0.32 bump
- Package tests
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.31-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_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-File-MimeInfo
require: perl-File-MimeInfo-tests
test: /usr/libexec/perl-File-MimeInfo/test