|
|||||||||||
|
[patch 7/8] ndb tests for win32
From: <stewart(at)flamingspork.com>
Date: Wed Sep 19 2007 - 03:46:48 EDT ooo bzr diff -r1 -pa/:b/ ndb/test/ mysql-test/ |di -X Make --- a/mysql-test/lib/mtr_misc.pl 2007-08-29 07:25:53 +0000 +++ b/mysql-test/lib/mtr_misc.pl 2007-09-11 10:44:51 +0000 @@ -72,7 +72,7 @@
# MySQL version before 5.0 still use cygwin, no need
# to convert path
$path=~ s/\//\\/g
# Save the pid of the mysqladmin process
$admin_pids{$pid}= 1;
@@ -375,11 +375,13 @@
if ( ! $::opt_skip_ndbcluster )
foreach my $cluster (@{$::clusters})
{
+
+ # Don't shut down a "running" cluster
+ next if $cluster->{'use_running'};
+
mtr_debug(" - cluster " .
"(pid: $cluster->{pid}; " .
"pid file: '$cluster->{path_pid})");
--- a/mysql-test/mysql-test-run.pl 2007-08-29 07:25:53 +0000
+++ b/mysql-test/mysql-test-run.pl 2007-09-13 15:21:41 +0000
our $glob_use_embedded_server= 0;
our @glob_test_mode; @@ -479,7 +477,9 @@ my $opt_comment; $opt_master_myport= 9306; - $opt_slave_myport= 9308; +# $opt_slave_myport= 9308; +# with the default 3 slaves, the 3rd is 9310, which conflicts with ndbcluster_port + $opt_slave_myport= 9328; $opt_ndbcluster_port= 9310; $opt_ndbcluster_port_slave= 9311; $im_port= 9312; @@ -924,40 +924,6 @@ }
# --------------------------------------------------------------------------
- # Ndb cluster flags
- # --------------------------------------------------------------------------
-
- if ( $opt_ndbconnectstring )
- {
- $glob_use_running_ndbcluster= 1;
- mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
- if $opt_skip_ndbcluster;
- mtr_error("Can't specify --ndb-connectstring and --ndbcluster-port")
- if $opt_ndbcluster_port;
- }
- else
- {
- # Set default connect string
- $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
- }
-
- if ( $opt_ndbconnectstring_slave )
- {
- $glob_use_running_ndbcluster_slave= 1;
- mtr_error("Can't specify ndb-connectstring_slave and " .
- "--skip-ndbcluster-slave")
- if $opt_skip_ndbcluster;
- mtr_error("Can't specify --ndb-connectstring-slave and " .
- "--ndbcluster-port-slave")
- if $opt_ndbcluster_port_slave;
- }
- else
- {
- # Set default connect string
- $opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
- }
- - # -------------------------------------------------------------------------- # Bench flags # --------------------------------------------------------------------------if ( $opt_small_bench ) @@ -1200,7 +1166,7 @@
nodes => 2,
port => "$opt_ndbcluster_port",
data_dir => "$data_dir",
- connect_string => "$opt_ndbconnectstring",
+ connect_string => "host=localhost:$opt_ndbcluster_port",
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd
installed_ok => 0,
installed_ok => 0,
@@ -1235,6 +1201,9 @@
}
+ # --------------------------------------------------------------------------+ # extern + # --------------------------------------------------------------------------
if ( $opt_extern )
if $opt_socket;
+
+ # --------------------------------------------------------------------------
+ # ndbconnectstring and ndbconnectstring_slave
+ # --------------------------------------------------------------------------
+ if ( $opt_ndbconnectstring )
+ {
+ # ndbconnectstring was supplied by user, the tests shoudl be run
+ # against an already started cluster, change settings
+ my $cluster= $clusters->[0]; # Master cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
+ if $opt_skip_ndbcluster;
+ }
+ $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
+
+
+ if ( $opt_ndbconnectstring_slave )
+ {
+ # ndbconnectstring-slave was supplied by user, the tests should be run
+ # agains an already started slave cluster, change settings
+ my $cluster= $clusters->[1]; # Slave cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify ndb-connectstring_slave and " .
+ "--skip-ndbcluster-slave")
+ if $opt_skip_ndbcluster_slave;
+ }
+
+
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_current_test_log= "$opt_vardir/log/current_test";
@@ -1467,23 +1468,28 @@
my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
"$glob_basedir/storage/ndb",
"$glob_basedir/bin");
- + my $ndb_rel= $ndb_path; + $ndb_rel=~ s/^$glob_basedir\///; +
$exe_ndbd=
$exe_ndb_mgm=
$exe_ndb_mgmd=
$exe_ndb_waiter=
+ "$ndb_path/tools/ndb_waiter", "$ndb_path/ndb_waiter"); # May not exist
- $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools",
+ $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools/debug",
+ "$ndb_path/tools",
"$ndb_path");
+ print "NDB_TOOLS $path_ndb_tools_dir\n";
# May not exist
# May not exist
return ( $exe_ndbd eq "" or $exe_ndb_mgm eq "" or $exe_ndb_mgmd eq "" or}
mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
my $cluster_started_ok= 1; # Assume it can be started
+ $cluster= $clusters->[1]; # Slave cluster
if ($max_slave_num == 0 ||
- $opt_skip_ndbcluster_slave || $glob_use_running_ndbcluster_slave ||
- $clusters->[1]->{executable_setup_failed})
+ $opt_skip_ndbcluster_slave ||
+ $cluster->{'use_running'} ||
+ $cluster->{executable_setup_failed})
{
# Don't install slave cluster
} - elsif (ndbcluster_start_install($clusters->[1])) + elsif (ndbcluster_start_install($cluster))
{
$cluster_started_ok= 0;
next if !$cluster->{'pid'};
{
foreach my $cluster (@{$clusters})
{
+ # Slave cluster is skipped and thus not
+ # installed, no need to perform checks
last if ($opt_skip_ndbcluster_slave and
$cluster->{'name'} eq 'Slave');
+ # Using running cluster - no need
+ # to check if test should be skipped
+ # will be done by test itself
+ last if ($cluster->{'use_running'});
+
# If test needs this cluster, check binaries was found ok
if ( $cluster->{'executable_setup_failed'} )
{
@@ -4469,7 +4486,8 @@ }
mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--silent"); + # mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "-v"); mtr_add_arg($args, "--skip-safemalloc");mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
# Remove the table from NDB
#
# Remove the table from NDB
--error 1146
# Remove the table from NDB
SHOW TABLES;
# Remove t3, t5 from NDB -system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ; -system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ; +--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT# Remove t6, t7 from disk system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; @@ -329,8 +330,8 @@ insert into t9 values (9); # Remove t3, t5 from NDB -system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ; -system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ; +--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null +--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null# Remove t6, t7 from disk system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; @@ -485,12 +486,12 @@ use test_only_ndb_tables; create table t1 (a int primary key) engine=ndb; select * from t1; ---exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null ---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null +--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null --error 1015 select * from t1; ---exec $NDB_MGM --no-defaults -e "all start" > /dev/null ---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null +--exec $NDB_MGM --no-defaults -e "all start" > /dev/null +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/nulluse test; drop database test_only_ndb_tables; @@ -543,6 +544,6 @@ insert into t10 values (1, 'kalle'); ---exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` >> $NDB_TOOLS_OUTPUT 2>&1 || true +--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB |tr -d \\\r` >> $NDB_TOOLS_OUTPUT 2>&1 || true # End of 4.1 tests
char buf[100];
SUBSCRIBER_NUMBER_LENGTH, td->transactionData.number); ndbout << str << " " << error << endl
NdbConnection * MyTransaction = 0;
// random ints +#ifdef NDB_WIN32 +#define random() rand() +#define srandom(SEED) srand(SEED) +#endif + static unsigned urandom(unsigned n) {
/*
@@ -313,7 +305,7 @@
len2 = get_rand_col_str(temp+len1);
return len+1;
@@ -327,10 +319,10 @@ - snprintf(temp, pos+1, "%s", source); - snprintf(temp+pos, strlen(newstr)+1, "%s", newstr); - snprintf(temp+pos+strlen(newstr), strlen(source)-pos, "%s", source+pos+1); - snprintf(source, strlen(temp)+1, "%s", temp); + BaseString::snprintf(temp, pos+1, "%s", source); + BaseString::snprintf(temp+pos, strlen(newstr)+1, "%s", newstr);+ BaseString::snprintf(temp+pos+strlen(newstr), strlen(source)-pos, "%s", source+pos+1); + BaseString::snprintf(source, strlen(temp)+1, "%s", temp);
return strlen(source);
@@ -711,7 +703,7 @@
col[i] = table->getColumn(COL_NAME[i]);
if(!col[i])
{
- snprintf(tmp, 128, "Can't get column %s", COL_NAME[i]);
+ BaseString::snprintf(tmp, 128, "Can't get column %s", COL_NAME[i]);
ERR_EXIT(dict, tmp);
}
} @@ -738,7 +730,7 @@
rec[i] = scan->getValue(COL_NAME[i]);
if(!rec[i])
{
- snprintf(tmp, 128, "Can't get rec of %s", COL_NAME[i]);
+ BaseString::snprintf(tmp, 128, "Can't get rec of %s", COL_NAME[i]);
ERR_EXIT(scan, tmp);
}
}
-- Stewart Smith -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Wed Sep 19 04:11:39 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:32:47 EDT |
||||||||||
|
|||||||||||