diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-19 13:29:13 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-19 13:29:13 +0000 |
commit | 58d7332594fdc120dc575dc757995db2d62a65ed (patch) | |
tree | 5bec6b62ae62e87f608086cc9ca47f5d18466fa7 /ext | |
parent | 9f7e07ec929b796ce6e2669d563feb016a923cce (diff) | |
download | perl-58d7332594fdc120dc575dc757995db2d62a65ed.tar.gz |
(From Enache) Keep bytecode files (.plc) around in case
of failures. (Currently Tru64 is reliably barfing.)
p4raw-id: //depot/perl@20775
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/t/bytecode.t | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/B/t/bytecode.t b/ext/B/t/bytecode.t index e8f7d6bc9b..2066105aec 100644 --- a/ext/B/t/bytecode.t +++ b/ext/B/t/bytecode.t @@ -1,4 +1,6 @@ #!./perl +my $keep_plc = 0; # set it to keep the bytecode files +my $keep_plc_fail = 1; # set it to keep the bytecode files on failures BEGIN { if ($^O eq 'VMS') { @@ -16,33 +18,32 @@ BEGIN { } use strict; -my $test = 'bytecode.pl'; -END { 1 while unlink $test, "${test}c" } - undef $/; my @tests = split /\n###+\n/, <DATA>; print "1..".($#tests+1)."\n"; my $cnt = 1; +my $test; for (@tests) { my $got; my ($script, $expect) = split />>>+\n/; $expect =~ s/\n$//; + $test = "bytecode$cnt.pl"; open T, ">$test"; print T $script; close T; $got = run_perl(switches => [ "-MO=Bytecode,-H,-o${test}c" ], verbose => 0, # for debugging stderr => 1, # to capture the "bytecode.pl syntax ok" progfile => $test); unless ($?) { - 1 while unlink($test); # nuke the .pl $got = run_perl(progfile => "${test}c"); # run the .plc unless ($?) { if ($got =~ /^$expect$/) { print "ok $cnt\n"; next; } else { + $keep_plc = $keep_plc_fail unless $keep_plc; print <<"EOT"; next; not ok $cnt --------- SCRIPT @@ -64,6 +65,7 @@ $script $got EOT } continue { + 1 while unlink($test, $keep_plc ? () : "${test}c"); $cnt++; } |