Skip Menu |

This queue is for tickets about the JSON-PP CPAN distribution.

Report information
The Basics
Id: 83421
Status: resolved
Priority: 0/
Queue: JSON-PP

People
Owner: Nobody in particular
Requestors: demerphq [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: JSON-PP fails test when hash iterator randomization is enabled.
JSON-PP occasionally fails test when hash iterator randomization is enabled. The solution is to enabled canonical mode in the failing test. We plan to enable this in 5.18. The attached patch from my perl.git branch yves/hv_h_split fixes the bug, and tweaks the eval logic to check the return code and die with an appropriate message if the eval fails. I have marked this patch as important as it is a blocker for 5.18 release.
Subject: 0001-Fix-tests-that-fail-due-to-hash-traversal-randomizat.patch
From 3de8f6566a419504551f35063c2bfeb560ac019b Mon Sep 17 00:00:00 2001 From: Yves Orton <demerphq@gmail.com> Date: Mon, 18 Feb 2013 06:37:29 +0100 Subject: [PATCH] Fix tests that fail due to hash traversal randomization One cannot assume two hashes with the same keys will have the the same key order. And after hash traversal randomization one can assume they WONT. --- cpan/JSON-PP/t/019_incr.t | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cpan/JSON-PP/t/019_incr.t b/cpan/JSON-PP/t/019_incr.t index c5fab96..dc84c55 100644 --- a/cpan/JSON-PP/t/019_incr.t +++ b/cpan/JSON-PP/t/019_incr.t @@ -13,11 +13,13 @@ use JSON::PP; if ( $] >= 5.006 ) { -eval <<'TEST'; +eval <<'TEST' or die "Failed to eval test code for version $]: $@"; sub splitter { my ($coder, $text) = @_; + $coder->canonical(1) if $] >= 5.017009; + for (0 .. length $text) { my $a = substr $text, 0, $_; my $b = substr $text, $_; @@ -27,7 +29,7 @@ sub splitter { my $data = $coder->incr_parse; ok ($data); - ok ($coder->encode ($data) eq $coder->encode ($coder->decode ($text)), "data"); + is ($coder->encode ($data), $coder->encode ($coder->decode ($text)), "data"); ok ($coder->incr_text =~ /^\s*$/, "tailws"); } } @@ -75,16 +77,15 @@ splitter +JSON::PP->new->allow_nonref, ' "5" '; ok ('[5]' eq $coder->encode (scalar $coder->incr_parse), "sparse3"); } - +1 TEST -print $@; } else { -eval <<'TEST'; +eval <<'TEST' or die "Failed to eval test code for version $]: $@"; my $incr_text; @@ -148,8 +149,6 @@ splitter +JSON::PP->new->allow_nonref, ' "5" '; TEST -print $@; - } # for 5.005 -- 1.7.5.4
From: demerphq [...] gmail.com
On Mon Feb 18 01:51:16 2013, demerphq@gmail.com wrote: Show quoted text
> > I have marked this patch as important as it is a blocker for 5.18 > release.
See also https://rt.perl.org/rt3/Ticket/Display.html?id=116825
I'm sorry for my late reply. I just released the new version on CPAN. Thanks, --- makamaka On 2013-2月-18 月 01:51:16, demerphq@gmail.com wrote: Show quoted text
> JSON-PP occasionally fails test when hash iterator randomization is > enabled. > > The solution is to enabled canonical mode in the failing test. > > We plan to enable this in 5.18. > > The attached patch from my perl.git branch yves/hv_h_split fixes the bug, > and tweaks the eval logic to check the return code and die with an > appropriate message if the eval fails. > > I have marked this patch as important as it is a blocker for 5.18 > release. >