[perl-Test-Unit] Fix random test failures with perl 5.18

Petr Pisar ppisar at fedoraproject.org
Fri Jun 20 12:44:10 UTC 2014


commit f94b619270fb511abb429ce0987077600e04e5c9
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Jun 20 14:42:23 2014 +0200

    Fix random test failures with perl 5.18

 ...family-differences-in-the-AssertTest-test.patch |   72 ++++++++++++++++++++
 perl-Test-Unit.spec                                |    8 ++-
 2 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/Test-Unit-0.25-Accept-all-family-differences-in-the-AssertTest-test.patch b/Test-Unit-0.25-Accept-all-family-differences-in-the-AssertTest-test.patch
new file mode 100644
index 0000000..22ddffc
--- /dev/null
+++ b/Test-Unit-0.25-Accept-all-family-differences-in-the-AssertTest-test.patch
@@ -0,0 +1,72 @@
+From f34895d59eb4e8d5c266a14e0e7ecba4bf6bb35c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Fri, 20 Jun 2014 14:33:02 +0200
+Subject: [PATCH] Accept all family differences in the AssertTest test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The t/assert.t's AssertTest test failed randomly depending on order of
+hash key traversal:
+
+not ok ERROR test_assert_deep_equals
+t/tlib/AssertTest.pm:500 - test_assert_deep_equals(Class::Inner::__A20)
+Expected Test::Unit::Failure `(?^mx:^Structures\ begin\ differing\ at: $ \n
+        \S*\s* \$a .* = .* (?-x:HASH)      .* $ \n
+        \S*\s* \$b .* = .* (?-x:not exist))', got `Structures begin differing at:
+  $a->{john}{spouse}{spouse}{name} = 'John Doe'
+  $b->{john}{spouse}{spouse}{name} = 'Baby Doll'
+'
+
+This fixes the test to accept the difference in spouse's name.
+
+CPAN RT#87017
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ t/tlib/AssertTest.pm | 22 +++++++++++++++++-----
+ 1 file changed, 17 insertions(+), 5 deletions(-)
+
+diff --git a/t/tlib/AssertTest.pm b/t/tlib/AssertTest.pm
+index 7310874..42fa860 100644
+--- a/t/tlib/AssertTest.pm
++++ b/t/tlib/AssertTest.pm
+@@ -404,10 +404,22 @@ sub test_assert_deep_equals {
+     );
+ 
+     my $differ = sub {
+-        my ($a, $b) = @_;
+-        qr/^Structures\ begin\ differing\ at: $ \n
+-        \S*\s* \$a .* = .* (?-x:$a)      .* $ \n
+-        \S*\s* \$b .* = .* (?-x:$b)/mx;
++        my ($a, $b, $c, $d) = @_;
++        if (defined $d) {
++	    qr/^Structures\ begin\ differing\ at: $ \n
++	    (?:
++                \S*\s* \$a .* = .* (?-x:$a)      .* $ \n
++                \S*\s* \$b .* = .* (?-x:$b)
++	    |
++                \S*\s* \$a .* = .* (?-x:$c)      .* $ \n
++                \S*\s* \$b .* = .* (?-x:$d)
++	    )
++	    /mx,
++        } else {
++	    qr/^Structures\ begin\ differing\ at: $ \n
++	    \S*\s* \$a .* = .* (?-x:$a)      .* $ \n
++	    \S*\s* \$b .* = .* (?-x:$b)/mx;
++        }
+     };
+ 
+     my %families; # key=test-purpose, value=assorted circular structures
+@@ -481,7 +493,7 @@ sub test_assert_deep_equals {
+                  },
+              }
+          ],
+-	 $differ->( 'HASH', 'not exist') => [$families{orig}, $families{bad_copy}], # test may be fragile due to recursion ordering?
++	 $differ->( 'HASH', 'not exist', 'John Doe', 'Baby Doll') => [$families{orig}, $families{bad_copy}], # test may be fragile due to recursion ordering?
+ 	 $differ->("'3'", "'5'") => [ [ \$H, 3 ], [ \$H2, 5 ] ],
+ 	 $differ->("'hello'", "'goodbye'") => [ { world => \$H }, { world => \$G } ],
+ 	 $differ->("'hello'", "'goodbye'") => [ [ \$H, "world" ], [ \$G, "world" ] ],
+-- 
+1.9.3
+
diff --git a/perl-Test-Unit.spec b/perl-Test-Unit.spec
index bd5f9b2..322c115 100644
--- a/perl-Test-Unit.spec
+++ b/perl-Test-Unit.spec
@@ -1,6 +1,6 @@
 Name:           perl-Test-Unit
 Version:        0.25
-Release:        18%{?dist}
+Release:        19%{?dist}
 Summary:        The PerlUnit testing framework
 
 Group:          Development/Libraries
@@ -11,6 +11,8 @@ Source0:        http://search.cpan.org/CPAN/authors/id/M/MC/MCAST/Test-Unit-%{ve
 Patch0:         tests5.14.patch
 # https://rt.cpan.org/Public/Bug/Display.html?id=77779
 Patch1:         perl5.16.patch
+# Fix random test failures with perl 5.18, bug #1104134, CPAN RT#87017
+Patch2:         Test-Unit-0.25-Accept-all-family-differences-in-the-AssertTest-test.patch
 
 BuildArch:      noarch
 BuildRequires:  perl(ExtUtils::MakeMaker)
@@ -43,6 +45,7 @@ Gamma.
 %setup -q -n Test-Unit-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 sed -i 's/\r//' examples/Experimental/Sample.pm
 chmod a+x TkTestRunner.pl TestRunner.pl
 
@@ -69,6 +72,9 @@ make test
 
 
 %changelog
+* Fri Jun 20 2014 Petr Pisar <ppisar at redhat.com> - 0.25-19
+- Fix random test failures with perl 5.18 (bug #1104134)
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.25-18
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list