On Sat, 29 Mar 2008 07:03:17 -0700
"James Keenan via RT" <[EMAIL PROTECTED]> wrote:
> If we simply add a forward slash after 'opt', does that solve the
> problem?  (see attached)

Should this code really be checking the absolute pathname?  We don't
have any control over where a user places a parrot checkout, and
honestly, I think we should be ignoring that as much as possible.  I
think a safer solution is to chuck the filename through basename()
before doing the match.

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.

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;
@@ -766,11 +767,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