Skip to content

Commit

Permalink
MTR: MTR_COMBINATIONS envvar for tests
Browse files Browse the repository at this point in the history
MTR_COMBINATIONS contains comma-separated list of currently applied
combinations "x,y,...". MTR_COMBINATION_X, MTR_COMBINATION_Y, ... are
set to 1 for this list of combinations.

Fixed dead check: non-existent element $tinfo->{combination}.

Better use this clause:

use warnings FATAL => 'uninitialized';

But this must be very well tested.
  • Loading branch information
midenok committed Dec 3, 2017
1 parent 36c0bec commit ce78baf
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions mysql-test/mysql-test-run.pl
Expand Up @@ -3758,14 +3758,32 @@ ($$)
$ENV{'MTR_TEST_NAME'} = $tinfo->{name};
resfile_report_test($tinfo) if $opt_resfile;

# Allow only alpanumerics pluss _ - + . in combination names,
# or anything beginning with -- (the latter comes from --combination)
my $combination= $tinfo->{combination};
if ($combination && $combination !~ /^\w[-\w\.\+]*$/
&& $combination !~ /^--/)
for my $key (grep { /^MTR_COMBINATION/ } keys %ENV)
{
mtr_error("Combination '$combination' contains illegal characters");
delete $ENV{$key};
}

if (ref $tinfo->{combinations} eq 'ARRAY')
{
for (my $i = 0; $i < @{$tinfo->{combinations}}; ++$i )
{
my $combination = $tinfo->{combinations}->[$i];
# Allow only alphanumerics plus _ - + . in combination names,
# or anything beginning with -- (the latter comes from --combination)
if ($combination && $combination !~ /^\w[-\w\.\+]*$/
&& $combination !~ /^--/)
{
mtr_error("Combination '$combination' contains illegal characters");
}
$ENV{"MTR_COMBINATION_". uc(${combination})} = 1;
}
$ENV{"MTR_COMBINATIONS"} = join(',', @{$tinfo->{combinations}});
}
elsif (exists $tinfo->{combinations})
{
die 'Unexpected type of $tinfo->{combinations}';
}

# -------------------------------------------------------
# Init variables that can change between each test case
# -------------------------------------------------------
Expand Down

0 comments on commit ce78baf

Please sign in to comment.