Control additional tests with build conditions

This commit is contained in:
Petr Písař 2017-12-07 14:35:28 +01:00
parent b41e3af16a
commit 9d3185a0dc

View File

@ -1,5 +1,17 @@
# We need to patch the test suite if we have an old version of Test::More # We need to patch the test suite if we have an old version of Test::More
%global old_test_more %(perl -MTest::More -e 'print (($Test::More::VERSION < 0.88) ? 1 : 0);' 2>/dev/null || echo 0) %global old_test_more %(perl -MTest::More -e 'print (($Test::More::VERSION < 0.88) ? 1 : 0);' 2>/dev/null || echo 0)
# Run extra test
%if ! (0%{?rhel})
%bcond_without perl_Package_Stash_enables_extra_test
%else
%bcond_with perl_Package_Stash_enables_extra_test
%endif
# Run optional test
%if ! (0%{?rhel})
%bcond_without perl_Package_Stash_enables_optional_test
%else
%bcond_with perl_Package_Stash_enables_optional_test
%endif
Name: perl-Package-Stash Name: perl-Package-Stash
Version: 0.37 Version: 0.37
@ -39,10 +51,12 @@ BuildRequires: perl(lib)
BuildRequires: perl(Test::Fatal) BuildRequires: perl(Test::Fatal)
BuildRequires: perl(Test::More) BuildRequires: perl(Test::More)
BuildRequires: perl(Test::Requires) BuildRequires: perl(Test::Requires)
%if ! (0%{?rhel}) %if %{with perl_Package_Stash_enables_optional_test}
# Optional Tests # Optional Tests
BuildRequires: perl(Package::Anon) BuildRequires: perl(Package::Anon)
BuildRequires: perl(Variable::Magic) BuildRequires: perl(Variable::Magic)
%endif
%if %{with perl_Package_Stash_enables_extra_test}
# Extra Tests # Extra Tests
BuildRequires: perl(Pod::Coverage::TrustPod) BuildRequires: perl(Pod::Coverage::TrustPod)
BuildRequires: perl(Test::EOL) BuildRequires: perl(Test::EOL)
@ -84,7 +98,7 @@ find %{buildroot} -type f -name .packlist -exec rm -f {} \;
%check %check
make test make test
# Extra Tests: Pod Coverage test fails due to lack of POD for Package::Stash::Conflicts # Extra Tests: Pod Coverage test fails due to lack of POD for Package::Stash::Conflicts
%if ! (0%{?rhel}) %if %{with perl_Package_Stash_enables_extra_test}
make test TEST_FILES="$(echo $(find xt/ -name '*.t' | grep -v pod-coverage))" make test TEST_FILES="$(echo $(find xt/ -name '*.t' | grep -v pod-coverage))"
%endif %endif