diff --git a/regression/test.pl b/regression/test.pl index dcb3ed7acd6..92639accd3f 100755 --- a/regression/test.pl +++ b/regression/test.pl @@ -257,6 +257,7 @@ ($$$$) -c CMD run tests on CMD - required option -i options in test.desc matching the specified perl regex are ignored -j run tests in parallel (requires Thread::Pool::Simple) + if present, the environment variable TESTPL_JOBS is used as the default -n dry-run: print the tests that would be run, but don't actually run them -p print logs of each failed test (if any) -h show this help and exit @@ -304,11 +305,15 @@ ($$$$) $main::VERSION = 0.1; $Getopt::Std::STANDARD_HELP_VERSION = 1; 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 -$opt_j = 0; GetOptions("D=s" => \%defines, "X=s" => \@exclude_tags, "I=s" => \@include_tags); getopts('c:i:j:nphCTFK') or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, ""); $opt_c or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, ""); -(!$opt_j || $has_thread_pool) or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, ""); +$opt_j = $opt_j || $ENV{'TESTPL_JOBS'} || 0; +if($opt_j && $opt_j != 1 && !$has_thread_pool) { + warn "Jobs set but thread pool module not found,\n" + . "install with 'cpan -i Thread::Pool::Simple'\n" + . "Or avoid setting the -j parameter or the TESTPL_JOBS variable\n"; +} $opt_h and &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, ""); my $t_level = 0; $t_level += 2 if($opt_T);