Author: jkeenan
Date: Sat Jan 26 21:05:11 2008
New Revision: 25271

Modified:
   branches/harness/lib/Parrot/Harness/Smoke.pm
   branches/harness/t/harness

Log:
Refactor code for determining program arguments string out of t/harness and 
into lib/Parrot/Harness/Smoke.pm.

Modified: branches/harness/lib/Parrot/Harness/Smoke.pm
==============================================================================
--- branches/harness/lib/Parrot/Harness/Smoke.pm        (original)
+++ branches/harness/lib/Parrot/Harness/Smoke.pm        Sat Jan 26 21:05:11 2008
@@ -25,8 +25,22 @@
 use lib qw( . lib ../lib ../../lib );
 use Parrot::Config qw/%PConfig/;
 use base qw( Exporter );
-our @EXPORT_OK = qw( generate_html_smoke_report );
-
+our @EXPORT_OK = qw(
+    get_test_prog_args
+    generate_html_smoke_report
+);
+
+sub get_test_prog_args {
+    my ($optsref, $gc_debug, $run_exec) = @_;
+    my %opts = %{ $optsref };
+    my $args = join(' ', map { "-$_" } keys %opts );
+    $args =~ s/-O/-O$opts{O}/ if exists $opts{O};
+    $args =~ s/-D/-D$opts{D}/;
+    $args .= ' --gc-debug'    if $gc_debug;
+    # XXX find better way for passing run_exec to Parrot::Test
+    $args .= ' --run-exec'    if $run_exec;
+    return $args;
+}
 
 sub generate_html_smoke_report {
     my $argsref = shift;

Modified: branches/harness/t/harness
==============================================================================
--- branches/harness/t/harness  (original)
+++ branches/harness/t/harness  Sat Jan 26 21:05:11 2008
@@ -92,7 +92,10 @@
 use Getopt::Std;
 use Test::Harness();
 use Parrot::Harness::DefaultTests;
-use Parrot::Harness::Smoke qw( generate_html_smoke_report );
+use Parrot::Harness::Smoke qw(
+    get_test_prog_args
+    generate_html_smoke_report
+);
 
 # handle the long options
 
@@ -151,12 +154,13 @@
 # add -D40;  merge it with any existing -D argument
 $opts{D} = sprintf( '%x', hex(40) | (exists $opts{D} ? hex($opts{D}) : 0));
 
-my $args = join(' ', map { "-$_" } keys %opts );
-$args =~ s/-O/-O$opts{O}/ if exists $opts{O};
-$args =~ s/-D/-D$opts{D}/;
-$args .= ' --gc-debug'    if $gc_debug;
-# XXX find better way for passing run_exec to Parrot::Test
-$args .= ' --run-exec'    if $run_exec;
+#my $args = join(' ', map { "-$_" } keys %opts );
+#$args =~ s/-O/-O$opts{O}/ if exists $opts{O};
+#$args =~ s/-D/-D$opts{D}/;
+#$args .= ' --gc-debug'    if $gc_debug;
+## XXX find better way for passing run_exec to Parrot::Test
+#$args .= ' --run-exec'    if $run_exec;
+my $args = get_test_prog_args(\%opts, $gc_debug, $run_exec);
 $ENV{TEST_PROG_ARGS} = $args;
 
 # now build the list of tests to run, either from the command

Reply via email to