develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [PATCH 5.8.2 @21574] make tests relocatable

Thread Previous | Thread Next
From:
Alan Burlison
Date:
November 13, 2003 13:22
Subject:
Re: [PATCH 5.8.2 @21574] make tests relocatable
Message ID:
3FB3F5E2.1030703@sun.com
Ilya Zakharevich wrote:

> Running the following script in the root of Perl distribution will fix most of
> the tests in ./t to be relocatable.  All it does is replace
> 
>   @INC = '../lib';	# and some clones thereof
> 
> by
> 
>   @INC = '../lib' unless \$ENV{PERLTEST_KEEP_INC};

Shouldn't the entire BEGIN block just be ripped out from all the tests 
rather than being modified?  According to TestInit.pm:

# This is a replacement for the old BEGIN preamble which heads (or
# should head) up every core test program to prepare it for running.
# Now instead of:
#
# BEGIN {
#   chdir 't' if -d 't';
#   @INC = '../lib';
# }
#
# t/TEST will use -MTestInit.  You may "use TestInit" in the test
# programs but it is not required.

I'm not sure if harness also does the right thing though.

Perhaps the simplest way of doing this is for TEST to set PERL5LIB by 
default, and allow an override, e.g.

$ cd t; ./TEST			# Sets PERL5LIB to '../lib'
$ cd t; ./TEST -perl5lib=/foo	# Sets PERL5LIB to '/foo'

I'm also far from clear why each test script needs the
	chdir 't' if -d 't';
surely that only needs to be done once in TEST?  If this is correct then 
*all* the BEGIN blocks *and* TestInit.pm could be done away with.

-- 
Alan Burlison
--


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About