On Thu, Jul 8, 2010 at 16:03, Ævar Arnfjörð Bjarmason <avar@cpan.org> wrote:
Show quoted text> On Thu, Jul 8, 2010 at 01:34, Bugs in Test-Harness via RT
> <bug-Test-Harness@rt.cpan.org> wrote:
>> Git uses *.sh tests that generate TAP. I can't pass arguments to
>> them because prove will seemingly only pass through arguments
>> perl files.
>>
>> This isn't consistent with its documentation, or what it should
>> be doing. Arguments that you provide should be passed
>> indiscriminately to all tests that prove runs.
>>
>> Here's a simple test case that demonstrates the issue:
>>
>> $ (echo '#!/bin/sh' && echo 'echo "Options are: $@"') > test.sh
>> $ (echo '#!/usr/bin/perl' && echo 'print "Options are:
>> @ARGV\n"') > test.pl
>> $ prove -v ./test.* :: --some --options
>> ./test.pl ..
>> Options are: --some --options
>> No subtests run
>> ./test.sh ..
>> Options are:
>> No subtests run
>
> I've read a bit more about this and discovered that this is due to the
> TAP SourceHandlers. The .sh ends up being handled by the Executable
> class, which it seems never passes any arguments to the things it's
> testing:
>
> $ TAP_HARNESS_SOURCE_FACTORY_VOTES=1 prove -v ./test.* :: --some --options
> votes: TAP::Parser::SourceHandler::Perl: 0.9
> ./test.pl ..
> Options are: --some --options
> No subtests run
> votes: TAP::Parser::SourceHandler::Perl: 0.25,
> TAP::Parser::SourceHandler::Executable: 0.8
> ./test.sh ..
> Options are:
> No subtests run
>
> This is due to detect_source:
>
http://search.cpan.org/~andya/Test-Harness-3.21/lib/TAP/Parser/IteratorFactory.pm#detect_source
>
> Passing e.g. --source=Perl to override it doesn't work. And in any
> case silently ignoring options that I've explicitly specified should
> be passed to the tests seems to be the wrong behavior.
>
> Is there some workaround that I've missed that I can use for passing
> through the options unscathed?
I've discovered that this is a regression. The first bad commit is
0be9972d756f37c6dd6527cfd51cb5c6104718ef by Steve Purkis. And the
first bad release is 3.17_01.
Before that commit (3.17):
$ TAP_HARNESS_SOURCE_FACTORY_VOTES=1 perl -I ~/g/Test-Harness/lib
~/g/Test-Harness/bin/prove -v ./test.* :: --some --options
./test.pl ..
Options are: --some --options
No subtests run
./test.sh ..
Options are: --some --options
And after (3.17_01):
$ TAP_HARNESS_SOURCE_FACTORY_VOTES=1 perl -I ~/g/Test-Harness/lib
~/g/Test-Harness/bin/prove -v ./test.* :: --some --options
votes: TAP::Parser::SourceHandler::Perl: 0.9
./test.pl ..
Options are: --some --options
No subtests run
votes: TAP::Parser::SourceHandler::Perl: 0.25,
TAP::Parser::SourceHandler::Executable: 0.8
./test.sh ..