[perl-5.8.7] Perl regression tests fail when lib directory is present

Gerrit P. Haase gerrit@familiehaase.de
Sun Jul 17 10:57:00 GMT 2005


Hello,

we are on Cygwin: 1.5.18(0.132/4/2) 2005-07-02 20:30, perl is the latest
stable release: This is perl, v5.8.7 built for cygwin-thread-multi-64int

We have a problem building modules, i.e. make test fails if a .pm file
in the source package is located below the root in a subdirectory called
'lib'.


Andrew Ho wrote:
 >>> It appears that on the latest version of Cygwin's Perl, Perl modules
 >>> with regression tests (for example, ones you can download from CPAN)
 >>> fail "make test" on every other test. I did some experimentation and
 >>> this appears to happen only if the modules are in a subdirectory
 >>> (typically "lib") rather than in the install root.
 >>>
 >>> How to reproduce:
 >>>
 >>>     * Upgrade to latest versions of all Cygwin packages (probably
 >>>       Perl is the only relevant one)
 >>>
 >>>     * Download any CPAN module (or create a Perl module) whose files
 >>>       are in a "lib" subdirectory. Lingua::EN::Inflect is an arbitrary
 >>>       example of one that is unlikely to be already installed.
 >>>
 >>>     * Run through the usual Perl install steps:
 >>>       perl Makefile.PL && make && make test
 >>>
 >>>     * Observe that "make test" fails on every other test (odd numbered
 >>>       runs, apparently).
 >>>
 >>> I have reduced this breakage to the smallest possible test case:
 >>> http://www.zeuscat.com/andrew/src/TestModule.tar.gz

> Did you try to run "make test" on the TestModule.tar.gz that I linked 
> to? I'm curious to see if that simple case fails (it contains both a 
> "working" and "broken" version, the latter has the module in a "lib" 
> subdirectory). And is it possible you already had Lingua::EN::Inflect 
> installed on your test system?

Hm, maybe I tried it at first from a cpan shell, and then from the 
command line. I saw a similar problem with XML::GDOME, however tests are
failing even when running from a cpan shell, I reported this as a bug to
the Gdome list, because there are also tests failing after the module
was installed and could be found in @INC.  Unfortunately I didn't 
realized that the "Can't locate ... in @INC" could be a perl bug
since other modules are working ok or I used the cpan shell to install
them.



Now I see that you're right:

$ wget http://www.zeuscat.com/andrew/src/TestModule.tar.gz
--12:11:14--  http://www.zeuscat.com/andrew/src/TestModule.tar.gz
            => `TestModule.tar.gz'
Resolving www.zeuscat.com... 205.217.153.72
Connecting to www.zeuscat.com[205.217.153.72]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 754 [application/x-tar]

100%[====================================>] 754           --.--K/s 


12:11:15 (7.19 MB/s) - `TestModule.tar.gz' saved [754/754]

$ tar zxvf TestModule.tar.gz
TestModule_broken/
TestModule_broken/lib/
TestModule_broken/lib/TestModule.pm
TestModule_broken/Makefile.PL
TestModule_broken/t/
TestModule_broken/t/test0.t
TestModule_broken/t/test1.t
TestModule_broken/t/test2.t
TestModule_broken/t/test3.t
TestModule_broken/t/test4.t
TestModule_broken/t/test5.t
TestModule_working/
TestModule_working/Makefile.PL
TestModule_working/t/
TestModule_working/t/test0.t
TestModule_working/t/test1.t
TestModule_working/t/test2.t
TestModule_working/t/test3.t
TestModule_working/t/test4.t
TestModule_working/t/test5.t
TestModule_working/TestModule.pm

$ cd TestModule_broken/

$ perl Makefile.PL
Writing Makefile for TestModule

$ make
cp lib/TestModule.pm blib/lib/TestModule.pm

$ make test
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 
'blib/lib', 'blib/arch')" t/*.t
t/test0....ok 

t/test1....Can't locate TestModule.pm in @INC (@INC contains: 
/usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 
/usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 
/usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin 
/usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at 
t/test1.t line 2.
BEGIN failed--compilation aborted at t/test1.t line 2.
t/test1....dubious 

         Test returned status 2 (wstat 512, 0x200)
t/test2....ok 

t/test3....Can't locate TestModule.pm in @INC (@INC contains: 
/usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 
/usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 
/usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin 
/usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at 
t/test3.t line 2.
BEGIN failed--compilation aborted at t/test3.t line 2.
t/test3....dubious 

         Test returned status 2 (wstat 512, 0x200)
t/test4....ok 

t/test5....Can't locate TestModule.pm in @INC (@INC contains: 
/usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 
/usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 
/usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin 
/usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at 
t/test5.t line 2.
BEGIN failed--compilation aborted at t/test5.t line 2.
t/test5....dubious 

         Test returned status 2 (wstat 512, 0x200)
Failed Test Stat Wstat Total Fail  Failed  List of Failed
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
t/test1.t      2   512    ??   ??       %  ??
t/test3.t      2   512    ??   ??       %  ??
t/test5.t      2   512    ??   ??       %  ??
Failed 3/6 test scripts, 50.00% okay. 0/3 subtests failed, 100.00% okay.
make: *** [test_dynamic] Error 14

$ cd ../TestModule_working/

$ perl Makefile.PL
Writing Makefile for TestModule

$ make
cp TestModule.pm blib/lib/TestModule.pm

$ make test
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 
'blib/lib', 'blib/arch')" t/*.t
t/test0....ok 

t/test1....ok 

t/test2....ok 

t/test3....ok 

t/test4....ok 

t/test5....ok 

All tests successful.
Files=6, Tests=6,  2 wallclock secs ( 1.14 cusr +  0.90 csys =  2.04 CPU)



The problem seems to be that blib and/or blib/lib isn't added to @INC:

t/test1....Can't locate TestModule.pm in @INC (@INC contains: 
/usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 
/usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 
/usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin 
/usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at 
t/test1.t line 2.

The .pm is right there:
$ ls blib/lib
TestModule.pm  auto/


This is dubious since it works ok when the .pm in the original
source package is in TestModule_working/TestModule.pm instead of
TestModule_working/lib/TestModule.pm.

How does the location of the source affect the @INC settings?

in test_harness this is called:
     unshift @INC, map { File::Spec->rel2abs($_) } @_;

I added a print here:
/home/gerrit/perltemp/TestModule_broken/blib/lib
/home/gerrit/perltemp/TestModule_broken/blib/arch
/usr/lib/perl5/5.8/cygwin
/usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
/usr/lib/perl5/vendor_perl/5.8
.

So the path seems to be correct in the first step.

Then Test::Harness::runtests is called, the @INC setting is different
now (i.e. just the default):

Can't locate TestModule.pm in @INC (@INC contains:
/usr/lib/perl5/5.8/cygwin
/usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
/usr/lib/perl5/vendor_perl/5.8
.) at t/test1.t line 2.


Here I have no idea.  After a short view into Harness.pm I decided
to ask someone who is more familiar with MakeMaker and Test::Harness
than me.


Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list