in reply to Re^2: Inner workings of "make test"
in thread Inner workings of "make test"
YES. Here is an example. I created a simple ( h2xs -XA FOO ) package (no XS) and ran make -n testdb TEST_FILE=t/1.t the -n tells make to report what it would do if it were to run (which it doesn't)
$make -n testdb TEST_FILE=t/2.t /nfs/mu/apps/perl/5.8.4/bin/perl "-MExtUtils::Command" -e mkpath \ blib/lib blib/lib/auto/FOO \ blib/arch/auto/FOO blib/bin \ blib/script blib/man1 \ blib/man3 chmod 755 \ blib/lib blib/lib/auto/FOO \ blib/arch/auto/FOO blib/bin \ blib/script blib/man1 \ blib/man3 touch blibdirs /bin/sh -c true /nfs/mu/apps/perl/5.8.4/bin/perl -MExtUtils::Install -e 'pm_to_blib({@ +ARGV}, '\''blib/lib/auto'\'', '\'''\'')' \ FOO.pm blib/lib/FOO.pm touch pm_to_blib /bin/sh -c true /bin/sh -c true /bin/sh -c true /bin/sh -c true PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl -d "-Iblib/lib" "-I +blib/arch" t/2.t
Notice the last line:
PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl -d "-Iblib/lib" "-Iblib/arch" t/2.tThis calls perl with blib/lib and blib/arch ahead of everything else in the @INC list of package directories to search. This will ensure that the package(s) you are testing are picked up before whatever else is in @INC.
For example, heres a test that will report what @INC has:
# Before `make install' is performed this script should be runnable wi +th # `make test'. After `make install' it should work as `perl 1.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; print join("\n", @INC); ok(1);
Now when I run this using the make:
$make testdb TEST_FILE=t/2.t PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl -d "-Iblib/lib" "-I +blib/arch" t/2.t Reading ~/.perldb options. Loading DB routines from perl5db.pl version 1.25 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. 1..1 main::(t/2.t:10): print join("\n", @INC); DB<1> c blib/lib blib/arch /home/memyselfandi/lib /foo/apps/perl/5.8.4/lib /foo/sdk/perl/5.8.4/sitelib/prod/lib /foo/foofoo/corplib/gcc331/prod/perllib/lib .ok 1 Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> q
|
|---|