[perl-RPC-XML] Adjust tests for perl 5.18

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 6f1e4db9bd0c078d470f34a455aaa8a7c98b4d1a
Author: Petr Písař <ppisar@xxxxxxxxxx>
Date:   Thu Aug 1 10:43:49 2013 +0200

    Adjust tests for perl 5.18

 RPC-XML-0.77-hash_key_ordering.patch |  121 ++++++++++++++++++++++++++++++++++
 perl-RPC-XML.spec                    |    5 ++
 2 files changed, 126 insertions(+), 0 deletions(-)
---
diff --git a/RPC-XML-0.77-hash_key_ordering.patch b/RPC-XML-0.77-hash_key_ordering.patch
new file mode 100644
index 0000000..b6c3757
--- /dev/null
+++ b/RPC-XML-0.77-hash_key_ordering.patch
@@ -0,0 +1,121 @@
+From f6cee931344ffa6a757eb526b02de33c30b672f8 Mon Sep 17 00:00:00 2001
+From: "Randy J. Ray" <rjray@xxxxxxxxxxxxx>
+Date: Thu, 30 May 2013 19:46:42 -0700
+Subject: [PATCH 1/2] Force key-ordering in struct as_string and serialize. Was
+ getting some intermittent bug reports of failures in t/15_serialize.t that
+ amounted to the keys in a fault struct not being in consistent order.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+
+Signed-off-by: Petr Písař <ppisar@xxxxxxxxxx>
+---
+ lib/RPC/XML.pm | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/RPC/XML.pm b/lib/RPC/XML.pm
+index e6099a7..59e6963 100644
+--- a/lib/RPC/XML.pm
++++ b/lib/RPC/XML.pm
+@@ -844,7 +844,7 @@ sub as_string
+                     ("<member><name>$_</name><value>",
+                      $clean{$_},
+                      '</value></member>')
+-                } (keys %clean)),
++                } (sort keys %clean)),
+                 '</struct>';
+ }
+ 
+@@ -856,7 +856,7 @@ sub serialize
+     my $key;
+ 
+     print {$fh} '<struct>';
+-    for (keys %{$self})
++    for (sort keys %{$self})
+     {
+         ($key = $_) =~ s/$RPC::XML::XMLRE/$RPC::XML::XMLMAP{$1}/ge;
+         utf8::downgrade($key);
+@@ -1096,7 +1096,7 @@ sub length ## no critic (ProhibitBuiltinHomonyms)
+             my $cnt = 0;
+ 
+             $self->{fh_pos} = tell $self->{value_fh};
+-            seek$self->{value_fh}, 0, 0;
++            seek $self->{value_fh}, 0, 0;
+             while ($cnt = read $self->{value_fh}, $buf, 60*57)
+             {
+                 $len += length(MIME::Base64::encode_base64($buf, q{}));
+-- 
+1.8.1.4
+
+
+From 33617691326a0bc01efea624e05c65047f1c6154 Mon Sep 17 00:00:00 2001
+From: "Randy J. Ray" <rjray@xxxxxxxxxxxxx>
+Date: Wed, 5 Jun 2013 21:13:38 -0700
+Subject: [PATCH 2/2] Undo the previous change and fix the test. The previous
+ change didn't feel right, so this rolls it back and fixes the problem at the
+ level of the test, instead.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+
+Signed-off-by: Petr Písař <ppisar@xxxxxxxxxx>
+---
+ lib/RPC/XML.pm   |  4 ++--
+ t/15_serialize.t | 17 ++++++++++++++++-
+ 2 files changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/lib/RPC/XML.pm b/lib/RPC/XML.pm
+index 59e6963..4d4eae1 100644
+--- a/lib/RPC/XML.pm
++++ b/lib/RPC/XML.pm
+@@ -844,7 +844,7 @@ sub as_string
+                     ("<member><name>$_</name><value>",
+                      $clean{$_},
+                      '</value></member>')
+-                } (sort keys %clean)),
++                } (keys %clean)),
+                 '</struct>';
+ }
+ 
+@@ -856,7 +856,7 @@ sub serialize
+     my $key;
+ 
+     print {$fh} '<struct>';
+-    for (sort keys %{$self})
++    for (keys %{$self})
+     {
+         ($key = $_) =~ s/$RPC::XML::XMLRE/$RPC::XML::XMLMAP{$1}/ge;
+         utf8::downgrade($key);
+diff --git a/t/15_serialize.t b/t/15_serialize.t
+index ad0d64d..f894f49 100644
+--- a/t/15_serialize.t
++++ b/t/15_serialize.t
+@@ -96,7 +96,22 @@ seek $ofh, 0, 0;
+ $data = '';
+ read $ofh, $data, -s $ofh;
+ 
+-is($data, $faux_res->as_string, 'Fault-response content is correct');
++# There have been some changes to how Perl handles iteration of hash keys.
++# As a result, this test has started failing a lot because of the order of
++# keys when serialized doesn't match the order of keys from as_string(). So
++# to get around this, just compare it to both variations that can occur.
++my $variant1 = '<?xml version="1.0" encoding="us-ascii"?><methodResponse>' .
++    '<fault><value><struct><member><name>faultString</name><value><string>' .
++    'test</string></value></member><member><name>faultCode</name><value>' .
++    '<int>1</int></value></member></struct></value></fault></methodResponse>';
++my $variant2 = '<?xml version="1.0" encoding="us-ascii"?><methodResponse>' .
++    '<fault><value><struct><member><name>faultCode</name><value><int>1</int>' .
++    '</value></member><member><name>faultString</name><value><string>test' .
++    '</string></value></member></struct></value></fault></methodResponse>';
++ok(
++    ($data eq $variant1) || ($data eq $variant2),
++    'Fault-response content is correct'
++);
+ 
+ close $ofh;
+ unlink $tmpfile;
+-- 
+1.8.1.4
+
diff --git a/perl-RPC-XML.spec b/perl-RPC-XML.spec
index e50ee22..dd10f52 100644
--- a/perl-RPC-XML.spec
+++ b/perl-RPC-XML.spec
@@ -9,6 +9,9 @@ License: Artistic 2.0 or LGPLv2
 URL:     http://search.cpan.org/dist/%{cpan_name}/
 Source0:   http://search.cpan.org/CPAN/authors/id/R/RJ/RJRAY/%{cpan_name}-%{version}.tar.gz
 Source1:   README.license
+# Adjust tests for perl 5.18, CPAN RT#86187,
+# from <https://github.com/rjray/rpc-xml.git>
+Patch0:    RPC-XML-0.77-hash_key_ordering.patch
 BuildArch: noarch
 
 BuildRequires: perl(Cwd)
@@ -88,6 +91,7 @@ running RPC::XML under mod_perl.
 
 %prep
 %setup -qn %{cpan_name}-%{version}
+%patch0 -p1
 cp -p %{SOURCE1} .
 
 %build
@@ -117,6 +121,7 @@ make test
 %changelog
 * Thu Aug 01 2013 Petr Pisar <ppisar@xxxxxxxxxx> - 0.77-3
 - Perl 5.18 rebuild
+- Adjust tests for perl 5.18 (CPAN RT#86187)
 
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng@xxxxxxxxxxxxxxxxxxxxxxx> - 0.77-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_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





[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux