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

Re: [PATCH 5.8.2 @21574] make tests relocatable

Thread Previous | Thread Next
Rafael Garcia-Suarez
November 6, 2003 14:46
Re: [PATCH 5.8.2 @21574] make tests relocatable
Message ID:
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};
> The patch which follows the script updates the tests tools for a run from a
> different directory.

I played a bit with it ; very interesting.

I ran the bleadperl core test suite with perl 5.8.0 -- and had an impressive
number of failures. I had to disable the protection in t/TEST against
t/base/*.t tests failing (I suggest to disable it whenever PERLTEST_KEEP_INC
is set.)

I consider this patch to be esp. interesting for the 5.6 and 5.8
maintainance branches, to find out what kind of breakage one can expect
by upgrading :)

There's a minor flaw, however : if one wants to run the full core test
suite, lib/[a-z]*.t should be patched as well.

I wonder, however, if one can't find a less intrusive and more correct
way to prevent tests to mess with @INC ; for example, make PL_incgv
point to a dummy array at BEGIN time, and restore it at INIT time.
This could be done in a module loadable via t/TEST on the perl command

(hey, this could even be an Acme module. This could even be the first
core Acme module.)

Please find below some complementary draft doc for it (did I miss something?)

--- pod/perlhack.pod	(revision 2811)
+++ pod/perlhack.pod	(working copy)
@@ -1901,6 +1901,19 @@
+You can also run the core tests against an installed perl. For example,
+to check the perl5.8.0 that comes with your system, you can issue
+    PERL=perl5.8.0 PERLTEST_KEEP_INC=1 perl5.8.0 TEST -core
+The C<PERLTEST_KEEP_INC> environment variable prevents the tests that
+are under F<t/> to modify @INC, so the original @INC of your perl 5.8.0
+will be used.  (You need to set C<PERL> as well, see above.)  When
+C<PERLTEST_KEEP_INC> is set, F<t/TEST> will not abort if a base test
+fails.  You can also set C<PERLTEST_DIR> to the directory where the core
+tests reside, if it's not C<.>.  (Those environment variables are only
+recognized by F<t/TEST>.)
 Sometimes it helps to use external tools while debugging and

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