summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-08-25 15:17:03 +0200
committerunknown <msvensson@neptunus.(none)>2006-08-25 15:17:03 +0200
commit28db55a79535ffa22e3de32db0115bac4985e8b1 (patch)
tree521d1e6f0f7e40a4a945b34395dad81156d5b0dc
parentdb2a86ce8fcb58fe67a73ec8bf1aa35e73490c77 (diff)
downloadmariadb-git-28db55a79535ffa22e3de32db0115bac4985e8b1.tar.gz
Backport from 5.0 a fix that will start ndb only for tests that needs it
mysql-test/lib/mtr_cases.pl: Detect which tests that need ndb mysql-test/lib/mtr_match.pl: Add function mtr_match_substring mysql-test/mysql-test-run.pl: Only start cluster for test cases that need it
-rw-r--r--mysql-test/lib/mtr_cases.pl22
-rw-r--r--mysql-test/lib/mtr_match.pl17
-rwxr-xr-xmysql-test/mysql-test-run.pl28
3 files changed, 65 insertions, 2 deletions
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 3666c1aa01b..650fb79155d 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -193,6 +193,28 @@ sub collect_one_test_case($$$$$$) {
$tinfo->{'slave_restart'}= 1;
}
+ # Cluster is needed by test case if testname contains ndb
+ if ( defined mtr_match_substring($tname,"ndb") )
+ {
+ $tinfo->{'ndb_test'}= 1;
+ if ( $::opt_skip_ndbcluster )
+ {
+ # Skip all ndb tests
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+ if ( ! $::opt_with_ndbcluster )
+ {
+ # Ndb is not supported, skip them
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+ }
+ else
+ {
+ $tinfo->{'ndb_test'}= 0;
+ }
+
# FIXME what about embedded_server + ndbcluster, skip ?!
my $master_opt_file= "$testdir/$tname-master.opt";
diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/mtr_match.pl
index eb5de655520..66b639c7f8e 100644
--- a/mysql-test/lib/mtr_match.pl
+++ b/mysql-test/lib/mtr_match.pl
@@ -50,6 +50,23 @@ sub mtr_match_extension ($$) {
}
+# Match a substring anywere in a string
+
+sub mtr_match_substring ($$) {
+ my $string= shift;
+ my $substring= shift;
+
+ if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
sub mtr_match_any_exact ($$) {
my $string= shift;
my $mlist= shift;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 8cf14faec0c..eff6c7ccfbe 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1581,6 +1581,16 @@ sub run_testcase ($) {
{
$do_restart= 1; # Always restart if script to run
}
+ elsif ( $tinfo->{'ndb_test'} and $master->[0]->{'ndbcluster'} == 1 )
+ {
+ $do_restart= 1; # Restart with cluster
+ # print "Restarting because cluster need to be enabled\n";
+ }
+ elsif ($tinfo->{'ndb_test'} == 0 and $master->[0]->{'ndbcluster'} == 0)
+ {
+ $do_restart= 1; # Restart without cluster
+ # print "Restarting because cluster need to be disabled\n";
+ }
elsif ( $master->[0]->{'running_master_is_special'} and
$master->[0]->{'running_master_is_special'}->{'timezone'} eq
$tinfo->{'timezone'} and
@@ -1646,7 +1656,7 @@ sub run_testcase ($) {
if ( ! $opt_local_master )
{
- if ( $master->[0]->{'ndbcluster'} )
+ if ( $master->[0]->{'ndbcluster'} && $tinfo->{'ndb_test'})
{
$master->[0]->{'ndbcluster'}= ndbcluster_start();
if ( $master->[0]->{'ndbcluster'} )
@@ -1659,8 +1669,22 @@ sub run_testcase ($) {
{
# FIXME not correct location for do_before_start_master()
do_before_start_master($tname,$tinfo->{'master_sh'});
+
+ # Save skip_ndbcluster
+ my $save_opt_skip_ndbcluster= $opt_skip_ndbcluster;
+ if (!$tinfo->{'ndb_test'})
+ {
+ # Modify skip_ndbcluster so cluster is skipped for this
+ # and subsequent testcases(until we find one that does not cluster)
+ $opt_skip_ndbcluster= 1;
+ }
+
$master->[0]->{'pid'}=
mysqld_start('master',0,$tinfo->{'master_opt'},[]);
+
+ # Restore skip_ndbcluster
+ $opt_skip_ndbcluster= $save_opt_skip_ndbcluster;
+
if ( ! $master->[0]->{'pid'} )
{
report_failure_and_restart($tinfo);
@@ -2026,7 +2050,7 @@ sub mysqld_arguments ($$$$$) {
}
}
- if ( $opt_with_ndbcluster )
+ if ( $opt_with_ndbcluster && !$opt_skip_ndbcluster)
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,