W
wisnij
A few days ago I wrote a Perl module and put it into a directory
structure created with h2xs in order to do unit testing. My very
earliest tests were failing unexpectedly, so I pared the testing
scripts down to the very bare minimum to see if I could find the
problem. There were eventually just two files, t/00foo.t and
t/01bar.t, both with exactly the same two-line content:
use Test::More tests => 1;
BEGIN { use_ok 'My::Module' };
Running "make test" (perl 5.8.7 on Cygwin), this was the output modulo
some line wrapping:
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib/lib', 'blib/arch')" t/*.t
t/00foo....ok
t/01bar....
# Failed test 'use My::Module;'
t/01bar....NOK 1# in t/01bar.t at line 2.
# Tried to use 'My::Module'.
# Error: Can't locate My/Module.pm in @INC (@INC contains:
/usr/lib/perl5/5.8/cygwin [etc...] /usr/lib/perl5/vendor_perl/5.8 .) at
(eval 3) line 2.
# BEGIN failed--compilation aborted at t/01bar.t line 2.
# Looks like you failed 1 test of 1.
t/01bar....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-----------------------------------------------------------------
t/01bar.t 1 256 1 1 100.00% 1
Failed 1/2 test scripts, 50.00% okay. 1/2 subtests failed, 50.00%
okay.
make: *** [test_dynamic] Error 14
How could this possibly happen? I tried it out with more copies of the
same testing file, and the output followed the same pattern: the
scripts would alternate between succeeding and totally failing to find
the module. The only thing I can think of is that I've somehow gotten
a buggy copy of Test::Harness or some other module, and it's failing
pass on the existence of blib/lib and so forth to every other test
script for some reason; it's clearly not in @INC when 01bar.t is run,
even though it certainly should be.
Has anybody ever seen something like this? I've written a few modules
before, but I've never seen anything fail like this.
-- J.
structure created with h2xs in order to do unit testing. My very
earliest tests were failing unexpectedly, so I pared the testing
scripts down to the very bare minimum to see if I could find the
problem. There were eventually just two files, t/00foo.t and
t/01bar.t, both with exactly the same two-line content:
use Test::More tests => 1;
BEGIN { use_ok 'My::Module' };
Running "make test" (perl 5.8.7 on Cygwin), this was the output modulo
some line wrapping:
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib/lib', 'blib/arch')" t/*.t
t/00foo....ok
t/01bar....
# Failed test 'use My::Module;'
t/01bar....NOK 1# in t/01bar.t at line 2.
# Tried to use 'My::Module'.
# Error: Can't locate My/Module.pm in @INC (@INC contains:
/usr/lib/perl5/5.8/cygwin [etc...] /usr/lib/perl5/vendor_perl/5.8 .) at
(eval 3) line 2.
# BEGIN failed--compilation aborted at t/01bar.t line 2.
# Looks like you failed 1 test of 1.
t/01bar....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-----------------------------------------------------------------
t/01bar.t 1 256 1 1 100.00% 1
Failed 1/2 test scripts, 50.00% okay. 1/2 subtests failed, 50.00%
okay.
make: *** [test_dynamic] Error 14
How could this possibly happen? I tried it out with more copies of the
same testing file, and the output followed the same pattern: the
scripts would alternate between succeeding and totally failing to find
the module. The only thing I can think of is that I've somehow gotten
a buggy copy of Test::Harness or some other module, and it's failing
pass on the existence of blib/lib and so forth to every other test
script for some reason; it's clearly not in @INC when 01bar.t is run,
even though it certainly should be.
Has anybody ever seen something like this? I've written a few modules
before, but I've never seen anything fail like this.
-- J.