From 53bb8b4c4498e91bd7c64a533f8648f0c5709668 Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 8 Jan 2025 10:01:49 +0100 Subject: [PATCH 1/5] Data-Dumper: fix sortkeys.t test count for non-XS testing This is a follow-up to 67201d911f3228b285dfe8c2e7aa00aa090fc77b, which reduced the number of tests without adjusting the skip count. Previously, testing without XS available resulted in: t/sortkeys.t .................. Dubious, test returned 255 (wstat 65280, 0xff00) All 22 subtests passed (less 13 skipped subtests: 9 okay) ... /sortkeys.t (Wstat: 65280 (exited 255) Tests: 24 Failed: 2) Failed tests: 23-24 Non-zero exit status: 255 Parse errors: Bad plan. You planned 22 tests but ran 24. --- dist/Data-Dumper/t/sortkeys.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/Data-Dumper/t/sortkeys.t b/dist/Data-Dumper/t/sortkeys.t index e02106fed94d..779577e590a8 100644 --- a/dist/Data-Dumper/t/sortkeys.t +++ b/dist/Data-Dumper/t/sortkeys.t @@ -11,7 +11,7 @@ use Testing qw( _dumptostr ); run_tests_for_sortkeys(); SKIP: { - skip "XS version was unavailable, so we already ran with pure Perl", 13 + skip "XS version was unavailable, so we already ran with pure Perl", 11 if $Data::Dumper::Useperl; local $Data::Dumper::Useperl = 1; run_tests_for_sortkeys(); From c16e7d217281ececef2800b0793e271763671fae Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 8 Jan 2025 10:06:18 +0100 Subject: [PATCH 2/5] Data-Dumper: fix quotekeys.t test count for non-XS testing This is a follow-up to 5b50ddc0fecad7c18ba9a41a6996121a236a36f0, which added 4 tests without adjusting the skip count. Previously, testing without XS available resulted in: t/quotekeys.t ................. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 4/18 subtests (less 5 skipped subtests: 9 okay) ... t/quotekeys.t (Wstat: 65280 (exited 255) Tests: 14 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 18 tests but ran 14. --- dist/Data-Dumper/t/quotekeys.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/Data-Dumper/t/quotekeys.t b/dist/Data-Dumper/t/quotekeys.t index a4f647abe417..d1fcf05e062e 100644 --- a/dist/Data-Dumper/t/quotekeys.t +++ b/dist/Data-Dumper/t/quotekeys.t @@ -20,7 +20,7 @@ my $is_ascii = ord("A") == 65; run_tests_for_quotekeys(); SKIP: { - skip "XS version was unavailable, so we already ran with pure Perl", 5 + skip "XS version was unavailable, so we already ran with pure Perl", 9 if $Data::Dumper::Useperl; local $Data::Dumper::Useperl = 1; run_tests_for_quotekeys(); From cdeb4d9994bfdb0524c9be0afd5696adf032868e Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 8 Jan 2025 10:13:07 +0100 Subject: [PATCH 3/5] Data-Dumper: fix dumpperl.t for non-XS testing This is a follow-up to commit b5048e7b9abae986778038f1e36281c6175b17e1, which added 'Deparse' support to XS, and commit 9baac1a3613bd641a847683d7877b3cfab3244bc, which added 'Useqq' support to XS. There are no longer any configuration settings that implicitly force the use of the pure Perl implementation (outside of 'Useperl' itself). Previously, testing without XS available resulted in: t/dumpperl.t .................. 1/31 Undefined subroutine &Data::Dumper::Dumpxs called at .../dist/Data-Dumper/blib/lib/Data/Dumper.pm line 213. # Looks like your test exited with 255 just after 10. t/dumpperl.t .................. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 21/31 subtests ... t/dumpperl.t (Wstat: 65280 (exited 255) Tests: 10 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 31 tests but ran 10. --- dist/Data-Dumper/t/dumpperl.t | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/dist/Data-Dumper/t/dumpperl.t b/dist/Data-Dumper/t/dumpperl.t index 6772446149cd..20012e697bde 100644 --- a/dist/Data-Dumper/t/dumpperl.t +++ b/dist/Data-Dumper/t/dumpperl.t @@ -6,7 +6,7 @@ use warnings; use Carp; use Data::Dumper; -use Test::More tests => 31; +use Test::More tests => 11; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -20,23 +20,7 @@ $Data::Dumper::Indent=1; run_tests_for_pure_perl_implementations(); } -{ - local $Data::Dumper::Useperl=0; - local $Data::Dumper::Useqq=1; - local $Data::Dumper::Deparse=0; - note('$Data::Dumper::Useqq => 1'); - run_tests_for_pure_perl_implementations(); -} - -{ - local $Data::Dumper::Useperl=0; - local $Data::Dumper::Useqq=0; - local $Data::Dumper::Deparse=1; - note('$Data::Dumper::Deparse => 1'); - run_tests_for_pure_perl_implementations(); -} - - + sub run_tests_for_pure_perl_implementations { From 8581e6dba57dad82e32a6fac4b6009dcc3661ac3 Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 8 Jan 2025 10:25:23 +0100 Subject: [PATCH 4/5] Data-Dumper: fix deparse.t for non-XS testing This is a follow-up to b5048e7b9abae986778038f1e36281c6175b17e1, which added 'Deparse' support to XS and made both XS and pure Perl testing mandatory. The other test files treat XS as optional, so this patch follows that pattern. (If we decide that the XS part of Data::Dumper is not optional, we should change all the other test files for consistency.) Previously, testing without XS available resulted in: t/deparse.t ................... Undefined subroutine &Data::Dumper::Dumpxs called at .../dist/Data-Dumper/blib/lib/Data/Dumper.pm line 213. # Looks like your test exited with 255 before it could output anything. t/deparse.t ................... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 16/16 subtests ... t/deparse.t (Wstat: 65280 (exited 255) Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 16 tests but ran 0. --- dist/Data-Dumper/t/deparse.t | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dist/Data-Dumper/t/deparse.t b/dist/Data-Dumper/t/deparse.t index d734b2365536..80f11f3c7651 100644 --- a/dist/Data-Dumper/t/deparse.t +++ b/dist/Data-Dumper/t/deparse.t @@ -5,7 +5,7 @@ use strict; use warnings; use Data::Dumper; -use Test::More tests => 16; +use Test::More tests => 16; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -14,11 +14,18 @@ use Testing qw( _dumptostr ); note("\$Data::Dumper::Deparse and Deparse()"); -for my $useperl (0, 1) { - local $Data::Dumper::Useperl = $useperl; +run_tests_for_deparse(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 8 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_deparse(); +} + +sub run_tests_for_deparse { + my $useperl = $Data::Dumper::Useperl ? 1 : 0; my ($obj, %dumps, $deparse, $starting); - use strict; my $struct = { foo => "bar\nbaz", quux => sub { "fleem" } }; $obj = Data::Dumper->new( [ $struct ] ); $dumps{'noprev'} = _dumptostr($obj); From 519a3eb350f5a7ebcad9de34f4c5f95359f4c371 Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 8 Jan 2025 10:33:57 +0100 Subject: [PATCH 5/5] Data-Dumper: fix bugs.t for non-XS testing This is a follow-up to 7d3a730ee869d89a6f40963c80aaa0e044b0c7d2, which fixed an out-of-bounds write in Dumpxs when passed invalid UTF-8. This test does not apply to the pure Perl implementation (which detects the invalid input and cleanly throws an error instead). Previously, testing without XS available would result in: t/bugs.t ...................... 1/24 Malformed UTF-8 character (fatal) at .../dist/Data-Dumper/blib/lib/Data/Dumper.pm line 587. # Looks like your test exited with 2 just after 6. t/bugs.t ...................... Dubious, test returned 2 (wstat 512, 0x200) Failed 18/24 subtests ... t/bugs.t (Wstat: 512 (exited 2) Tests: 6 Failed: 0) Non-zero exit status: 2 Parse errors: Bad plan. You planned 24 tests but ran 6. --- dist/Data-Dumper/t/bugs.t | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/Data-Dumper/t/bugs.t b/dist/Data-Dumper/t/bugs.t index b9a34ebc4bb2..3c624dc9f9f1 100644 --- a/dist/Data-Dumper/t/bugs.t +++ b/dist/Data-Dumper/t/bugs.t @@ -83,6 +83,7 @@ SKIP: { # writing out of bounds with malformed utf8 SKIP: { + skip("No XS available", 1) if !defined &Data::Dumper::Dumpxs; eval { require Encode }; skip("Encode not available", 1) if $@; local $^W=1;