Skip to content

Commit 008de5d

Browse files
Use environment variable for jobs in test.pl
1 parent 1e7f2bc commit 008de5d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

regression/test.pl

+7-2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ ($$$$)
257257
-c CMD run tests on CMD - required option
258258
-i <regex> options in test.desc matching the specified perl regex are ignored
259259
-j <num> run <num> tests in parallel (requires Thread::Pool::Simple)
260+
if present, the environment variable TESTPL_JOBS is used as the default
260261
-n dry-run: print the tests that would be run, but don't actually run them
261262
-p print logs of each failed test (if any)
262263
-h show this help and exit
@@ -304,11 +305,15 @@ ($$$$)
304305
$main::VERSION = 0.1;
305306
$Getopt::Std::STANDARD_HELP_VERSION = 1;
306307
our ($opt_c, $opt_i, $opt_j, $opt_n, $opt_p, $opt_h, $opt_C, $opt_T, $opt_F, $opt_K, %defines, @include_tags, @exclude_tags); # the variables for getopt
307-
$opt_j = 0;
308308
GetOptions("D=s" => \%defines, "X=s" => \@exclude_tags, "I=s" => \@include_tags);
309309
getopts('c:i:j:nphCTFK') or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
310310
$opt_c or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
311-
(!$opt_j || $has_thread_pool) or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
311+
$opt_j = $opt_j || $ENV{'TESTPL_JOBS'} || 0;
312+
if($opt_j && $opt_j != 1 && !$has_thread_pool) {
313+
warn "Jobs set but thread pool module not found,\n"
314+
. "install with 'cpan -i Thread::Pool::Simple'\n"
315+
. "Or avoid setting the -j parameter or the TESTPL_JOBS variable\n";
316+
}
312317
$opt_h and &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
313318
my $t_level = 0;
314319
$t_level += 2 if($opt_T);

0 commit comments

Comments
 (0)