Abe Timmerman wrote:
> Hi all,
> 
> 
> I'm looking into running part of our test-suite in parallel.
> TAP::Harness understands the way we'd like the tests ordered:
> 
>       { seq => [
>             { seq => [ glob 't/0*.t' ] },
>             { par => [ glob 't/1*.t' ] },
>             { par => [ glob 't/{2,3,4,5,6,7,8}*.t' ] },
>             { seq => [ glob 't/9*.t' ] },
>       ]}
> 
> 
> App::Prove can only do a simple version of rules (that ends up running the
> tests all wrong).
> 
> On the other hand, prove has all the logic we need to get the job done.
> 
> Is there a way, without redoing all the work in App::Prove to get this done?

I looked at plugins for prove, but they are called "too early" for my
purpose (_get_args() expects an arrayref in $prove->{rules}).

I ended up doing this:
$cat pprove

#! /usr/bin/perl
use warnings;
use strict;

{
    my $prove = App::Prove::Rules->new;
    $prove->process_args( @ARGV );
    $prove->test_rules({
        seq => [
            { seq => [ glob 't/0*.t' ] },
            { par => [ glob 't/1*.t' ] },
            { par => [ glob 't/{2,3,4,5,6,7,8}*.t' ] },
            { seq => [ glob 't/9*.t' ] },
        ]
    });

    exit ( $prove->run ? 0 : 1 );
}

package App::Prove::Rules;
use warnings;
use strict;
use App::Prove 3.13;
use base 'App::Prove';

sub test_rules {
    my ($self) = shift;

    if ( @_ ) { $self->{test_rules} = shift }
    return $self->{test_rules};
}

sub _get_args {
    my $self = shift;

    my ($args, $class) = $self->SUPER::_get_args( @_ );

    if ( $self->test_rules ) {
        $args->{rules} = $self->{test_rules};
    }

    return ( $args, $class );
}

1;

__END__

HTH +
Good luck,

Abe.
-- 
 _  | "Pinky, are you pondering what I'm pondering?"
( ) | I think so, Brain, but culottes have a tendency to ride up so. (23
 X  | Nov 93 - When Mice Ruled the Earth)
/ \ |

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to