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

Re: [PATCH 5.8.2 @21574] make tests relocatable

Thread Previous | Thread Next
Ilya Zakharevich
November 13, 2003 14:08
Re: [PATCH 5.8.2 @21574] make tests relocatable
Message ID:
On Thu, Nov 13, 2003 at 09:52:28PM +0000, Alan Burlison wrote:
> >It is crucial that an individual test can be run without the
> >intervention of TEST:
> >
> >  ./perl t/op/stat.t
> >
> >to provide as small "Perl-related environment" as possible.  E.g.,
> >consider line-ending bugs;  if
> >
> >  ./perl t/TEST op/stat.t
> >
> >fails, I do not know whether I should debug t/TEST, or t/op/stat.t.
> In the ./perl case you already have to set LD_LIBRARY_PATH to get it to 
> work if you build with;

Well, I do not need it on OS/2.

> setting PERL5LIB in the environment is hardly a great burden.

Setting PERL5LIB is not enough.  One needs to *remove* the rest from
@INC to be sure what libraries are tested.

> The problem with the existing "BEGIN { ... }" junk 
> is that it BREAKS any attempt to use PERL5LIB  as it forcibly overwrites 
> @INC

Not any more (in most scripts, my automated edit [intentionally] did
not cover some other syntaxes used to modify @INC).

> so you can't run the tests from anywhere other than $SRC/t.  Adding 
> yet another environment variable (PERLTEST_KEEP_INC) seems to be overly 
> complicated

Do you really consider

  @INC = '../lib' unless $ENV{PERLTEST_KEEP_INC};

overly complicated?  ;-)

> whe we could just rip out all the BEGIN blocks, get TEST to set
> PERL5LIB properly and simplify the whole mess.

As you see, I disagree.  IMO, this BEGIN block plays in an important
role in *simplifying* debugging.  As far as the boilerplate uses 4 or
5 "components" (such as the above @INC line), and the purpose of these
components are explained in t/README, I see no problem.

Hope this helps,

P.S.  Following this philosophy of "components",

  @INC = qw(. ../lib);

should be replaced with

  @INC = '../lib' unless $ENV{PERLTEST_KEEP_INC};
  unshift @INC, '.';

(actually, one should use $ENV{PERLTEST_DIR) || '.' instead of '.').

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About