mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
WL#3949. Added an option for support "combinations" of mysqld arguments for a suite
This commit is contained in:
parent
8f8fa8c0ec
commit
6c67d11f20
2 changed files with 104 additions and 0 deletions
|
@ -214,17 +214,44 @@ sub collect_one_suite($$)
|
||||||
|
|
||||||
mtr_verbose("Collecting: $suite");
|
mtr_verbose("Collecting: $suite");
|
||||||
|
|
||||||
|
my $combination_file= "combinations";
|
||||||
|
my $combinations = [];
|
||||||
|
|
||||||
my $suitedir= "$::glob_mysql_test_dir"; # Default
|
my $suitedir= "$::glob_mysql_test_dir"; # Default
|
||||||
|
my $combination_file= "$::glob_mysql_test_dir/$combination_file";
|
||||||
if ( $suite ne "main" )
|
if ( $suite ne "main" )
|
||||||
{
|
{
|
||||||
$suitedir= mtr_path_exists("$suitedir/suite/$suite",
|
$suitedir= mtr_path_exists("$suitedir/suite/$suite",
|
||||||
"$suitedir/$suite");
|
"$suitedir/$suite");
|
||||||
mtr_verbose("suitedir: $suitedir");
|
mtr_verbose("suitedir: $suitedir");
|
||||||
|
$combination_file= "$suitedir/$combination_file";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $testdir= "$suitedir/t";
|
my $testdir= "$suitedir/t";
|
||||||
my $resdir= "$suitedir/r";
|
my $resdir= "$suitedir/r";
|
||||||
|
|
||||||
|
if (!@::opt_combination)
|
||||||
|
{
|
||||||
|
# Read combinations file
|
||||||
|
if ( open(COMB,$combination_file) )
|
||||||
|
{
|
||||||
|
while (<COMB>)
|
||||||
|
{
|
||||||
|
chomp;
|
||||||
|
s/\ +/ /g;
|
||||||
|
push (@$combinations, $_) unless ($_ eq '');
|
||||||
|
}
|
||||||
|
close COMB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# take the combination from command-line
|
||||||
|
@$combinations = @::opt_combination;
|
||||||
|
}
|
||||||
|
# Remember last element position
|
||||||
|
my $begin_index = $#{@$cases} + 1;
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Build a hash of disabled testcases for this suite
|
# Build a hash of disabled testcases for this suite
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
@ -335,6 +362,78 @@ sub collect_one_suite($$)
|
||||||
closedir TESTDIR;
|
closedir TESTDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Proccess combinations only if new tests were added
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
if ($combinations && $begin_index <= $#{@$cases})
|
||||||
|
{
|
||||||
|
my $end_index = $#{@$cases};
|
||||||
|
my $is_copy;
|
||||||
|
# Keep original master/slave options
|
||||||
|
my @orig_opts;
|
||||||
|
for (my $idx = $begin_index; $idx <= $end_index; $idx++)
|
||||||
|
{
|
||||||
|
foreach my $param (('master_opt','slave_opt','slave_mi'))
|
||||||
|
{
|
||||||
|
@{$orig_opts[$idx]{$param}} = @{$cases->[$idx]->{$param}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $comb_index = 1;
|
||||||
|
# Copy original test cases
|
||||||
|
foreach my $comb_set (@$combinations)
|
||||||
|
{
|
||||||
|
for (my $idx = $begin_index; $idx <= $end_index; $idx++)
|
||||||
|
{
|
||||||
|
my $test = $cases->[$idx];
|
||||||
|
my $copied_test = {};
|
||||||
|
foreach my $param (keys %{$test})
|
||||||
|
{
|
||||||
|
# Scalar. Copy as is.
|
||||||
|
$copied_test->{$param} = $test->{$param};
|
||||||
|
# Array. Copy reference instead itself
|
||||||
|
if ($param =~ /(master_opt|slave_opt|slave_mi)/)
|
||||||
|
{
|
||||||
|
my $new_arr = [];
|
||||||
|
@$new_arr = @{$orig_opts[$idx]{$param}};
|
||||||
|
$copied_test->{$param} = $new_arr;
|
||||||
|
}
|
||||||
|
elsif ($param =~ /(comment|combinations)/)
|
||||||
|
{
|
||||||
|
$copied_test->{$param} = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($is_copy)
|
||||||
|
{
|
||||||
|
push(@$cases, $copied_test);
|
||||||
|
$test = $cases->[$#{@$cases}];
|
||||||
|
}
|
||||||
|
foreach my $comb_opt (split(/ /,$comb_set))
|
||||||
|
{
|
||||||
|
push(@{$test->{'master_opt'}},$comb_opt);
|
||||||
|
push(@{$test->{'slave_opt'}},$comb_opt);
|
||||||
|
# Enable rpl if added option is --binlog-format and test case supports that
|
||||||
|
if ($comb_opt =~ /^--binlog-format=.+$/)
|
||||||
|
{
|
||||||
|
my @opt_pairs = split(/=/, $comb_opt);
|
||||||
|
if ($test->{'binlog_format'} =~ /^$opt_pairs[1]$/ || $test->{'binlog_format'} eq '')
|
||||||
|
{
|
||||||
|
$test->{'skip'} = 0;
|
||||||
|
$test->{'comment'} = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$test->{'skip'} = 1;
|
||||||
|
$test->{'comment'} = "Requiring binlog format '$test->{'binlog_format'}'";;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$test->{'combination'} = $comb_set;
|
||||||
|
}
|
||||||
|
$is_copy = 1;
|
||||||
|
$comb_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $cases;
|
return $cases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,8 @@ our $opt_bench= 0;
|
||||||
our $opt_small_bench= 0;
|
our $opt_small_bench= 0;
|
||||||
our $opt_big_test= 0;
|
our $opt_big_test= 0;
|
||||||
|
|
||||||
|
our @opt_combination;
|
||||||
|
|
||||||
our @opt_extra_mysqld_opt;
|
our @opt_extra_mysqld_opt;
|
||||||
|
|
||||||
our $opt_compress;
|
our $opt_compress;
|
||||||
|
@ -529,6 +531,7 @@ sub command_line_setup () {
|
||||||
'skip-im' => \$opt_skip_im,
|
'skip-im' => \$opt_skip_im,
|
||||||
'skip-test=s' => \$opt_skip_test,
|
'skip-test=s' => \$opt_skip_test,
|
||||||
'big-test' => \$opt_big_test,
|
'big-test' => \$opt_big_test,
|
||||||
|
'combination=s' => \@opt_combination,
|
||||||
|
|
||||||
# Specify ports
|
# Specify ports
|
||||||
'master_port=i' => \$opt_master_myport,
|
'master_port=i' => \$opt_master_myport,
|
||||||
|
@ -5134,6 +5137,8 @@ Options to control what test suites or cases to run
|
||||||
skip-im Don't start IM, and skip the IM test cases
|
skip-im Don't start IM, and skip the IM test cases
|
||||||
big-test Set the environment variable BIG_TEST, which can be
|
big-test Set the environment variable BIG_TEST, which can be
|
||||||
checked from test cases.
|
checked from test cases.
|
||||||
|
combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
|
||||||
|
combination.
|
||||||
|
|
||||||
Options that specify ports
|
Options that specify ports
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue