summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@shellback.(none)>2006-11-01 15:59:15 +0100
committerunknown <msvensson@shellback.(none)>2006-11-01 15:59:15 +0100
commit73a7995b029ba5bd2ad9d9b32ee89fb383a68a10 (patch)
tree9a619c10ecbdd5100c71857a66d58785745e77cf
parent0c57f480282a427d5d03c8288f72c4f1f4826547 (diff)
parent6a7ce1eb3baade82ec992e4889a49bd250788406 (diff)
downloadmariadb-git-73a7995b029ba5bd2ad9d9b32ee89fb383a68a10.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-maint
into shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
-rw-r--r--client/mysqltest.c36
-rw-r--r--mysql-test/include/wait_for_query_to_suceed.inc25
-rw-r--r--mysql-test/lib/mtr_io.pl12
-rw-r--r--mysql-test/lib/mtr_process.pl40
-rwxr-xr-xmysql-test/mysql-test-run.pl18
-rw-r--r--mysql-test/t/rename.test11
6 files changed, 91 insertions, 51 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 9f41586afae..7c1ce19283f 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1409,7 +1409,7 @@ int open_file(const char *name)
void do_source(struct st_command *command)
{
- DYNAMIC_STRING ds_filename;
+ static DYNAMIC_STRING ds_filename;
const struct command_arg source_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to source"
};
@@ -1697,7 +1697,7 @@ void do_system(struct st_command *command)
void do_remove_file(struct st_command *command)
{
int error;
- DYNAMIC_STRING ds_filename;
+ static DYNAMIC_STRING ds_filename;
const struct command_arg rm_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to delete"
};
@@ -1730,8 +1730,8 @@ void do_remove_file(struct st_command *command)
void do_copy_file(struct st_command *command)
{
int error;
- DYNAMIC_STRING ds_from_file;
- DYNAMIC_STRING ds_to_file;
+ static DYNAMIC_STRING ds_from_file;
+ static DYNAMIC_STRING ds_to_file;
const struct command_arg copy_file_args[] = {
"from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to copy from",
"to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to copy to"
@@ -1766,7 +1766,7 @@ void do_copy_file(struct st_command *command)
void do_file_exist(struct st_command *command)
{
int error;
- DYNAMIC_STRING ds_filename;
+ static DYNAMIC_STRING ds_filename;
const struct command_arg file_exist_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to check if it exist"
};
@@ -1873,9 +1873,9 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
void do_write_file(struct st_command *command)
{
- DYNAMIC_STRING ds_content;
- DYNAMIC_STRING ds_filename;
- DYNAMIC_STRING ds_delimiter;
+ static DYNAMIC_STRING ds_content;
+ static DYNAMIC_STRING ds_filename;
+ static DYNAMIC_STRING ds_delimiter;
const struct command_arg write_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to write to",
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until"
@@ -1927,8 +1927,8 @@ void do_perl(struct st_command *command)
int error;
char buf[FN_REFLEN];
FILE *res_file;
- DYNAMIC_STRING ds_script;
- DYNAMIC_STRING ds_delimiter;
+ static DYNAMIC_STRING ds_script;
+ static DYNAMIC_STRING ds_delimiter;
const struct command_arg perl_args[] = {
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until"
};
@@ -2985,14 +2985,14 @@ void do_connect(struct st_command *command)
bool con_ssl= 0, con_compress= 0;
char *ptr;
- DYNAMIC_STRING ds_connection_name;
- DYNAMIC_STRING ds_host;
- DYNAMIC_STRING ds_user;
- DYNAMIC_STRING ds_password;
- DYNAMIC_STRING ds_database;
- DYNAMIC_STRING ds_port;
- DYNAMIC_STRING ds_sock;
- DYNAMIC_STRING ds_options;
+ static DYNAMIC_STRING ds_connection_name;
+ static DYNAMIC_STRING ds_host;
+ static DYNAMIC_STRING ds_user;
+ static DYNAMIC_STRING ds_password;
+ static DYNAMIC_STRING ds_database;
+ static DYNAMIC_STRING ds_port;
+ static DYNAMIC_STRING ds_sock;
+ static DYNAMIC_STRING ds_options;
const struct command_arg connect_args[] = {
"connection name", ARG_STRING, TRUE, &ds_connection_name,
"Name of the connection",
diff --git a/mysql-test/include/wait_for_query_to_suceed.inc b/mysql-test/include/wait_for_query_to_suceed.inc
new file mode 100644
index 00000000000..6ac1144620e
--- /dev/null
+++ b/mysql-test/include/wait_for_query_to_suceed.inc
@@ -0,0 +1,25 @@
+#
+# Run a query over and over until it suceeds ot timeout occurs
+#
+
+
+let $counter= 100;
+
+disable_abort_on_error;
+disable_query_log;
+disable_result_log;
+eval $query;
+while ($mysql_errno)
+{
+ eval $query;
+ sleep 0.1;
+ dec $counter;
+
+ if (!$counter)
+ {
+ die("Waited too long for query to suceed");
+ }
+}
+enable_abort_on_error;
+enable_query_log;
+enable_result_log;
diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl
index a1d7ffe87d8..984d834486c 100644
--- a/mysql-test/lib/mtr_io.pl
+++ b/mysql-test/lib/mtr_io.pl
@@ -37,18 +37,16 @@ sub mtr_get_pid_from_file ($) {
open(FILE, '<', $pid_file_path)
or mtr_error("can't open file \"$pid_file_path\": $!");
+ # Read pid number from file
my $pid= <FILE>;
-
- chomp($pid) if defined $pid;
-
close FILE;
- return $pid if defined $pid && $pid ne '';
+ return $pid if $pid=~ /^(\d+)/;
- mtr_debug("Pid file '$pid_file_path' is empty. " .
- "Sleeping $timeout second(s)...");
+ mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
+ "Sleeping $timeout second(s) more...");
- sleep(1);
+ sleep($timeout);
}
mtr_error("Pid file '$pid_file_path' is corrupted. " .
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index affe8278376..048c336f8a3 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -438,25 +438,35 @@ sub mtr_kill_leftovers () {
while ( my $elem= readdir(RUNDIR) )
{
- my $pidfile= "$rundir/$elem";
-
- if ( -f $pidfile )
+ # Only read pid from files that end with .pid
+ if ( $elem =~ /.*[.]pid$/)
{
- mtr_debug("Processing PID file: '$pidfile'...");
- my $pid= mtr_get_pid_from_file($pidfile);
+ my $pidfile= "$rundir/$elem";
- mtr_debug("Got pid: $pid from file '$pidfile'");
+ if ( -f $pidfile )
+ {
+ mtr_debug("Processing PID file: '$pidfile'...");
- if ( $::glob_cygwin_perl or kill(0, $pid) )
- {
- mtr_debug("There is process with pid $pid -- scheduling for kill.");
- push(@pids, $pid); # We know (cygwin guess) it exists
- }
- else
- {
- mtr_debug("There is no process with pid $pid -- skipping.");
- }
+ my $pid= mtr_get_pid_from_file($pidfile);
+
+ mtr_debug("Got pid: $pid from file '$pidfile'");
+
+ if ( $::glob_cygwin_perl or kill(0, $pid) )
+ {
+ mtr_debug("There is process with pid $pid -- scheduling for kill.");
+ push(@pids, $pid); # We know (cygwin guess) it exists
+ }
+ else
+ {
+ mtr_debug("There is no process with pid $pid -- skipping.");
+ }
+ }
+ }
+ else
+ {
+ mtr_warning("Found non pid file $elem in $rundir");
+ next;
}
}
closedir(RUNDIR);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 3e25d6e933c..de2498a7246 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1801,14 +1801,16 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
- "--user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
-
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+ if ( ! $glob_win32 )
+ {
+ my $cmdline_mysql_fix_system_tables=
+ "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
+ "--user=root --password= " .
+ "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+ }
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index 054b1bd3403..5c750711853 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -43,8 +43,8 @@ select * from t3;
drop table if exists t1,t2,t3,t4;
#
-# Test-case for Bug #2397 RENAME TABLES is not blocked by
-# FLUSH TABLES WITH READ LOCK
+# Bug #2397 RENAME TABLES is not blocked by
+# FLUSH TABLES WITH READ LOCK
#
connect (con1,localhost,root,,);
@@ -58,12 +58,17 @@ FLUSH TABLES WITH READ LOCK;
connection con1;
send RENAME TABLE t1 TO t2, t3 to t4;
connection con2;
-sleep 1;
show tables;
UNLOCK TABLES;
connection con1;
reap;
connection con2;
+
+# Wait for the the tables to be renamed
+# i.e the query below succeds
+let $query= select * from t2, t4;
+source include/wait_for_query_to_suceed.inc;
+
show tables;
drop table t2, t4;