X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Frecurse.t;h=10830e622137e42c025c3d7d0213b7ab54b1af04;hb=1c509eb921569425706e6fe39ea7cb2f11e99d1b;hp=374813c9e43f44d7fc3fe3ed5bbbf461c82dde77;hpb=a453040451be73589741d2ad8853174873ef7060;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/recurse.t b/t/op/recurse.t index 374813c..10830e6 100755 --- a/t/op/recurse.t +++ b/t/op/recurse.t @@ -8,7 +8,7 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(. ../lib); require "test.pl"; - plan(tests => 26); + plan(tests => 28); } use strict; @@ -112,6 +112,26 @@ is(takeuchi($x, $y, $z), $z + 1, "takeuchi($x, $y, $z) == $z + 1"); is(sillysum(1000), 1000*1001/2, "recursive sum of 1..1000"); } - - +# check ok for recursion depth > 65536 +{ + my $r; + eval { + $r = runperl( + nolib => 1, + stderr => 1, + prog => q{$d=0; $e=1; sub c { ++$d; if ($d > 66000) { $e=0 } else { c(); c() unless $d % 32768 } --$d } c(); exit $e}); + }; + SKIP: { + skip("Out of memory -- increase your data/heap?", 2) + if $r =~ /Out of memory/i; + is($r, '', "64K deep recursion - no output expected"); + + if ($^O eq 'MacOS') { + ok(1, "$^O: \$? is unreliable"); + } else { + is($?, 0, "64K deep recursion - no coredump expected"); + } + + } +}