Skip to content

Commit

Permalink
rt74170: test case that triggered the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Father Chrysostomos authored and tonycoz committed Sep 6, 2010
1 parent e3ec229 commit fe64260
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -2638,6 +2638,7 @@ dist/Data-Dumper/t/freezer.t See if $Data::Dumper::Freezer works
dist/Data-Dumper/Todo Data pretty printer, futures
dist/Data-Dumper/t/overload.t See if Data::Dumper works for overloaded data
dist/Data-Dumper/t/pair.t See if Data::Dumper pair separator works
dist/Data-Dumper/t/perl-74170.t Regression test for stack reallocation
dist/Data-Dumper/t/terse.t See if Data::Dumper terse option works
dist/ExtUtils-Install/Changes ExtUtils-Install change log
dist/ExtUtils-Install/lib/ExtUtils/Installed.pm Information on installed extensions
Expand Down
11 changes: 10 additions & 1 deletion dist/Data-Dumper/t/dumper.t
Expand Up @@ -83,7 +83,7 @@ sub SKIP_TEST {
$Data::Dumper::Useperl = 1;
if (defined &Data::Dumper::Dumpxs) {
print "### XS extension loaded, will run XS tests\n";
$TMAX = 363; $XS = 1;
$TMAX = 366; $XS = 1;
}
else {
print "### XS extensions not loaded, will NOT run XS tests\n";
Expand Down Expand Up @@ -1429,4 +1429,13 @@ EOT
TEST q(Data::Dumper->Dumpxs([\@foo])) if $XS;
}

############# 364
# Make sure $obj->Dumpxs returns the right thing in list context. This was
# broken by the initial attempt to fix [perl #74170].
$WANT = <<'EOT';
#$VAR1 = [];
EOT
TEST q(join " ", new Data::Dumper [[]],[] =>->Dumpxs),
'$obj->Dumpxs in list context'
if $XS;

143 changes: 143 additions & 0 deletions dist/Data-Dumper/t/perl-74170.t
@@ -0,0 +1,143 @@
#!perl -X
#
# Regression test for [perl #74170] (missing SPAGAIN after DD_Dump(...)):
# Since it’s so large, it gets its own file.

BEGIN {
require Config; import Config;
no warnings 'once';
if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
print "1..0 # Skip: Data::Dumper was not built\n";
exit 0;
}
}

use strict;
use Test::More tests => 1;
use Data::Dumper;

our %repos = ();
&real_life_setup();

$Data::Dumper::Indent = 1;
# A custom sort sub is necessary for reproducing the bug, as this is where
# the stack gets reallocated.
$Data::Dumper::Sortkeys = sub { return [ reverse sort keys %{$_[0]} ]; }
unless exists $ENV{NO_SORT_SUB};

ok +Data::Dumper->Dumpxs([\%repos], [qw(*repos)]);

