mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
mtr changes:
* expanding unknown env variable does not abort mtr * have_archive, blackhole, innodb - preload the corresponding engine * all options from .opt files get equal treatment, all are searched for special options, not only -{master,slave}.opt as before (which ignored suite.opt and --mysqld=...) * --plugin-load gets special treatment too - all instances are merged into one * federated test fixed to preload federated
This commit is contained in:
parent
1aa3b02c51
commit
9bc9855c16
13 changed files with 113 additions and 100 deletions
|
@ -20,11 +20,18 @@ subdirectories under the suitedir or directly in the suitedir
|
|||
(that is suitedir/t/*.test or suitedir/*.test, same for *.result))
|
||||
|
||||
==========================
|
||||
A suite can contain a suite.opt file - at the same location where .test
|
||||
files are. As usual, the .opt file can use $-substitutions for the
|
||||
environment variables.
|
||||
A suite can contain a suite.opt file - at the same location where .test files
|
||||
are or in the suite directory. As usual, the .opt file can use $-substitutions
|
||||
for the environment variables.
|
||||
|
||||
Usually, using my.cnf template (see below) is preferrable.
|
||||
|
||||
But command line options (.opt files and combinations file) get special
|
||||
treatment - they can have special options that affect mtr behavior. cnf
|
||||
files cannot. Special options are
|
||||
--timezone, --plugin-load, --result-file, --config-file-template,
|
||||
--default-time-zone, --force-restart
|
||||
|
||||
==========================
|
||||
A suite can have suite.pm file in the suitedir. It must declare a
|
||||
package that inherits from My::Suite.
|
||||
|
@ -108,8 +115,8 @@ Most probably a suite my.cnf will need to start from
|
|||
!include include/default_my.cnf
|
||||
|
||||
and then modify the configuration as necessary.
|
||||
==========================
|
||||
|
||||
==========================
|
||||
A suite can have combinations file in the suitedir. It uses my.cnf syntax
|
||||
but it cannot use @-substitutions. Instead, it can use $-substitutions for
|
||||
the environment variables. Because the combination options will not be
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
--disable_query_log
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'archive';
|
||||
--enable_query_log
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'archive'`){
|
||||
skip Need archive engine;
|
||||
}
|
||||
|
|
2
mysql-test/include/have_archive.opt
Normal file
2
mysql-test/include/have_archive.opt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--loose-archive
|
||||
--plugin-load=$HA_ARCHIVE_SO
|
2
mysql-test/include/have_blackhole.opt
Normal file
2
mysql-test/include/have_blackhole.opt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--loose-blackhole
|
||||
--plugin-load=$HA_BLACKHOLE_SO
|
|
@ -1 +1,2 @@
|
|||
--loose-innodb
|
||||
--plugin-load=$HA_XTRADB_SO
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'pbxt';
|
||||
enable_query_log;
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'pbxt'`){
|
||||
skip Need PBXT engine;
|
||||
}
|
||||
|
|
|
@ -325,12 +325,8 @@ sub collect_one_suite
|
|||
}
|
||||
|
||||
# Read suite.opt file
|
||||
my $suite_opt_file= "$testdir/suite.opt";
|
||||
my $suite_opts= [];
|
||||
if ( -f $suite_opt_file )
|
||||
{
|
||||
$suite_opts= opts_from_file($suite_opt_file);
|
||||
}
|
||||
my $suite_opts= [ opts_from_file("$testdir/suite.opt") ];
|
||||
$suite_opts = [ opts_from_file("$suitedir/suite.opt") ] unless @$suite_opts;
|
||||
|
||||
if ( @$opt_cases )
|
||||
{
|
||||
|
@ -618,67 +614,78 @@ sub optimize_cases {
|
|||
# Read options from the given opt file and append them as an array
|
||||
# to $tinfo->{$opt_name}
|
||||
#
|
||||
sub process_opts_file {
|
||||
my ($tinfo, $opt_file, $opt_name)= @_;
|
||||
sub process_opts {
|
||||
my ($tinfo, $opt_name)= @_;
|
||||
|
||||
if ( -f $opt_file )
|
||||
my @opts= @{$tinfo->{$opt_name}};
|
||||
$tinfo->{$opt_name} = [];
|
||||
|
||||
my @plugins;
|
||||
|
||||
foreach my $opt (@opts)
|
||||
{
|
||||
my $opts= opts_from_file($opt_file);
|
||||
my $value;
|
||||
|
||||
foreach my $opt ( @$opts )
|
||||
# The opt file is used both to send special options to the mysqld
|
||||
# as well as pass special test case specific options to this
|
||||
# script
|
||||
|
||||
$value= mtr_match_prefix($opt, "--timezone=");
|
||||
if ( defined $value )
|
||||
{
|
||||
my $value;
|
||||
|
||||
# The opt file is used both to send special options to the mysqld
|
||||
# as well as pass special test case specific options to this
|
||||
# script
|
||||
|
||||
$value= mtr_match_prefix($opt, "--timezone=");
|
||||
if ( defined $value )
|
||||
{
|
||||
$tinfo->{'timezone'}= $value;
|
||||
next;
|
||||
}
|
||||
|
||||
$value= mtr_match_prefix($opt, "--result-file=");
|
||||
if ( defined $value )
|
||||
{
|
||||
# Specifies the file mysqltest should compare
|
||||
# output against
|
||||
$tinfo->{'result_file'}= "r/$value.result";
|
||||
next;
|
||||
}
|
||||
|
||||
$value= mtr_match_prefix($opt, "--config-file-template=");
|
||||
if ( defined $value)
|
||||
{
|
||||
# Specifies the configuration file to use for this test
|
||||
$tinfo->{'template_path'}= dirname($tinfo->{path})."/$value";
|
||||
next;
|
||||
}
|
||||
|
||||
# If we set default time zone, remove the one we have
|
||||
$value= mtr_match_prefix($opt, "--default-time-zone=");
|
||||
if ( defined $value )
|
||||
{
|
||||
# Set timezone for this test case to something different
|
||||
$tinfo->{'timezone'}= "GMT-8";
|
||||
# Fallthrough, add the --default-time-zone option
|
||||
}
|
||||
|
||||
# The --restart option forces a restart even if no special
|
||||
# option is set. If the options are the same as next testcase
|
||||
# there is no need to restart after the testcase
|
||||
# has completed
|
||||
if ( $opt eq "--force-restart" )
|
||||
{
|
||||
$tinfo->{'force_restart'}= 1;
|
||||
next;
|
||||
}
|
||||
|
||||
# Ok, this was a real option, add it
|
||||
push(@{$tinfo->{$opt_name}}, $opt);
|
||||
$tinfo->{'timezone'}= $value;
|
||||
next;
|
||||
}
|
||||
|
||||
$value= mtr_match_prefix($opt, "--plugin-load=");
|
||||
if (defined $value)
|
||||
{
|
||||
push @plugins, $value;
|
||||
next;
|
||||
}
|
||||
|
||||
$value= mtr_match_prefix($opt, "--result-file=");
|
||||
if ( defined $value )
|
||||
{
|
||||
# Specifies the file mysqltest should compare
|
||||
# output against
|
||||
$tinfo->{'result_file'}= "r/$value.result";
|
||||
next;
|
||||
}
|
||||
|
||||
$value= mtr_match_prefix($opt, "--config-file-template=");
|
||||
if ( defined $value)
|
||||
{
|
||||
# Specifies the configuration file to use for this test
|
||||
$tinfo->{'template_path'}= dirname($tinfo->{path})."/$value";
|
||||
next;
|
||||
}
|
||||
|
||||
# If we set default time zone, remove the one we have
|
||||
$value= mtr_match_prefix($opt, "--default-time-zone=");
|
||||
if ( defined $value )
|
||||
{
|
||||
# Set timezone for this test case to something different
|
||||
$tinfo->{'timezone'}= "GMT-8";
|
||||
# Fallthrough, add the --default-time-zone option
|
||||
}
|
||||
|
||||
# The --restart option forces a restart even if no special
|
||||
# option is set. If the options are the same as next testcase
|
||||
# there is no need to restart after the testcase
|
||||
# has completed
|
||||
if ( $opt eq "--force-restart" )
|
||||
{
|
||||
$tinfo->{'force_restart'}= 1;
|
||||
next;
|
||||
}
|
||||
|
||||
# Ok, this was a real option, add it
|
||||
push(@{$tinfo->{$opt_name}}, $opt);
|
||||
}
|
||||
|
||||
if (@plugins) {
|
||||
push @{$tinfo->{$opt_name}}, "--plugin-load=" . join(':', @plugins);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,15 +1016,17 @@ sub collect_one_test_case {
|
|||
# ----------------------------------------------------------------------
|
||||
for (@source_files) {
|
||||
s/\.\w+$//;
|
||||
process_opts_file($tinfo, "$_.opt", 'master_opt');
|
||||
process_opts_file($tinfo, "$_.opt", 'slave_opt');
|
||||
process_opts_file($tinfo, "$_-master.opt", 'master_opt');
|
||||
process_opts_file($tinfo, "$_-slave.opt", 'slave_opt');
|
||||
push @{$tinfo->{master_opt}}, opts_from_file("$_.opt");
|
||||
push @{$tinfo->{slave_opt}}, opts_from_file("$_.opt");
|
||||
push @{$tinfo->{master_opt}}, opts_from_file("$_-master.opt");
|
||||
push @{$tinfo->{slave_opt}}, opts_from_file("$_-slave.opt");
|
||||
}
|
||||
|
||||
push(@{$tinfo->{'master_opt'}}, @::opt_extra_mysqld_opt);
|
||||
push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt);
|
||||
|
||||
process_opts($tinfo, 'master_opt');
|
||||
process_opts($tinfo, 'slave_opt');
|
||||
|
||||
return $tinfo;
|
||||
}
|
||||
|
@ -1103,6 +1112,8 @@ sub opts_from_file ($) {
|
|||
my $file= shift;
|
||||
local $_;
|
||||
|
||||
return () unless -f $file;
|
||||
|
||||
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
my @args;
|
||||
while ( <FILE> )
|
||||
|
@ -1143,7 +1154,7 @@ sub opts_from_file ($) {
|
|||
}
|
||||
}
|
||||
close FILE;
|
||||
return \@args;
|
||||
return @args;
|
||||
}
|
||||
|
||||
sub print_testcases {
|
||||
|
|
|
@ -3564,8 +3564,9 @@ sub timezone {
|
|||
my ($tinfo)= @_;
|
||||
local $_ = $tinfo->{timezone};
|
||||
return 'DEFAULT' unless defined $_;
|
||||
s/\$\{(\w+)\}/envsubst($1)/ge;
|
||||
s/\$(\w+)/envsubst($1)/ge;
|
||||
no warnings 'uninitialized';
|
||||
s/\$\{(\w+)\}/$ENV{$1}/ge;
|
||||
s/\$(\w+)/$ENV{$1}/ge;
|
||||
$_;
|
||||
}
|
||||
|
||||
|
@ -5071,18 +5072,6 @@ sub started { return grep(defined $_, map($_->{proc}, @_)); }
|
|||
sub stopped { return grep(!defined $_, map($_->{proc}, @_)); }
|
||||
|
||||
|
||||
sub envsubst {
|
||||
my $string= shift;
|
||||
|
||||
if ( ! defined $ENV{$string} )
|
||||
{
|
||||
mtr_error(".opt file references '$string' which is not set");
|
||||
}
|
||||
|
||||
return $ENV{$string};
|
||||
}
|
||||
|
||||
|
||||
sub get_extra_opts {
|
||||
my ($mysqld, $tinfo)= @_;
|
||||
|
||||
|
@ -5093,8 +5082,9 @@ sub get_extra_opts {
|
|||
# Expand environment variables
|
||||
foreach my $opt ( @$opts )
|
||||
{
|
||||
$opt =~ s/\$\{(\w+)\}/envsubst($1)/ge;
|
||||
$opt =~ s/\$(\w+)/envsubst($1)/ge;
|
||||
no warnings 'uninitialized';
|
||||
$opt =~ s/\$\{(\w+)\}/$ENV{$1}/ge;
|
||||
$opt =~ s/\$(\w+)/$ENV{$1}/ge;
|
||||
}
|
||||
return $opts;
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb
|
|
@ -3,10 +3,8 @@
|
|||
|
||||
[mysqld.1]
|
||||
log-bin= master-bin
|
||||
loose-federated
|
||||
|
||||
[mysqld.2]
|
||||
loose-federated
|
||||
|
||||
[ENV]
|
||||
MASTER_MYPORT= @mysqld.1.port
|
||||
|
|
2
mysql-test/suite/federated/suite.opt
Normal file
2
mysql-test/suite/federated/suite.opt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--federated
|
||||
--plugin-load=$HA_FEDERATEDX_SO
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
if (`SELECT $PS_PROTOCOL = 0`)
|
||||
{
|
||||
--skip Need prepared statement protocol
|
||||
--skip Need ps-protocol
|
||||
}
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue