From 166156eb59f798a74dcbbc04685fb4dcb2f98067 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 22 Aug 2023 15:48:49 +0200 Subject: [PATCH] Package tests --- .fmf/version | 1 + Authen-SASL-RT85294-Fix-WRITE.patch | 13 ---------- gating.yaml | 7 ++++++ perl-Authen-SASL.spec | 38 ++++++++++++++++++++++++++++- plans/sanity.fmf | 5 ++++ tests/upstream-tests.fmf | 4 +++ 6 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 .fmf/version delete mode 100644 Authen-SASL-RT85294-Fix-WRITE.patch create mode 100644 gating.yaml create mode 100644 plans/sanity.fmf create mode 100644 tests/upstream-tests.fmf 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/Authen-SASL-RT85294-Fix-WRITE.patch b/Authen-SASL-RT85294-Fix-WRITE.patch deleted file mode 100644 index 0093ad2..0000000 --- a/Authen-SASL-RT85294-Fix-WRITE.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up Authen-SASL-2.16/lib/Authen/SASL/Perl.pm.orig Authen-SASL-2.16/lib/Authen/SASL/Perl.pm ---- Authen-SASL-2.16/lib/Authen/SASL/Perl.pm.orig 2012-09-04 18:00:31.000000000 +0200 -+++ Authen-SASL-2.16/lib/Authen/SASL/Perl.pm 2014-06-04 09:51:34.654310724 +0200 -@@ -323,6 +323,9 @@ sub securesocket { - - my $fh = $self->{fh}; - -+ # Fix for BZ#965739, RT#85294 -+ $len = length($_[1]) if $len > length($_[1]); -+ - # put on wire in peer-sized chunks - my $bsz = $self->{sndbufsz}; - while ($len > 0) { 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-Authen-SASL.spec b/perl-Authen-SASL.spec index 8a9c4d2..a9bbe26 100644 --- a/perl-Authen-SASL.spec +++ b/perl-Authen-SASL.spec @@ -7,10 +7,12 @@ URL: https://metacpan.org/release/Authen-SASL Source0: https://cpan.metacpan.org/authors/id/E/EH/EHUELS/Authen-SASL-%{version}.tar.gz BuildArch: noarch BuildRequires: coreutils +BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(:VERSION) >= 5.6 +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(strict) BuildRequires: perl(warnings) @@ -32,32 +34,66 @@ SASL is a generic mechanism for authentication used by several network protocols. Authen::SASL provides an implementation framework that all protocols should be able to share. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Carp) +Requires: perl(Digest::MD5) +Requires: perl(Digest::HMAC_MD5) + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %autosetup -p1 -n Authen-SASL-%{version} # Fix permissions chmod -c a-x example_pl +# Help generators to recognize 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} %install %{make_install} -%{_fixperms} $RPM_BUILD_ROOT +%{_fixperms} %{buildroot} + +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +rm %{buildroot}%{_libexecdir}/%{name}/t/author-pod-syntax.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && exec prove -I . -r -j "$(getconf _NPROCESSORS_ONLN)" +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}') unset AUTHOR_TESTING make test %files +%license LICENSE %doc api.txt Changes example_pl README %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Mon Aug 21 2023 Jitka Plesnikova - 2.1700-1 - 2.1700 bump (rhbz#2231059) +- Package tests * Thu Jul 20 2023 Fedora Release Engineering - 2.16-30 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_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..0f94b47 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-Authen-SASL +require: perl-Authen-SASL-tests +test: /usr/libexec/perl-Authen-SASL/test