Subject: | Test::Harness Improperly Adds Old Architecture-Specific Directories to @INC |
This is the test script:
#!/usr/bin/perl -w
use strict;
use Test::More tests => 1;
diag $_ for @INC;
ok 1;
Here's what happens when I just run it with Perl:
sahlins% perl try
1..1
# /usr/local/lib/perl5/5.8.2/i386-freebsd
# /usr/local/lib/perl5/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.0
# /usr/local/lib/perl5/site_perl/5.6.1
# /usr/local/lib/perl5/site_perl/5.005
# /usr/local/lib/perl5/site_perl
# .
ok 1
All is well in the world. However, here's what happens when I run it
through Test::Harness:
sahlins% prove try
try...# /usr/local/lib/perl5/5.8.2/i386-freebsd
# /usr/local/lib/perl5/5.8.2/i386-freebsd
# /usr/local/lib/perl5/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.0
# /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.6.1
# /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.005
# /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.0
# /usr/local/lib/perl5/site_perl/5.6.1
# /usr/local/lib/perl5/site_perl/5.005
# /usr/local/lib/perl5/site_perl
# .
# /usr/local/lib/perl5/5.8.2/i386-freebsd
# /usr/local/lib/perl5/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.2
# /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.8.0
# /usr/local/lib/perl5/site_perl/5.6.1
# /usr/local/lib/perl5/site_perl/5.005
# /usr/local/lib/perl5/site_perl
# .
try...ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 cusr + 0.01 csys = 0.03 CPU)
Yow! Those architecture-specific directories for older versions of Perl
should _not_ be in @INC! I ran into this problem while testing
DBI-1.42rc1. It does some tests using BerkeleyDB, which is a compiled
module. I didn't have it installed for Perl 5.8, but I did for Perl
5.6.1. So when I ran the tests, Perl was finding it in
/usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd, and of course,
because it's not binary compatabile, it died horribly!
I'm not sure how all of those extra directories are getting inserted
into @INC by Test::Harness, but I think that's gotta stop.
sahlins% perl -MTest::Harness -le 'print Test::Harness->VERSION'
2.40
sahlins% perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=freebsd, osvers=4.8-stable, archname=i386-freebsd
uname='freebsd sahlins.kineticode.com 4.8-stable freebsd 4.8-stable
#0: thu may 29 15:09:07 edt 2003 cap@pb14.pair.com:usrsrcsyscompilepaird
i386 '
config_args='-des -Dprefix=/usr/local
-Dperladmin=david@kineticode.com -Dcf_email=david@kineticode.com'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H
-fno-strict-aliasing -I/usr/local/include',
optimize='-O',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing
-I/usr/local/include'
ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -ldb -lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under freebsd
Compiled at Nov 5 2003 17:06:51
@INC:
/usr/local/lib/perl5/5.8.2/i386-freebsd
/usr/local/lib/perl5/5.8.2
/usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd
/usr/local/lib/perl5/site_perl/5.8.2
/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl/5.005
/usr/local/lib/perl5/site_perl
.