diff options
Diffstat (limited to 'mysql-test/lib/mtr_cases.pm')
-rw-r--r-- | mysql-test/lib/mtr_cases.pm | 205 |
1 files changed, 113 insertions, 92 deletions
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 220db3d6217..1a27f94acb1 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -40,7 +40,6 @@ our $default_storage_engine; our $opt_with_ndbcluster_only; our $defaults_file; our $defaults_extra_file; -our $reorder= 1; our $quick_collect; sub collect_option { @@ -71,11 +70,20 @@ my $skip_test_reg; # Related to adding InnoDB plugin combinations my $lib_innodb_plugin; -my $do_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/mariadb/plugin", "lib/plugin"], + ["ha_innodb_plugin.dll", "ha_innodb_plugin.so", + "ha_innodb_plugin.sl"], + NOT_REQUIRED); +} + sub init_pattern { my ($from, $what)= @_; return undef unless defined $from; @@ -99,7 +107,8 @@ sub init_pattern { # ############################################################################## -sub collect_test_cases ($$) { +sub collect_test_cases ($$$) { + my $opt_reorder= shift; # True if we're reordering tests my $suites= shift; # Semicolon separated list of test suites my $opt_cases= shift; my $cases= []; # Array of hash(one hash for each testcase) @@ -107,21 +116,18 @@ sub collect_test_cases ($$) { $do_test_reg= init_pattern($do_test, "--do-test"); $skip_test_reg= init_pattern($skip_test, "--skip-test"); - $lib_innodb_plugin= - my_find_file($::basedir, - ["storage/innodb_plugin", "storage/innodb_plugin/.libs", - "lib/mysql/plugin", "lib/mariadb/plugin", "lib/plugin"], - ["ha_innodb_plugin.dll", "ha_innodb_plugin.so", - "ha_innodb_plugin.sl"], - NOT_REQUIRED); - $do_innodb_plugin= ($::mysql_version_id >= 50100 && - !(IS_WINDOWS && $::opt_embedded_server) && - $lib_innodb_plugin); + &find_innodb_plugin; - foreach my $suite (split(",", $suites)) + # 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. + if ($opt_reorder or !@$opt_cases) { - push(@$cases, collect_one_suite($suite, $opt_cases)); - last if $some_test_found; + foreach my $suite (split(",", $suites)) + { + push(@$cases, collect_one_suite($suite, $opt_cases)); + last if $some_test_found; + } } if ( @$opt_cases ) @@ -135,6 +141,7 @@ sub collect_test_cases ($$) { my ($sname, $tname, $extension)= split_testname($test_name_spec); foreach my $test ( @$cases ) { + last unless $opt_reorder; # test->{name} is always in suite.name format if ( $test->{name} =~ /.*\.$tname/ ) { @@ -144,12 +151,13 @@ sub collect_test_cases ($$) { } if ( not $found ) { + $sname= "main" if !$opt_reorder and !$sname; mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname; - # If suite was part of name, find it there - my ($this_case) = collect_one_suite($sname, [ $tname ]); - if ($this_case) + # If suite was part of name, find it there, may come with combinations + my @this_case = collect_one_suite($sname, [ $tname ]); + if (@this_case) { - push (@$cases, $this_case); + push (@$cases, @this_case); } else { @@ -159,7 +167,7 @@ sub collect_test_cases ($$) { } } - if ( $reorder && !$quick_collect) + if ( $opt_reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run my %sort_criteria; @@ -500,70 +508,6 @@ sub collect_one_suite } } - # ---------------------------------------------------------------------- - # Testing InnoDB plugin. - # ---------------------------------------------------------------------- - if ($do_innodb_plugin) - { - my @new_cases; - my $sep= (IS_WINDOWS) ? ';' : ':'; - - foreach my $test (@cases) - { - next if (!$test->{'innodb_test'}); - # If skipped due to no builtin innodb, we can still run it with plugin - next if ($test->{'skip'} && $test->{comment} ne "No innodb support"); - # Exceptions - next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk) - next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff - # innodb_file_per_table is rw with innodb_plugin - next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic'); - # innodb_lock_wait_timeout is rw with innodb_plugin - next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic'); - # Diff around innodb_thread_concurrency variable - next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic'); - # Can't work with InnoPlug. Test framework needs to be re-designed. - next if ($test->{'name'} eq 'main.innodb_bug46000'); - # Fails with innodb plugin - next if ($test->{'name'} eq 'main.innodb-autoinc'); - # Fails with innodb plugin: r6185 Testcases changes not included - next if ($test->{'name'} eq 'main.innodb_bug44369'); - # Copy test options - my $new_test= My::Test->new(); - while (my ($key, $value) = each(%$test)) - { - if (ref $value eq "ARRAY") - { - push(@{$new_test->{$key}}, @$value); - } - else - { - $new_test->{$key}= $value unless ($key eq 'skip'); - } - } - my $plugin_filename= basename($lib_innodb_plugin); - my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename"; - push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb'); - push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin)); - push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list"); - push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb'); - push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin)); - push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list"); - if ($new_test->{combination}) - { - $new_test->{combination}.= '+innodb_plugin'; - } - else - { - $new_test->{combination}= 'innodb_plugin'; - } - push(@new_cases, $new_test); - } - push(@cases, @new_cases); - } - # ---------------------------------------------------------------------- - # End of testing InnoDB plugin. - # ---------------------------------------------------------------------- optimize_cases(\@cases); #print_testcases(@cases); @@ -681,6 +625,8 @@ sub optimize_cases { if ( $default_engine =~ /^ndb/i ); $tinfo->{'innodb_test'}= 1 if ( $default_engine =~ /^innodb/i ); + $tinfo->{'pbxt_test'}= 1 + if ( $default_engine =~ /^pbxt/i ); } } @@ -778,6 +724,8 @@ sub collect_one_test_case { my $disabled= shift; my $suite_opts= shift; + my $local_default_storage_engine= $default_storage_engine; + #print "collect_one_test_case\n"; #print " suitedir: $suitedir\n"; #print " testdir: $testdir\n"; @@ -932,15 +880,26 @@ sub collect_one_test_case { tags_from_test_file($tinfo,"$testdir/${tname}.test"); - if ( defined $default_storage_engine ) + # Get default storage engine from suite.opt file + + if (defined $suite_opts && + "@$suite_opts" =~ "default-storage-engine=\s*([^\s]*)") + { + $local_default_storage_engine= $1; + } + + if ( defined $local_default_storage_engine ) { # Different default engine is used # tag test to require that engine $tinfo->{'ndb_test'}= 1 - if ( $default_storage_engine =~ /^ndb/i ); + if ( $local_default_storage_engine =~ /^ndb/i ); $tinfo->{'innodb_test'}= 1 - if ( $default_storage_engine =~ /^innodb/i ); + if ( $local_default_storage_engine =~ /^innodb/i ); + + $tinfo->{'pbxt_test'}= 1 + if ( $local_default_storage_engine =~ /^pbxt/i ); } @@ -1003,11 +962,38 @@ sub collect_one_test_case { { # innodb is not supported, skip it $tinfo->{'skip'}= 1; - # This comment is checked for running with innodb plugin (see above), - # please keep that in mind if changing the text. $tinfo->{'comment'}= "No innodb support"; - # But continue processing if we may run it with innodb plugin - return $tinfo unless $do_innodb_plugin; + return $tinfo; + } + } + elsif ( $tinfo->{'innodb_plugin_test'} ) + { + # This is a test that needs the innodb plugin + if (!&find_innodb_plugin) + { + # innodb plugin is not supported, skip it + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No innodb plugin support"; + return $tinfo; + } + + 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 @@ -1103,6 +1089,28 @@ 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{'EXAMPLE_PLUGIN'} ) @@ -1113,6 +1121,16 @@ sub collect_one_test_case { } } + if ( $tinfo->{'oqgraph_test'} ) + { + if ( !$ENV{'OQGRAPH_PLUGIN'} ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test requires the OQGraph storage engine"; + return $tinfo; + } + } + # Set extra config file to use if (defined $defaults_extra_file) { @@ -1156,6 +1174,8 @@ my @tags= ["include/have_log_bin.inc", "need_binlog", 1], ["include/have_innodb.inc", "innodb_test", 1], + ["include/have_pbxt.inc", "pbxt_test", 1], + ["include/have_innodb_plugin.inc", "innodb_plugin_test", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], @@ -1167,6 +1187,7 @@ my @tags= ["include/not_embedded.inc", "not_embedded", 1], ["include/not_valgrind.inc", "not_valgrind", 1], ["include/have_example_plugin.inc", "example_plugin_test", 1], + ["include/have_oqgraph_engine.inc", "oqgraph_test", 1], ["include/have_ssl.inc", "need_ssl", 1], ); |