On Sat, 29 Mar 2008 11:59:25 -0700
Mark Glines <[EMAIL PROTECTED]> wrote:

> This changes Parrot::Test's behavior: an alternate "-O" option will
> only be used if the *filename* contains "optN", not if a leading
> directory name contains it.  I don't see any uses of "optN" in
> directory names in the parrot tree, so I think it's ok.  And it fixes
> the bug for me. See attached.

Found a second place in Parrot::Test which was doing the same thing,
causing a failure in t/pmc/sub.t.  Fixed in the same way, new diff
is attached.  Now everything in "make test" passes for me.

Mark
Index: lib/Parrot/Test.pm
===================================================================
--- lib/Parrot/Test.pm  (revision 26625)
+++ lib/Parrot/Test.pm  (working copy)
@@ -263,6 +263,7 @@
 
 use Cwd;
 use File::Spec;
+use File::Basename;
 use Memoize ();
 
 use Parrot::Config;
@@ -575,6 +576,7 @@
         die "Unknown test function: $func";
     }
     $code_f = File::Spec->rel2abs($code_f);
+    my $code_basef = basename($code_f);
 
     # native tests are just run, others need to write code first
     if ( $code_f !~ /\.pbc$/ ) {
@@ -583,7 +585,7 @@
 
     # honor opt* filename to actually run code with -Ox
     my $args = $ENV{TEST_PROG_ARGS} || '';
-    my $opt = $code_f =~ m!opt(.)! ? "-O$1" : "";
+    my $opt = $code_basef =~ m!opt(.)! ? "-O$1" : "";
     $args .= " $opt";
 
     my $run_exec = 0;
@@ -766,11 +768,12 @@
 
             # Name of the file with test code.
             my $code_f = File::Spec->rel2abs( per_test( '.pir', $test_no ) );
+            my $code_basef = basename($code_f);
 
             # output file
             my $out_f = per_test( '.pasm', $test_no );
 
-            my $opt = $code_f =~ m!opt(.)! ? "-O$1" : "-O1";
+            my $opt = $code_basef =~ m!opt(.)! ? "-O$1" : "-O1";
             my $args = $ENV{TEST_PROG_ARGS} || '';
             $args .= " $opt --output=$out_f";
             $args =~ s/--run-exec//;

Reply via email to