Subject: | Number of items in @INC scales with -j and process-number |
The attached script generates a directory structure that replicates this problem, and then the output of concatting the various per-pid output files shows how some pid's get much larger @INC's, despite the code itself not changing.
But the general problem is essentially
prove -j4 a b c d
Results in a getting 1x lib, b getting 2 x lib, c getting 3x lib, d getting 4xlib, etc ( but not necessarily in that order or distribution, its kinda random )
The only good part is it seems to cap out at -jN, and for some reason it gives the impression once N is reached it goes back to alternating between one and 2x lib.
But its not great.
Subject: | test.pl |
#!/usr/bin/env perl
# ABSTRACT: Make sure prove doesn't daisychain lib
use strict;
use warnings;
use File::Temp qw( tempdir );
my $n_jobs = 20;
my $tempdir = tempdir( TEMPDIR => 1 );
my $target = quotemeta("$tempdir/inc");
my $content = <<"EOF";
open my \$fh, '>>', \"$target-\$\$\";
for my \$entry ( \@INC ) {
print { \$fh } "\$entry\n";
}
close \$fh;
EOF
for my $job ( 1 .. $n_jobs ) {
open my $fh, '>', "$tempdir/test-$job.t";
print {$fh} $content;
close $fh;
}
system("prove","-lj${n_jobs}",map { "$tempdir/test-$_.t" } 1 .. $n_jobs );
system("grep '' \"$tempdir/inc-\"*");