geektron has asked for the wisdom of the Perl Monks concerning the following question:

i ran into an interesting problem last night when trying to test a new distribution. i know the standard download tarball, unzip, perl Makefile.PL, etc steps, but when running  make test the tests used the old version rather than the new version.

sample output of the tests:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_ini..........................ok t/02_bad_constructor..............Odd number of elements in hash assig +nment at /usr/local/lib/perl5/site_perl/5.6.1/ExtUtils/ModuleMaker.pm + line 232.
where the test output indicates usage of a previously installed version, while all of my new distro source is in  /opt/source/perl/

i'm not clear on what the  UNINST=1 flag would do, but for now, i don't want to install the new dist, just make sure it passes all the tests ...

i must be missing something obvious.

UPDATE:
more for posterity than anything else, i got an answer of sorts to this on another mailing list (perl-qa).

older versions of ExtUtils::MakeMaker used relative paths in @INC ... so any tests w/ a chdir lose ./blib/lib in @INC, and tests will use a previously installed version (if it can be found in @INC) or fail outright.

Replies are listed 'Best First'.
Re: "make test" problems with previously installed module
by gellyfish (Monsignor) on Sep 08, 2005 at 18:59 UTC

    That's a little odd because the tests are basically run as if they had been called like:

    perl -Mblib t/test_file.t
    which basically places the blib structure first in @INC. You might want to try running the tests by hand like the above in the first instance to see if that works as expected; it could be something in the test files themselves for instance rather than the module itself.

    /J\

      i've tried:  perl -Mblib t/02_bad_constructor.t to no avail.

      i even tried adding a  use lib ("./t/testlib") in the .t script, but that didn't do it either.

      i am genuinely stumped.

        As long as you're mangling the test script anyway, I'd start with a dumping of @INC to see what's there, then a manual check of each directory in order to ensure that the module you think should be there is there. And the use lib line you've posted probably should warrant a check of the current working directory to ensure it's relative to where you think it should be. ;-)

      i find it odd myself, but i'll try this later when i can devote some time to this, and not dayjob work.