From 6d110065b86d97153505923824e5994ccd192ac2 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Apr 07 2021 13:30:24 +0000 Subject: Package tests --- 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-Devel-NYTProf.spec b/perl-Devel-NYTProf.spec index 6939fb3..121fd3a 100644 --- a/perl-Devel-NYTProf.spec +++ b/perl-Devel-NYTProf.spec @@ -64,10 +64,23 @@ Suggests: perl(JSON::MaybeXS) Requires: flamegraph %{?perl_default_filter} +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(NYTProfTest\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(Devel::NYTProf::Test)\s*$ + %description Devel::NYTProf is a powerful feature-rich perl source code profiler. +%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 Devel-NYTProf-%{version} %patch1 -p1 @@ -76,6 +89,12 @@ Devel::NYTProf is a powerful feature-rich perl source code profiler. rm -r bin/flamegraph.pl perl -i -ne 'print $_ unless m{flamegraph.pl}' MANIFEST +# 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 perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -87,7 +106,35 @@ find %{buildroot} -type f -name '*.bs' -size 0 -delete rm -rf %{buildroot}/%{perl_vendorarch}/Devel/auto/ %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} + +mkdir -p %{buildroot}%{_libexecdir}/%{name}/bin +for F in nytprofcalls nytprofcg nytprofcsv nytprofhtml nytprofmerge nytprofpf; do +ln -s %{_bindir}/"$F" %{buildroot}%{_libexecdir}/%{name}/bin +done + +# Install tests - copy tests to tmp +mkdir -p %{buildroot}/%{_libexecdir}/%{name} +cp -a t %{buildroot}/%{_libexecdir}/%{name} +rm -f %{buildroot}/%{_libexecdir}/%{name}/t/9*.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 @@ -98,9 +145,13 @@ make test %{_mandir}/man1/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Wed Apr 07 2021 Jitka Plesnikova - 6.07-1 - 6.07 bump +- Package tests * Wed Jan 27 2021 Fedora Release Engineering - 6.06-11 - 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..c509923 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Devel-NYTProf +require: perl-Devel-NYTProf-tests +test: /usr/libexec/perl-Devel-NYTProf/test