From 9e852eae13fe80bbdccf1667f9814fec766c5f35 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Apr 16 2021 07:04:45 +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/perlbrew.spec b/perlbrew.spec index 10c8c8e..ad9a592 100644 --- a/perlbrew.spec +++ b/perlbrew.spec @@ -69,6 +69,7 @@ Requires: curl Provides: perl-App-perlbrew = %{version}-%{release} %{?perl_default_filter} +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(test_helpers.pl\\) %description perlbrew is a program to automate the building and installation of perl in @@ -78,9 +79,24 @@ provides. You then can benefit from not having to run 'sudo' commands to install cpan modules because those are installed inside your HOME too. It's almost like an isolated perl environments. +%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 App-perlbrew-%{version} +# Help file to recognise the Perl scripts +for F in t/*.t t/*.pl; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Build.PL --installdirs=vendor ./Build @@ -90,6 +106,19 @@ perl -V ./Build install --destdir=$RPM_BUILD_ROOT --create_packlist=0 %{_fixperms} $RPM_BUILD_ROOT/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +# Few tests used ./script/perlbrew +mkdir %{buildroot}%{_libexecdir}/%{name}/script +ln -s %{_bindir}/perlbrew %{buildroot}%{_libexecdir}/%{name}/script +chmod 755 %{buildroot}%{_libexecdir}/%{name}/t/fake-bin/curl +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 ./Build test @@ -101,9 +130,13 @@ perl -V %{_mandir}/man1/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu Apr 15 2021 Jitka Plesnikova - 0.92-1 - 0.92 bump +- Package tests * Sun Jan 31 2021 Jitka Plesnikova - 0.91-1 - 0.91 bump 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..a40406f --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perlbrew +require: perlbrew-tests +test: /usr/libexec/perlbrew/test