Skip to content

Commit

Permalink
fixed TESTS= in make test to allow multiple tests
Browse files Browse the repository at this point in the history
Now you can do: make test TESTS="test1 test2" and it will run those
two tests, each matching tests using a case insensitive substring
match
  • Loading branch information
Andrew Tridgell committed Aug 14, 2009
1 parent 7a82aed commit 2d7b457
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions selftest/selftest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ ()

ShowHelp() if ($opt_help);

my $tests = shift;
my @tests = @ARGV;

# quick hack to disable rpc validation when using valgrind - its way too slow
unless (defined($ENV{VALGRIND})) {
Expand Down Expand Up @@ -591,6 +591,20 @@ ($$)

my %required_envs = ();

sub should_run_test($)
{
my $name = shift;
if ($#tests == -1) {
return 1;
}
for (my $i=0; $i <= $#tests; $i++) {
if ($name =~ /$tests[$i]/i) {
return 1;
}
}
return 0;
}

sub read_testlist($)
{
my ($filename) = @_;
Expand All @@ -606,7 +620,7 @@ ($)
$env =~ s/\n//g;
my $cmdline = <IN>;
$cmdline =~ s/\n//g;
if (not defined($tests) or $name =~ /$tests/) {
if (should_run_test($name) == 1) {
$required_envs{$env} = 1;
push (@ret, [$name, $env, $cmdline]);
}
Expand Down

0 comments on commit 2d7b457

Please sign in to comment.