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-Module-ScanDeps.spec b/perl-Module-ScanDeps.spec index e9fcc13..1b62a6e 100644 --- a/perl-Module-ScanDeps.spec +++ b/perl-Module-ScanDeps.spec @@ -78,14 +78,38 @@ Recommends: perl(Digest::MD5) Recommends: perl(Storable) Suggests: perl(CPANPLUS::Backend) +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}/%{name} +%global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}^%{_libexecdir}/%{name}/t/data +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Utils\\) +%if %{defined perl_bootstrap} || %{without perl_Module_ScanDeps_enables_prefork} +%global __requires_exclude %{__requires_exclude}|^perl\\(prefork\\) +%endif + + %description This module scans potential modules used by perl programs and returns a hash reference. Its keys are the module names as they appear in %%INC (e.g. Test/More.pm). The values are hash references. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Module-ScanDeps-%{version} +# Help file to recognise the Perl scripts +for F in `find t -name *.t -o -name *.pl`; 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 INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -94,7 +118,26 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_install} %{_fixperms} %{buildroot} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +rm -f %{buildroot}%{_libexecdir}/%{name}/t/0-pod.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests write into temporary files/directories. The easiest solution +# is to copy the tests into a writable directory and execute them from there. +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + %check +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -105,9 +148,13 @@ make test %{_mandir}/man1/scandeps.pl.1* %{_mandir}/man3/Module::ScanDeps.3pm* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu Apr 22 2021 Jitka Plesnikova - 1.31-1 - 1.31 bump +- Package tests * Wed Jan 27 2021 Fedora Release Engineering - 1.30-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..4b81328 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Module-ScanDeps +require: perl-Module-ScanDeps-tests +test: /usr/libexec/perl-Module-ScanDeps/test