Subject: | Bad interaction with Test::Harness 2.36 |
There are a couple of problems when used in conjunction with Test::Harness 2.36. The first is that "make test" hangs. This is caused by Module::Build::Base::ACTION_test setting $ENV{HARNESS_PERL_SWITCHES} to an empty string if $harness_switches is empty. This confuses Test::Harness,
which looks to see if that environmental variable is defined (not if its empty). It thus builds a command line that looks like this:
perl "-w" "" <test file name>
The empty third argument causes perl to read the program from STDIN, which
of course isn't what's required here. Thus it hangs.
Something like this cures that ailment (Base.pm, line 1015)
delete $ENV{HARNESS_PERL_SWITCHES} if $ENV{HARNESS_PERL_SWITCHES} eq '';
The next problem is that the testdb target fails with messages like:
t/basic.........Can't open perl script " -w -d": No such file or directory
t/basic.........dubious
Test returned status 2 (wstat 512, 0x200)
Note the leading space in the " -w -d" option list, which is there so that
when appended to an existing set of switches the appropriate space is inserted. however, for some reason there is no existing set. I modified
the code in ACTION_test to look like this, and it seems to work (it at least runs the code, rather than failing):
my $harness_switches = $p->{debugger} ? '-w -d' : '';
local $Test::Harness::switches = join( ' ', ($Test::Harness::switches || ()), $harness_switches);
local $Test::Harness::Switches = join( ' ', ($Test::Harness::Switches || ()), $harness_switches);
local $ENV{HARNESS_PERL_SWITCHES} = join( ' ', ($ENV{HARNESS_PERL_SWITCHES} || ()), $harness_switches);
Thanks,
Diab