Heya, Attached are a number of small patches for TAP::Harness and associated packages. I'm sending this here, because it's not clear from the documentation where bugs and patches should be sent. The Test::Harness queue cc's all of p5p, so I erred away from using that.
First, app-prove-rules.patch provides a command-line option to prove which allows you a small amount of control over the new scheduler. This is fairly important, as the default rule of { par => '*' } means that only tests in the current directory get run in parallel. Since most of the time my tests are in 't/', this means that since version 3.12 or so, -j never runs more than one test at once. tap-parser-scheduler-starstar.patch adds support for things like 't/**' as a rule, meaning "everything under t/, including in subdirectories." tap-parser-bugreporting.patch changes the BUGS section to refer to the Test-Harness rt.cpan queue, instead of the TAPx-Parser queue. Finally, fix-tprove_gtk-example.patch makes the tprove_gtk example actually seem to work with the current codebase. - Alex -- Networking -- only one letter away from not working
Index: lib/App/Prove.pm =================================================================== --- lib/App/Prove.pm (revision 1131) +++ lib/App/Prove.pm (working copy) @@ -58,7 +58,7 @@ harness includes modules plugins jobs lib merge parse quiet really_quiet recurse backwards shuffle taint_fail taint_warn timer verbose warnings_fail warnings_warn show_help show_man - show_version test_args state dry extension ignore_exit + show_version test_args state dry extension ignore_exit rules ); for my $attr (@ATTR) { no strict 'refs'; @@ -88,7 +88,7 @@ my $args = shift || {}; # setup defaults: - for my $key (qw( argv rc_opts includes modules state plugins )) { + for my $key (qw( argv rc_opts includes modules state plugins rules )) { $self->{$key} = []; } $self->{harness_class} = 'TAP::Harness'; @@ -223,6 +223,7 @@ 't' => \$self->{taint_warn}, 'W' => \$self->{warnings_fail}, 'w' => \$self->{warnings_warn}, + 'rules=s@' => $self->{rules}, ) or croak('Unable to continue'); # Stash the remainder of argv for later @@ -334,6 +335,18 @@ $args{test_args} = $test_args; } + if ( @{ $self->rules }) { + my @rules; + for ( @{ $self->rules } ) { + if (/^par=(.*)/) { + push @rules, $1; + } elsif (/^seq=(.*)/) { + push @rules, { seq => $1 }; + } + } + $args{rules} = { par => [ @rules ] }; + } + return ( \%args, $self->{harness_class} ); }
Index: examples/bin/tprove_gtk =================================================================== --- examples/bin/tprove_gtk (revision 1131) +++ examples/bin/tprove_gtk (working copy) @@ -407,16 +407,8 @@ my $source = TAP::Parser::Source::Perl->new(); foreach my $test ( @{ $self->{_tests} } ) { - my $stream = $source->source($test)->get_stream(); - if ($stream) { - my $parser = $self->analyze( $test, $stream ); - - # $aggregate -> add($test, $parser); - } - else { - warn "Could not run `$test´: " . $source->error(); - next; - } + my $parser = TAP::Parser->new( { source => $test } ); + $self->analyze( $test, $parser ) if $parser; } my $writer = $self->{_writer}; @@ -425,12 +417,11 @@ } sub analyze { - my ( $self, $test, $stream ) = @_; + my ( $self, $test, $parser ) = @_; my $writer = $self->{_writer}; my $result = $self->{_results}->{$test}; - my $parser = TAP::Parser->new( { stream => $stream } ); while ( my $line = $parser->next() ) { if ( $line->is_plan() ) { $result->[INDEX_TOTAL] = $line->tests_planned();
Index: lib/TAP/Parser.pm =================================================================== --- lib/TAP/Parser.pm (revision 1131) +++ lib/TAP/Parser.pm (working copy) @@ -1851,8 +1851,8 @@ =head1 BUGS Please report any bugs or feature requests to -C<[EMAIL PROTECTED]>, or through the web interface at -L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=TAP-Parser>. +C<[EMAIL PROTECTED]>, or through the web interface at +L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness>. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.
Index: lib/TAP/Parser/Scheduler.pm =================================================================== --- lib/TAP/Parser/Scheduler.pm (revision 1131) +++ lib/TAP/Parser/Scheduler.pm (working copy) @@ -113,9 +113,10 @@ sub _expand { my ( $self, $name, $tests ) = @_; - $name =~ s{(.)}{ - $1 eq '?' ? '[^/]' - : $1 eq '*' ? '[^/]*' + $name =~ s{(\?|\*\*?|.)}{ + $1 eq '?' ? '[^/]' + : $1 eq '*' ? '[^/]*' + : $1 eq '**' ? '.*?' : quotemeta($1); }gex; @@ -227,6 +228,7 @@ return "$indent(undef)\n"; } elsif ( 'ARRAY' eq ref $rule ) { + return unless @$rule; my $type = ( 'par', 'seq' )[ $depth % 2 ]; return join( '', "$indent$type:\n",