Package tests

This commit is contained in:
Michal Josef Špaček 2022-12-12 00:46:27 +01:00
parent 65d864b55e
commit 9f9ca9fb25
6 changed files with 62 additions and 1 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

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

View File

@ -35,6 +35,11 @@ Requires: perl(warnings)
# Remove under-speficied dependencies
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Moo\\)$
# Remove depdendency for test, which is no packaged
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Test::Pod\\)$
# Remove private modules
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(TestModuleManifestSkip\\)$
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(TestModuleManifestSkip\\)$
%description
CPAN module authors use a MANIFEST.SKIP file to exclude certain well known
@ -46,10 +51,24 @@ one of your own entries, you have to add all the common ones yourself. This
module attempts to make all of this boring process as simple and reliable as
possible.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: coreutils
Requires: perl-Test-Harness
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Module-Manifest-Skip-%{version}
%patch0 -p1
# Help generators to recognize Perl scripts
for F in $(find t/ -name '*.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
@ -57,7 +76,26 @@ 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}
# share dir is for testing
cp -a share %{buildroot}%{_libexecdir}/%{name}
# Remove author tests
rm -f %{buildroot}%{_libexecdir}/%{name}/t/release-pod-syntax.t
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/bash
set -e
# Some test files writes into CWD
DIR=$(mktemp -d)
cp -a %{_libexecdir}/%{name}/* "$DIR"
pushd "$DIR"
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
popd
rm -r "$DIR"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%check
unset RELEASE_TESTING
@ -69,8 +107,12 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Sun Dec 11 2022 Michal Josef Špaček <mspacek@redhat.com> - 0.23-26
- Package tests
- Update license to SPDX format
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-25

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-Module-Manifest-Skip
require: perl-Module-Manifest-Skip-tests
test: /usr/libexec/perl-Module-Manifest-Skip/test