Further Byteloader tweaks from Enache.
[p5sagit/p5-mst-13.2.git] / t / TEST
diff --git a/t/TEST b/t/TEST
index f2f623d..3e6e408 100755 (executable)
--- a/t/TEST
+++ b/t/TEST
@@ -21,7 +21,7 @@ if ($#ARGV >= 0) {
        $verbose = 1 if $1 eq 'v';
        $torture = 1 if $1 eq 'torture';
        $with_utf= 1 if $1 eq 'utf8';
-        $byte_compile = 1 if $1 eq 'bytecompile';
+        $bytecompile = 1 if $1 eq 'bytecompile';
         $compile = 1 if $1 eq 'compile';
        if ($1 =~ /^deparse(,.+)?$/) {
            $deparse = 1;
@@ -125,9 +125,11 @@ unless (@ARGV) {
 if ($deparse) {
     _testprogs('deparse', '',   @ARGV);
 }
-elsif( $compile || $byte_compile ) { 
-    _testprogs('compile', '',   @ARGV) if $compile;
-    _testprogs('compile', '-B', @ARGV) if $byte_compile;
+elsif( $compile ) { 
+    _testprogs('compile', '',   @ARGV);
+}
+elsif( $bytecompile ) {
+    _testprogs('bytecompile', '', @ARGV);
 }
 else {
     _testprogs('compile', '',   @ARGV) if -e "../testcompile";
@@ -151,6 +153,12 @@ TESTING DEPARSER
 ------------------------------------------------------------------------------
 EOT
 
+    print <<EOT if ($type eq 'bytecompile');
+------------------------------------------------------------------------------
+TESTING BYTECODE COMPILER
+------------------------------------------------------------------------------
+EOT
+
     $ENV{PERLCC_TIMEOUT} = 120
           if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT});
 
@@ -228,13 +236,30 @@ EOT
        my $testswitch = '-I. -MTestInit'; # -T will strict . from @INC
        if ($type eq 'deparse') {
            my $deparse =
-               "./perl $testswitch $switch -I../lib -MO=-qq,Deparse,".
+               "./perl $testswitch $switch -I../lib -MO=-qq,Deparse,-sv1.,".
                "-l$deparse_opts$file_opts ".
                "$test > $test.dp ".
                "&& ./perl $testswitch $switch -I../lib $test.dp |";
            open(RESULTS, $deparse)
                or print "can't deparse '$deparse': $!.\n";
        }
+       elsif ($type eq 'bytecompile') {
+           my $perl = $ENV{PERL} || './perl';
+           my $redir = ($^O eq 'VMS' ? '2>&1' : '');
+           my $bswitch = "-MO=Bytecode,-H,-TI,-s`pwd`/$test,";
+           $bswitch .= "-TF$test.plc,"
+               if $test =~ m(chdir|pod/|CGI/t/carp|lib/DB);
+           $bswitch .= "-k,"
+               if $test =~ m(deparse|terse|ext/Storable/t/code);
+           $bswitch .= "-b,"
+               if $test =~ m(op/getpid);
+           my $bytecompile =
+               "$perl $testswitch $switch -I../lib $bswitch". 
+               "-o$test.plc $test 2>/dev/null &&".
+               "$perl $testswitch $switch $utf $test.plc $redir|";
+           open(RESULTS,$bytecompile)
+               or print "can't byte-compile '$bytecompile': $!.\n";
+       }
        elsif ($type eq 'perl') {
            my $perl = $ENV{PERL} || './perl';
            my $redir = ($^O eq 'VMS' ? '2>&1' : '');