Author: jkeenan Date: Sun Jan 27 06:12:09 2008 New Revision: 25283 Modified: branches/harness/t/harness
Log: Gather up the long options into a hash rather than 6+ individual scalar variables. Modified: branches/harness/t/harness ============================================================================== --- branches/harness/t/harness (original) +++ branches/harness/t/harness Sun Jan 27 06:12:09 2008 @@ -100,29 +100,30 @@ ); # handle the long options +my %longopts; $ENV{RUNNING_MAKE_TEST} = grep { $_ eq '--running-make-test' } @ARGV; @ARGV = grep { $_ ne '--running-make-test' } @ARGV; -my $gc_debug = grep { $_ eq '--gc-debug' } @ARGV; +$longopts{gc_debug} = grep { $_ eq '--gc-debug' } @ARGV; @ARGV = grep { $_ ne '--gc-debug' } @ARGV; -my $core_tests_only = grep { $_ eq '--core-tests' } @ARGV; +$longopts{core_tests_only} = grep { $_ eq '--core-tests' } @ARGV; @ARGV = grep { $_ ne '--core-tests' } @ARGV; -my $runcore_tests_only = grep { $_ eq '--runcore-tests' } @ARGV; +$longopts{runcore_tests_only} = grep { $_ eq '--runcore-tests' } @ARGV; @ARGV = grep { $_ ne '--runcore-tests' } @ARGV; -my $html = grep { $_ eq '--html' } @ARGV; +$longopts{html} = grep { $_ eq '--html' } @ARGV; @ARGV = grep { $_ ne '--html' } @ARGV; -my $run_exec = grep { $_ eq '--run-exec' } @ARGV; +$longopts{run_exec} = grep { $_ eq '--run-exec' } @ARGV; @ARGV = grep { $_ ne '--run-exec' } @ARGV; -my $use_test_run = grep { $_ eq '--tr' } @ARGV; +$longopts{use_test_run} = grep { $_ eq '--tr' } @ARGV; @ARGV = grep { $_ ne '--tr' } @ARGV; -$use_test_run ||= $ENV{'PARROT_USE_TEST_RUN'}; +$longopts{use_test_run} ||= $ENV{'PARROT_USE_TEST_RUN'}; # Suck the short options into the TEST_PROG_ARGS evar: my %opts; @@ -156,25 +157,19 @@ # 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 = get_test_prog_args(\%opts, $gc_debug, $run_exec); +my $args = get_test_prog_args(\%opts, $longopts{gc_debug}, $longopts{run_exec}); $ENV{TEST_PROG_ARGS} = $args; # now build the list of tests to run, either from the command # line or from @default tests my @default_tests = get_default_tests( - $core_tests_only, - $runcore_tests_only + $longopts{core_tests_only}, + $longopts{runcore_tests_only} ); my @tests = map { glob( $_ ) } (@ARGV ? @ARGV : @default_tests); -if ($use_test_run) { +if ($longopts{use_test_run}) { require Test::Run::CmdLine::Iface; my $test_run = Test::Run::CmdLine::Iface->new( @@ -186,7 +181,7 @@ $test_run->run(); } -elsif (!$html) { +elsif (!$longopts{html}) { Test::Harness::runtests(@tests); } else { generate_html_smoke_report ( {