commit 750e85b003e173a797f9d088be20114208cf1666 Author: Paul Howarth <paul@xxxxxxxxxxxx> Date: Mon Aug 12 12:49:25 2013 +0100 Fix FTBFS due to hash randomization (#992724) - Address test failures due to hash order randomization (CPAN RT#81552) - Don't need to remove empty directories from the buildroot - Drop %defattr, redundant since rpm 4.4 TAP-Formatter-JUnit-0.09-hashorder.patch | 100 ++++++++++++++++++++++++++++++ perl-TAP-Formatter-JUnit.spec | 16 ++++- 2 files changed, 112 insertions(+), 4 deletions(-) --- diff --git a/TAP-Formatter-JUnit-0.09-hashorder.patch b/TAP-Formatter-JUnit-0.09-hashorder.patch new file mode 100644 index 0000000..895c931 --- /dev/null +++ b/TAP-Formatter-JUnit-0.09-hashorder.patch @@ -0,0 +1,100 @@ +This patch addresses https://rt.cpan.org/Public/Bug/Display.html?id=81552 + +Strictly speaking, this is a test suite issue since the generated XML +remains valid, but some attributes are output in a different order than +expected by the test suite. + +However, since I can't think of any simple way to make the tests more +forgiving of the order of the attributes in the XML, I've tweaked the +code to use Tie::IxHash to ensure that the generated XML has the +attributes in the same order as the tests expect them. + +--- lib/TAP/Formatter/JUnit/Session.pm ++++ lib/TAP/Formatter/JUnit/Session.pm +@@ -10,6 +10,7 @@ + use File::Path qw(mkpath); + use IO::File; + use TAP::Formatter::JUnit::Result; ++use Tie::IxHash; + + has 'testcases' => ( + is => 'rw', +@@ -104,10 +105,12 @@ + if ($timer_enabled) { + unless ($result->is_test) { + my $duration = $result->time - $t_start; +- my $case = $xml->testcase( { +- 'name' => _squeaky_clean('(init)'), ++ tie my %case_attrs, 'Tie::IxHash'; ++ %case_attrs = ( + 'time' => $duration, +- } ); ++ 'name' => _squeaky_clean('(init)'), ++ ); ++ my $case = $xml->testcase( \%case_attrs ); + $self->add_testcase($case); + $t_last_test = $result->time; + } +@@ -136,22 +139,23 @@ + if ($bogosity) { + my $cdata = $self->_cdata($content); + my $level = $bogosity->{level}; +- $failure = $xml->$level( { ++ tie my %error_attrs, 'Tie::IxHash'; ++ %error_attrs = ( + type => $bogosity->{type}, + message => $bogosity->{message}, +- }, $cdata ); ++ ); ++ $failure = $xml->$level( \%error_attrs, $cdata ); + } + + # add this test to the XML stream +- my $case = $xml->testcase( +- { +- 'name' => _get_testcase_name($result), ++ tie my %case_attrs, 'Tie::IxHash'; ++ %case_attrs = ( + ( + $timer_enabled ? ('time' => $duration) : () + ), +- }, +- $failure, ++ 'name' => _get_testcase_name($result), + ); ++ my $case = $xml->testcase( \%case_attrs, $failure, ); + $self->add_testcase($case); + + # update time of last test seen +@@ -162,10 +166,12 @@ + # track time for teardown, if needed + if ($timer_enabled) { + my $duration = $self->parser->end_time - $queue->[-1]->time; +- my $case = $xml->testcase( { +- 'name' => _squeaky_clean('(teardown)'), ++ tie my %case_attrs, 'Tie::IxHash'; ++ %case_attrs = ( + 'time' => $duration, +- } ); ++ 'name' => _squeaky_clean('(teardown)'), ++ ); ++ my $case = $xml->testcase( \%case_attrs ); + $self->add_testcase($case); + } + +@@ -225,11 +231,12 @@ + } + + my @tests = @{$self->testcases()}; +- my %attrs = ( +- 'name' => _get_testsuite_name($self), +- 'tests' => $testsrun, ++ tie my %attrs, 'Tie::IxHash'; ++ %attrs = ( + 'failures' => $failures, + 'errors' => $num_errors, ++ 'tests' => $testsrun, ++ 'name' => _get_testsuite_name($self), + ( + $timer_enabled ? ('time' => $time) : () + ), diff --git a/perl-TAP-Formatter-JUnit.spec b/perl-TAP-Formatter-JUnit.spec index 899147a..b02da10 100644 --- a/perl-TAP-Formatter-JUnit.spec +++ b/perl-TAP-Formatter-JUnit.spec @@ -1,11 +1,12 @@ Name: perl-TAP-Formatter-JUnit Version: 0.09 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Harness output delegate for JUnit output License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/TAP-Formatter-JUnit/ Source0: http://www.cpan.org/modules/by-module/TAP/TAP-Formatter-JUnit-%{version}.tar.gz +Patch0: TAP-Formatter-JUnit-0.09-hashorder.patch BuildArch: noarch BuildRequires: perl(Moose) BuildRequires: perl(MooseX::NonMoose) @@ -13,6 +14,7 @@ BuildRequires: perl(File::Slurp) BuildRequires: perl(IO::Scalar) BuildRequires: perl(Module::Build) BuildRequires: perl(TAP::Harness) >= 3.12 +BuildRequires: perl(Tie::IxHash) BuildRequires: perl(Test::Differences) BuildRequires: perl(Test::More) BuildRequires: perl(XML::Generator) @@ -25,21 +27,22 @@ for Test::Harness. %prep %setup -q -n TAP-Formatter-JUnit-%{version} +# Address test failures due to hash order randomization +# https://rt.cpan.org/Public/Bug/Display.html?id=81552 +%patch0 + %build %{__perl} Build.PL installdirs=vendor ./Build %install ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 -find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; - %{_fixperms} $RPM_BUILD_ROOT/* %check ./Build test %files -%defattr(-,root,root,-) %doc Changes README %{_bindir}/tap2junit %{perl_vendorlib}/* @@ -47,6 +50,11 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %{_mandir}/man3/* %changelog +* Mon Aug 12 2013 Paul Howarth <paul@xxxxxxxxxxxx> - 0.09-7 +- Address test failures due to hash order randomization (CPAN RT#81552) +- Don't need to remove empty directories from the buildroot +- Drop %%defattr, redundant since rpm 4.4 + * Sun Aug 04 2013 Petr Pisar <ppisar@xxxxxxxxxx> - 0.09-6 - Perl 5.18 rebuild -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list perl-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/perl-devel