Subject: | Fails tests with long @INC |
I get this error:
Can't exec "/bin/sh": Argument list too long at t/12-fail.t line 53.
when testing large numbers of modules under the CPAN shell.
A better way to pass @INC to subprocesses is not to use -Idir, but the PERL5LIB env var.
The attached patch makes it work; it can run the test any of four ways:
$ perl -Mblib t/12-fail.t
$ perl -Ilib t/12-fail.t
$ make test
Show quoted text
cpan> test Test::EOL
Subject: | open_Pb1MlVEu.txt |
diff -rup Test-EOL-2.00-1/t/12-fail.t Test-EOL-2.00-0/t/12-fail.t
--- Test-EOL-2.00-1/t/12-fail.t 2017-10-30 08:20:29.000000000 -0700
+++ Test-EOL-2.00-0/t/12-fail.t 2017-10-30 08:27:40.000000000 -0700
@@ -5,8 +5,8 @@ use Test::More qw(no_plan);
use File::Temp qw( tempdir tempfile );
my $perl = $^X || 'perl';
-my $inc = join(' -I ', map { qq{"$_"} } @INC) || '';
-$inc = "-I $inc" if $inc;
+require Config;
+my $inc = join($Config::Config{path_sep}, @INC) || '';
{
my ( $dir, $filename ) = make_raw_badfile();
@@ -50,7 +50,8 @@ sub run_ok {
die "code containing double quotes is not portable on Win32 in one-liners at $file $line.\n" if $code =~ /"/;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my (undef, $outfile) = tempfile();
- is( `$perl $inc -MTest::EOL -e "$code" > $outfile 2>&1`, '', "test sub program: output redirected" );
+ local $ENV{PERL5LIB} = $inc;
+ is( `$perl -MTest::EOL -e "$code" > $outfile 2>&1`, '', "test sub program: output redirected" );
is( $? >> 8, 1, "test sub program: exit code is 1" );
local $/ = undef;
open my $fh, '<', $outfile or die "Can't open $outfile: $!";