sub real_life_setup {
# set up the %repos hash in a manner that reflects a real run of
# gitolite's "compiler" script:
# Yes, all this is necessary to get the stack in such a state that the
# custom sort sub will trigger a reallocation.
push @{ $repos{''}{'@all'} }, ();
push @{ $repos{''}{'guser86'} }, ();
push @{ $repos{''}{'guser87'} }, ();
push @{ $repos{''}{'user88'} }, ();
push @{ $repos{''}{'grussell'} }, ();
push @{ $repos{''}{'guser0'} }, ();
push @{ $repos{''}{'guser1'} }, ();
push @{ $repos{''}{'guser10'} }, ();
push @{ $repos{''}{'guser11'} }, ();
push @{ $repos{''}{'guser12'} }, ();
push @{ $repos{''}{'guser13'} }, ();
push @{ $repos{''}{'guser14'} }, ();
push @{ $repos{''}{'guser15'} }, ();
push @{ $repos{''}{'guser16'} }, ();
push @{ $repos{''}{'guser17'} }, ();
push @{ $repos{''}{'guser18'} }, ();
push @{ $repos{''}{'guser19'} }, ();
push @{ $repos{''}{'guser2'} }, ();
push @{ $repos{''}{'guser20'} }, ();
push @{ $repos{''}{'guser21'} }, ();
push @{ $repos{''}{'guser22'} }, ();
push @{ $repos{''}{'guser23'} }, ();
push @{ $repos{''}{'guser24'} }, ();
push @{ $repos{''}{'guser25'} }, ();
push @{ $repos{''}{'guser26'} }, ();
push @{ $repos{''}{'guser27'} }, ();
push @{ $repos{''}{'guser28'} }, ();
push @{ $repos{''}{'guser29'} }, ();
push @{ $repos{''}{'guser3'} }, ();
push @{ $repos{''}{'guser30'} }, ();
push @{ $repos{''}{'guser31'} }, ();
push @{ $repos{''}{'guser32'} }, ();
push @{ $repos{''}{'guser33'} }, ();
push @{ $repos{''}{'guser34'} }, ();
push @{ $repos{''}{'guser35'} }, ();
push @{ $repos{''}{'guser36'} }, ();
push @{ $repos{''}{'guser37'} }, ();
push @{ $repos{''}{'guser38'} }, ();
push @{ $repos{''}{'guser39'} }, ();
push @{ $repos{''}{'guser4'} }, ();
push @{ $repos{''}{'guser40'} }, ();
push @{ $repos{''}{'guser41'} }, ();
push @{ $repos{''}{'guser42'} }, ();
push @{ $repos{''}{'guser43'} }, ();
push @{ $repos{''}{'guser44'} }, ();
push @{ $repos{''}{'guser45'} }, ();
push @{ $repos{''}{'guser46'} }, ();
push @{ $repos{''}{'guser47'} }, ();
push @{ $repos{''}{'guser48'} }, ();
push @{ $repos{''}{'guser49'} }, ();
push @{ $repos{''}{'guser5'} }, ();
push @{ $repos{''}{'guser50'} }, ();
push @{ $repos{''}{'guser51'} }, ();
push @{ $repos{''}{'guser52'} }, ();
push @{ $repos{''}{'guser53'} }, ();
push @{ $repos{''}{'guser54'} }, ();
push @{ $repos{''}{'guser55'} }, ();
push @{ $repos{''}{'guser56'} }, ();
push @{ $repos{''}{'guser57'} }, ();
push @{ $repos{''}{'guser58'} }, ();
push @{ $repos{''}{'guser59'} }, ();
push @{ $repos{''}{'guser6'} }, ();
push @{ $repos{''}{'guser60'} }, ();
push @{ $repos{''}{'guser61'} }, ();
push @{ $repos{''}{'guser62'} }, ();
push @{ $repos{''}{'guser63'} }, ();
push @{ $repos{''}{'guser64'} }, ();
push @{ $repos{''}{'guser65'} }, ();
push @{ $repos{''}{'guser66'} }, ();
push @{ $repos{''}{'guser67'} }, ();
push @{ $repos{''}{'guser68'} }, ();
push @{ $repos{''}{'guser69'} }, ();
push @{ $repos{''}{'guser7'} }, ();
push @{ $repos{''}{'guser70'} }, ();
push @{ $repos{''}{'guser71'} }, ();
push @{ $repos{''}{'guser72'} }, ();
push @{ $repos{''}{'guser73'} }, ();
push @{ $repos{''}{'guser74'} }, ();
push @{ $repos{''}{'guser75'} }, ();
push @{ $repos{''}{'guser76'} }, ();
push @{ $repos{''}{'guser77'} }, ();
push @{ $repos{''}{'guser78'} }, ();
push @{ $repos{''}{'guser79'} }, ();
push @{ $repos{''}{'guser8'} }, ();
push @{ $repos{''}{'guser80'} }, ();
push @{ $repos{''}{'guser81'} }, ();
push @{ $repos{''}{'guser82'} }, ();
push @{ $repos{''}{'guser83'} }, ();
push @{ $repos{''}{'guser84'} }, ();
push @{ $repos{''}{'guser85'} }, ();
push @{ $repos{''}{'guser9'} }, ();
push @{ $repos{''}{'user1'} }, ();
push @{ $repos{''}{'user10'} }, ();
push @{ $repos{''}{'user11'} }, ();
push @{ $repos{''}{'user12'} }, ();
push @{ $repos{''}{'user13'} }, ();
push @{ $repos{''}{'user14'} }, ();
push @{ $repos{''}{'user15'} }, ();
push @{ $repos{''}{'user16'} }, ();
push @{ $repos{''}{'user2'} }, ();
push @{ $repos{''}{'user3'} }, ();
push @{ $repos{''}{'user4'} }, ();
push @{ $repos{''}{'user5'} }, ();
push @{ $repos{''}{'user6'} }, ();
push @{ $repos{''}{'user7'} }, ();
$repos{''}{R}{'user8'} = 1;
$repos{''}{W}{'user8'} = 1;
push @{ $repos{''}{'user8'} }, ();
}

0 comments on commit fe64260

Please sign in to comment.