1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Automerge with 5.1

This commit is contained in:
Michael Widenius
2010-08-25 01:44:50 +03:00
167 changed files with 1625 additions and 925 deletions

View File

@ -39,7 +39,6 @@ our $enable_disabled;
our $default_storage_engine;
our $opt_with_ndbcluster_only;
our $defaults_file;
our $defaults_extra_file;
our $quick_collect;
sub collect_option {
@ -68,21 +67,10 @@ require "mtr_misc.pl";
my $do_test_reg;
my $skip_test_reg;
# Related to adding InnoDB plugin combinations
my $lib_innodb_plugin;
# If "Quick collect", set to 1 once a test to run has been found.
my $some_test_found;
sub find_innodb_plugin {
$lib_innodb_plugin=
my_find_file($::basedir,
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
"lib/mysql/plugin", "lib/plugin"],
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
"ha_innodb_plugin.sl"],
NOT_REQUIRED);
}
my $default_suite_object = do 'My/Suite.pm';
sub init_pattern {
my ($from, $what)= @_;
@ -116,8 +104,6 @@ sub collect_test_cases ($$$) {
$do_test_reg= init_pattern($do_test, "--do-test");
$skip_test_reg= init_pattern($skip_test, "--skip-test");
&find_innodb_plugin;
# If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
# This also effects some logic in the loop following this.
@ -188,17 +174,17 @@ sub collect_test_cases ($$$) {
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
$sort_criteria{$tinfo->{name}} = join(" ", @criteria);
$sort_criteria{$tinfo->fullname()} = join(" ", @criteria);
}
@$cases = sort {
$sort_criteria{$a->{'name'}} . $a->{'name'} cmp
$sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
$sort_criteria{$a->fullname()} . $a->fullname() cmp
$sort_criteria{$b->fullname()} . $b->fullname() } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
# print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
# print $sort_criteria{$tinfo->fullname()}," -> \t",$tinfo->fullname(),"\n";
# }
}
@ -310,6 +296,17 @@ sub collect_one_suite
mtr_verbose("testdir: $testdir");
mtr_verbose("resdir: $resdir");
#
# Load the Suite object
#
unless ($::suites{$suite}) {
if (-f "$suitedir/suite.pm") {
$::suites{$suite} = do "$suitedir/suite.pm";
} else {
$::suites{$suite} = $default_suite_object;
}
}
# ----------------------------------------------------------------------
# Build a hash of disabled testcases for this suite
# ----------------------------------------------------------------------
@ -438,14 +435,16 @@ sub collect_one_suite
{
# Read combinations file in my.cnf format
mtr_verbose("Read combinations file");
my %env_filter = map { $_ => 1 } split /:/, $ENV{"\U${suite}_COMBINATIONS"};
my $config= My::Config->new($combination_file);
foreach my $group ($config->groups()) {
my $comb= {};
$comb->{name}= $group->name();
next if %env_filter and not $env_filter{$comb->{name}};
foreach my $option ( $group->options() ) {
push(@{$comb->{comb_opt}}, $option->option());
}
push(@combinations, $comb);
push(@combinations, $comb) if $comb->{comb_opt};
}
}
@ -539,28 +538,7 @@ sub optimize_cases {
# support it
# =======================================================
#print "binlog_format: $binlog_format\n";
if (defined $binlog_format )
{
# =======================================================
# Fixed --binlog-format=x specified on command line
# =======================================================
if ( defined $tinfo->{'binlog_formats'} )
{
#print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n";
# The test supports different binlog formats
# check if the selected one is ok
my $supported=
grep { $_ eq $binlog_format } @{$tinfo->{'binlog_formats'}};
if ( !$supported )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}=
"Doesn't support --binlog-format='$binlog_format'";
}
}
}
else
if (not defined $binlog_format )
{
# =======================================================
# Use dynamic switching of binlog format
@ -623,10 +601,6 @@ sub optimize_cases {
$tinfo->{'ndb_test'}= 1
if ( $default_engine =~ /^ndb/i );
$tinfo->{'innodb_test'}= 1
if ( $default_engine =~ /^innodb/i );
$tinfo->{'pbxt_test'}= 1
if ( $default_engine =~ /^pbxt/i );
}
}
@ -758,7 +732,7 @@ sub collect_one_test_case {
name => "$suitename.$tname",
shortname => $tname,
path => "$testdir/$filename",
suite => $suitename,
);
my $result_file= "$resdir/$tname.result";
@ -880,7 +854,7 @@ sub collect_one_test_case {
if ( -f "$testdir/$tname.slave-mi");
tags_from_test_file($tinfo,"$testdir/${tname}.test");
my @source_files = tags_from_test_file($tinfo,"$testdir/${tname}.test");
# Get default storage engine from suite.opt file
@ -897,12 +871,6 @@ sub collect_one_test_case {
$tinfo->{'ndb_test'}= 1
if ( $local_default_storage_engine =~ /^ndb/i );
$tinfo->{'innodb_test'}= 1
if ( $local_default_storage_engine =~ /^innodb/i );
$tinfo->{'pbxt_test'}= 1
if ( $local_default_storage_engine =~ /^pbxt/i );
}
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
@ -949,72 +917,6 @@ sub collect_one_test_case {
}
}
if ($tinfo->{'federated_test'})
{
# This is a test that needs federated, enable it
push(@{$tinfo->{'master_opt'}}, "--loose-federated");
push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
}
if ( $tinfo->{'innodb_test'} )
{
# This is a test that needs innodb
if ( $::mysqld_variables{'innodb'} eq "OFF" ||
! exists $::mysqld_variables{'innodb'} )
{
# innodb is not supported, skip it
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No innodb support";
return $tinfo;
}
}
elsif ( $tinfo->{'innodb_plugin_test'} )
{
# This is a test that needs the innodb plugin
if (&find_innodb_plugin)
{
my $sep= (IS_WINDOWS) ? ';' : ':';
my $plugin_filename= basename($lib_innodb_plugin);
my $plugin_list=
"innodb=$plugin_filename$sep" .
"innodb_trx=$plugin_filename$sep" .
"innodb_locks=$plugin_filename$sep" .
"innodb_lock_waits=$plugin_filename$sep" .
"innodb_cmp=$plugin_filename$sep" .
"innodb_cmp_reset=$plugin_filename$sep" .
"innodb_cmpmem=$plugin_filename$sep" .
"innodb_cmpmem_reset=$plugin_filename";
foreach my $k ('master_opt', 'slave_opt') {
push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
}
}
}
else
{
push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb");
}
if ( $tinfo->{'need_binlog'} )
{
if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test needs binlog";
return $tinfo;
}
}
else
{
# Test does not need binlog, add --skip-binlog to
# the options used when starting
push(@{$tinfo->{'master_opt'}}, "--loose-skip-log-bin");
push(@{$tinfo->{'slave_opt'}}, "--loose-skip-log-bin");
}
if ( $tinfo->{'rpl_test'} )
{
if ( $skip_rpl )
@ -1085,28 +987,6 @@ sub collect_one_test_case {
$tinfo->{template_path}= $config;
}
if ( $tinfo->{'pbxt_test'} )
{
# This is a test that needs pbxt
if ( $::mysqld_variables{'pbxt'} eq "OFF" ||
! exists $::mysqld_variables{'pbxt'} )
{
# Engine is not supported, skip it
$tinfo->{'skip'}= 1;
return $tinfo;
}
}
else
{
# Only disable engine if it's on by default (to avoid warnings about
# not existing loose options
if ( $::mysqld_variables{'pbxt'} eq "ON")
{
push(@{$tinfo->{'master_opt'}}, "--loose-skip-pbxt");
push(@{$tinfo->{'slave_opt'}}, "--loose-skip-pbxt");
}
}
if ( $tinfo->{'example_plugin_test'} )
{
if ( !$ENV{'HA_EXAMPLE_SO'} )
@ -1127,27 +1007,27 @@ sub collect_one_test_case {
}
}
# Set extra config file to use
if (defined $defaults_extra_file) {
$tinfo->{extra_template_path}= $defaults_extra_file;
if (not ref $::suites{$tinfo->{suite}})
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= $::suites{$tinfo->{suite}};
return $tinfo;
}
# ----------------------------------------------------------------------
# Append mysqld extra options to both master and slave
# Append mysqld extra options to master and slave, as appropriate
# ----------------------------------------------------------------------
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'}}, @::opt_extra_mysqld_opt);
push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt);
# ----------------------------------------------------------------------
# Add master opts, extra options only for master
# ----------------------------------------------------------------------
process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt');
# ----------------------------------------------------------------------
# Add slave opts, list of extra option only for slave
# ----------------------------------------------------------------------
process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt');
return $tinfo;
}
@ -1157,24 +1037,6 @@ sub collect_one_test_case {
# the specified value in "tinfo"
my @tags=
(
["include/have_binlog_format_row.inc", "binlog_formats", ["row"]],
["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]],
["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]],
["include/have_binlog_format_mixed_or_row.inc",
"binlog_formats", ["mixed", "row"]],
["include/have_binlog_format_mixed_or_statement.inc",
"binlog_formats", ["mixed", "statement"]],
["include/have_binlog_format_row_or_statement.inc",
"binlog_formats", ["row", "statement"]],
["include/have_log_bin.inc", "need_binlog", 1],
["include/have_innodb.inc", "innodb_test", 1],
["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
["include/have_real.inc", "innodb_test", 1],
["include/have_real_innodb_plugin.inc", "innodb_plugin_test", 1],
["include/have_xtradb.inc", "innodb_test", 1],
["include/have_pbxt.inc", "pbxt_test", 1],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
@ -1182,7 +1044,6 @@ my @tags=
["include/master-slave.inc", "rpl_test", 1],
["include/ndb_master-slave.inc", "rpl_test", 1],
["include/ndb_master-slave.inc", "ndb_test", 1],
["federated.inc", "federated_test", 1],
["include/not_embedded.inc", "not_embedded", 1],
["include/not_valgrind.inc", "not_valgrind", 1],
["include/have_example_plugin.inc", "example_plugin_test", 1],
@ -1196,6 +1057,7 @@ sub tags_from_test_file {
my $file= shift;
#mtr_verbose("$file");
my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!");
my @all_files=($file);
while ( my $line= <$F> )
{
@ -1231,13 +1093,13 @@ sub tags_from_test_file {
# Only source the file if it exists, we may get
# false positives in the regexes above if someone
# writes "source nnnn;" in a test case(such as mysqltest.test)
tags_from_test_file($tinfo, $sourced_file);
unshift @all_files, tags_from_test_file($tinfo, $sourced_file);
last;
}
}
}
}
@all_files;
}
sub unspace {
@ -1250,6 +1112,7 @@ sub unspace {
sub opts_from_file ($) {
my $file= shift;
local $_;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my @args;