Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variable for jobs in test.pl #1925

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions regression/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ ($$$$)
-c CMD run tests on CMD - required option
-i <regex> options in test.desc matching the specified perl regex are ignored
-j <num> run <num> 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
Expand Down Expand Up @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more request: could you please document TESTPL_JOBS in the help output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Expand Down