#1 Package tests
Merged 3 years ago by jplesnik. Opened 3 years ago by jplesnik.
Unknown source rawhide  into  rawhide

file added
+1
@@ -0,0 +1,1 @@

+ 1

file added
+7
@@ -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}

file modified
+72 -2
@@ -14,7 +14,7 @@

  

  Name:           perl-IO-Compress

  Version:        2.102

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Read and write compressed data

  License:        GPL+ or Artistic

  URL:            https://metacpan.org/release/IO-Compress
@@ -54,6 +54,9 @@

  BuildRequires:  perl(File::Path)

  BuildRequires:  perl(lib)

  BuildRequires:  perl(threads::shared)

+ %if !%{defined perl_bootstrap}

+ BuildRequires:  perl(Test::More)

+ %endif

  %if %{with perl_IO_Compress_enables_optional_test}

  # Optional Tests

  BuildRequires:  perl(bytes)
@@ -63,7 +66,6 @@

  # Dual-lived module needs building early in the boot process

  %if !%{defined perl_bootstrap}

  BuildRequires:  perl(Test::NoWarnings)

- BuildRequires:  perl(Test::Pod) >= 1.00

  %endif

  %endif

  # Runtime
@@ -80,6 +82,16 @@

  Obsoletes:      perl-IO-Compress-Zlib < %{version}-%{release}

  Provides:       perl-IO-Compress-Zlib = %{version}-%{release}

  

+ # Filter modules bundled for tests

+ %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(CompTestUtils\\)

+ %global __requires_exclude %{__requires_exclude}|^perl\\(.*\.pl)\s*$

+ %if %{defined perl_bootstrap}

+ %global __requires_exclude %{__requires_exclude}|^perl\\(Test::Builder)\s*$

+ %global __requires_exclude %{__requires_exclude}|^perl\\(Test::More)\s*$

+ %global __requires_exclude %{__requires_exclude}|^perl\\(Test::Simple)\s*$

+ %endif

+ %global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}

+ 

  %description

  This distribution provides a Perl interface to allow reading and writing of

  compressed data created with the zlib and bzip2 libraries.
@@ -94,6 +106,15 @@

  * IO-Compress-Bzip2

  * IO-Compress-Base

  

+ %package tests

+ Summary:        Tests for %{name}

+ Requires:       %{name} = %{?epoch:%{epoch}:}%{version}-%{release}

+ Requires:       perl-Test-Harness

+ 

+ %description tests

+ Tests from %{name}-%{version}. Execute them

+ with "%{_libexecdir}/%{name}/test".

+ 

  %prep

  %setup -q -n IO-Compress-%{version}

  
@@ -101,19 +122,62 @@

  chmod -c -x lib/IO/Uncompress/{Adapter/Identity,RawInflate}.pm

  find examples -type f -exec chmod -c -x {} \;

  

+ %if ! %{defined perl_bootstrap}

+ # Remove bundled Test::* modules

+ rm -rf t/Test

+ perl -i -ne 'print $_ unless m{^t/Test/}' MANIFEST

+ %endif

+ 

  # Fix shellbangs in examples

  perl -MConfig -pi -e 's|^#!/usr/local/bin/perl\b|$Config{startperl}|' examples/io/anycat \

          examples/io/bzip2/* examples/io/gzip/* examples/compress-zlib/*

  

+ # Help file to recognise the Perl scripts and normalize shebangs

+ for F in `find t -name *.t` `find t -name *.pl`; do

+     if head -1 "$F" | grep -q -e '^#!.*perl' ; then

+         perl -MConfig -pi -e 's|^#!.*perl\b|$Config{startperl}|' "$F"

+     else

+         perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F"

+     fi

+     chmod +x "$F"

+ done

+ 

+ # Remove release tests

+ rm t/999pod.t t/999meta-*.t

+ perl -i -ne 'print $_ unless m{^t/999pod\.t}' MANIFEST

+ perl -i -ne 'print $_ unless m{^t/999meta-.*\.t}' MANIFEST

+ 

  %build

  perl Makefile.PL NO_PACKLIST=1 NO_PERLLOCAL=1

  %{make_build}

  

  %install

  %{make_install} INSTALLDIRS=perl

+ 

+ # Install tests

+ mkdir -p %{buildroot}/%{_libexecdir}/%{name}

+ cp -a examples t %{buildroot}/%{_libexecdir}/%{name}

+ perl -i -pe "s{\"./bin/\"}{\"%{_bindir}\"}" %{buildroot}/%{_libexecdir}/%{name}/t/011-streamzip.t

+ cat > %{buildroot}/%{_libexecdir}/%{name}/test << 'EOF'

+ #!/bin/sh

+ set -e

+ # Lots of 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}/* ./

+ unset PERL_CORE

+ prove -I . -j "$(getconf _NPROCESSORS_ONLN)"

+ popd

+ rm -rf "$DIR"

+ EOF

+ chmod +x %{buildroot}/%{_libexecdir}/%{name}/test

+ 

  %{_fixperms} -c %{buildroot}

  

  %check

+ unset PERL_CORE

+ export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')

  # Build using "--without long_tests" to avoid very long tests

  # (full suite can take nearly an hour on an i7 920)

  make test COMPRESS_ZLIB_RUN_%{?with_long_tests:ALL}%{!?with_long_tests:MOST}=1
@@ -146,7 +210,13 @@

  %{_mandir}/man3/IO::Compress::*.3*

  %{_mandir}/man3/IO::Uncompress::*.3*

  

+ %files tests

+ %{_libexecdir}/%{name}

+ 

  %changelog

+ * Mon Mar 01 2021 Jitka Plesnikova <jplesnik@redhat.com> - 2.102-2

+ - Package tests

+ 

  * Sun Feb 28 2021 Paul Howarth <paul@city-fan.org> - 2.102-1

  - 2.102 bump

  

file added
+5
@@ -0,0 +1,5 @@

+ summary: Sanity tests

+ discover:

+     how: fmf

+ execute:

+     how: tmt

@@ -0,0 +1,4 @@

+ summary: Upstream tests

+ component: perl-IO-Compress

+ require: perl-IO-Compress-tests

+ test: /usr/libexec/perl-IO-Compress/test

no initial comment

Pull-Request has been merged by jplesnik

3 years ago