Gabor Szabo wrote:
> With prove I can say
> 
> prove --exec "$ENV{PARROT_DIR}/parrot
> $ENV{PARROT_DIR}/languages/rakudo/perl6.pbc" t/01.t
> 
> and it will run
> 
> $ENV{PARROT_DIR}/parrot $ENV{PARROT_DIR}/languages/rakudo/perl6.pbc t/01.t
> 
> how can I achieve the same thing with "make test" or "Build test" ?

You'll get the most control, and the least headaches, if you just override the
test target.  Even if you can hack Test::Harness into running Rakudo it has so
many built in Perl5-isms that it'll keep biting you all down the line.

In Module::Build it's simple, override ACTION_test().

sub ACTION_test {
    my $self = shift;
    $self->depends_on('code');

    my $tests = $self->find_test_files;

    # XXX Throw in a check that PARROT_DIR is set

    my $parrot = "$ENV{PARROT_DIR}/parrot";
    my $rakudo = "$ENV{PARROT_DIR}/languages/rakudo/perl6.pbc";

    # XXX Throw in some checks that the above actually exists.

    system("prove", "--exec", "$parrot $rakudo", @$tests);

    return $? == 0 ? 1 : 0;
}

I believe you can avoid the override and set the "use_tap_harness" property
and then just feed TAP::Harness arguments (which are very much like prove's)
in with "tap_harness_args".

In MakeMaker you override test_via_harness().

package MY;
sub test_via_harness {
    my($self, $perl, $tests) = @_;

    # XXX Throw in a check that PARROT_DIR is set

    my $parrot = "$ENV{PARROT_DIR}/parrot";
    my $rakudo = "$ENV{PARROT_DIR}/languages/rakudo/perl6.pbc";

    # XXX Throw in some checks that the above actually exists.

    my $command = $self->quote_literal("$parrot $rakudo");
    return qq[\tprove --exec $command @$tests];
}


-- 
Life is like a sewer - what you get out of it depends on what you put into it.
    - Tom Lehrer

Reply via email to