Commit 8929b7a0 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/same_tools/my50-same_tools

into  neptunus.(none):/home/msvensson/mysql/same_tools/my51-same_tools
parents 010fb6bf 6b15f768
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
-- source include/master-slave.inc -- source include/master-slave.inc
let $SERVER_VERSION=`select version()`;
create table t1 (a int); create table t1 (a int);
insert into t1 values (10); insert into t1 values (10);
create table t2 (a int); create table t2 (a int);
......
let $1 = 10;
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
echo $1;
dec $1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
echo here is the sourced script;
--source include/sourced.inc
...@@ -514,13 +514,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -514,13 +514,6 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'comment'}= "Test need debug binaries"; $tinfo->{'comment'}= "Test need debug binaries";
return; return;
} }
if ( $tinfo->{'innodb_test'} && ! $::glob_innodb_supported )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need innodb";
}
} }
# We can't restart a running server that may be in use # We can't restart a running server that may be in use
......
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
# Private IM-related operations.
sub mtr_im_kill_process ($$$$);
sub mtr_im_load_pids ($);
sub mtr_im_terminate ($);
sub mtr_im_check_alive ($);
sub mtr_im_check_main_alive ($);
sub mtr_im_check_angel_alive ($);
sub mtr_im_check_mysqlds_alive ($);
sub mtr_im_check_mysqld_alive ($);
sub mtr_im_cleanup ($);
sub mtr_im_rm_file ($);
sub mtr_im_errlog ($);
sub mtr_im_kill ($);
sub mtr_im_wait_for_connection ($$$);
sub mtr_im_wait_for_mysqld($$$);
# Public IM-related operations.
sub mtr_im_start ($$);
sub mtr_im_stop ($);
##############################################################################
#
# Private operations.
#
##############################################################################
sub mtr_im_kill_process ($$$$) {
my $pid_lst= shift;
my $signal= shift;
my $total_retries= shift;
my $timeout= shift;
my %pids;
foreach my $pid ( @{$pid_lst} )
{
$pids{$pid}= 1;
}
for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt )
{
foreach my $pid ( keys %pids )
{
mtr_debug("Sending $signal to $pid...");
kill($signal, $pid);
unless ( kill (0, $pid) )
{
mtr_debug("Process $pid died.");
delete $pids{$pid};
}
}
return if scalar keys %pids == 0;
mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
sleep($timeout);
}
mtr_debug("Process(es) " .
join(' ', keys %pids) .
" is still alive after $total_retries " .
"of sending signal $signal.");
}
###########################################################################
sub mtr_im_load_pids($) {
my $im= shift;
mtr_debug("Loading PID files...");
# Obtain mysqld-process pids.
my $instances = $im->{'instances'};
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
$instances->[$idx]->{'path_pid'} . "'.");
my $mysqld_pid;
if ( -r $instances->[$idx]->{'path_pid'} )
{
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
}
else
{
$mysqld_pid= undef;
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
}
$instances->[$idx]->{'pid'}= $mysqld_pid;
}
# Re-read Instance Manager PIDs from the file, since during tests Instance
# Manager could have been restarted, so its PIDs could have been changed.
# - IM-main
mtr_debug("IM-main PID file: '$im->{path_pid}'.");
if ( -f $im->{'path_pid'} )
{
$im->{'pid'} =
mtr_get_pid_from_file($im->{'path_pid'});
mtr_debug("IM-main PID: $im->{pid}.");
}
else
{
mtr_debug("IM-main: no PID file.");
$im->{'pid'}= undef;
}
# - IM-angel
mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'.");
if ( -f $im->{'path_angel_pid'} )
{
$im->{'angel_pid'} =
mtr_get_pid_from_file($im->{'path_angel_pid'});
mtr_debug("IM-angel PID: $im->{'angel_pid'}.");
}
else
{
mtr_debug("IM-angel: no PID file.");
$im->{'angel_pid'} = undef;
}
}
###########################################################################
sub mtr_im_terminate($) {
my $im= shift;
# Load pids from pid-files. We should do it first of all, because IM deletes
# them on shutdown.
mtr_im_load_pids($im);
mtr_debug("Shutting Instance Manager down...");
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Send SIGTERM to IM-main.
if ( defined $im->{'pid'} )
{
mtr_debug("IM-main pid: $im->{pid}.");
mtr_debug("Stopping IM-main...");
mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1);
}
else
{
mtr_debug("IM-main pid: n/a.");
}
# If IM-angel was alive, wait for it to die.
if ( defined $im->{'angel_pid'} )
{
mtr_debug("IM-angel pid: $im->{'angel_pid'}.");
mtr_debug("Waiting for IM-angel to die...");
my $total_attempts= 10;
for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
unless ( kill (0, $im->{'angel_pid'}) )
{
mtr_debug("IM-angel died.");
last;
}
sleep(1);
}
}
else
{
mtr_debug("IM-angel pid: n/a.");
}
stop_reap_all();
# Re-load PIDs.
mtr_im_load_pids($im);
}
###########################################################################
sub mtr_im_check_alive($) {
my $im= shift;
mtr_debug("Checking whether IM-components are alive...");
return 1 if mtr_im_check_main_alive($im);
return 1 if mtr_im_check_angel_alive($im);
return 1 if mtr_im_check_mysqlds_alive($im);
return 0;
}
###########################################################################
sub mtr_im_check_main_alive($) {
my $im= shift;
# Check that the process, that we know to be IM's, is dead.
if ( defined $im->{'pid'} )
{
if ( kill (0, $im->{'pid'}) )
{
mtr_debug("IM-main (PID: $im->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-main (PID: $im->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for IM-main.");
}
# Check that IM does not accept client connections.
if ( mtr_ping_port($im->{'port'}) )
{
mtr_debug("IM-main (port: $im->{port}) " .
"is accepting connections.");
mtr_im_errlog("IM-main is accepting connections on port " .
"$im->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("IM-main (port: $im->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_check_angel_alive($) {
my $im= shift;
# Check that the process, that we know to be the Angel, is dead.
if ( defined $im->{'angel_pid'} )
{
if ( kill (0, $im->{'angel_pid'}) )
{
mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead.");
return 0;
}
}
else
{
mtr_debug("No PID file for IM-angel.");
return 0;
}
}
###########################################################################
sub mtr_im_check_mysqlds_alive($) {
my $im= shift;
mtr_debug("Checking for IM-guarded mysqld instances...");
my $instances = $im->{'instances'};
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_debug("Checking mysqld[$idx]...");
return 1
if mtr_im_check_mysqld_alive($instances->[$idx]);
}
}
###########################################################################
sub mtr_im_check_mysqld_alive($) {
my $mysqld_instance= shift;
# Check that the process is dead.
if ( defined $mysqld_instance->{'pid'} )
{
if ( kill (0, $mysqld_instance->{'pid'}) )
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for mysqld instance.");
}
# Check that mysqld does not accept client connections.
if ( mtr_ping_port($mysqld_instance->{'port'}) )
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"is accepting connections.");
mtr_im_errlog("Mysqld is accepting connections on port " .
"$mysqld_instance->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_cleanup($) {
my $im= shift;
mtr_im_rm_file($im->{'path_pid'});
mtr_im_rm_file($im->{'path_sock'});
mtr_im_rm_file($im->{'path_angel_pid'});
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'});
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'});
}
}
###########################################################################
sub mtr_im_rm_file($)
{
my $file_path= shift;
if ( -f $file_path )
{
mtr_debug("Removing '$file_path'...");
unless ( unlink($file_path) )
{
mtr_warning("Can not remove '$file_path'.")
}
}
else
{
mtr_debug("File '$file_path' does not exist already.");
}
}
###########################################################################
sub mtr_im_errlog($) {
my $msg= shift;
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
# that it can be seen on console and does not produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] $msg\n";
#
# close ERRLOG;
my $ts= localtime();
print "Warning: [$ts] $msg\n";
}
###########################################################################
sub mtr_im_kill($) {
my $im= shift;
# Re-load PIDs. That can be useful because some processes could have been
# restarted.
mtr_im_load_pids($im);
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Kill IM-angel first of all.
if ( defined $im->{'angel_pid'} )
{
mtr_debug("Killing IM-angel (PID: $im->{angel_pid})...");
mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1)
}
else
{
mtr_debug("IM-angel is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($im);
# Kill IM-main.
if ( defined $im->{'pid'} )
{
mtr_debug("Killing IM-main (PID: $im->pid})...");
mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1);
}
else
{
mtr_debug("IM-main is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($im);
# Kill guarded mysqld instances.
my @mysqld_pids;
mtr_debug("Collecting PIDs of mysqld instances to kill...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $pid= $im->{'instances'}->[$idx]->{'pid'};
unless ( defined $pid )
{
next;
}
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
push (@mysqld_pids, $pid);
}
if ( scalar @mysqld_pids > 0 )
{
mtr_debug("Killing IM-guarded mysqld instances...");
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
}
# That's all.
stop_reap_all();
}
##############################################################################
sub mtr_im_wait_for_connection($$$) {
my $im= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM on port $im->{port} " .
"to start accepting connections...");
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
if ( mtr_ping_port($im->{'port'}) )
{
mtr_debug("IM is accepting connections " .
"on port $im->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("IM does not accept connections " .
"on port $im->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_wait_for_mysqld($$$) {
my $mysqld= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
"to start accepting connections...");
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
mtr_debug("Trying to connect to mysqld " .
"($cur_attempt of $total_attempts)...");
if ( mtr_ping_port($mysqld->{'port'}) )
{
mtr_debug("Mysqld is accepting connections " .
"on port $mysqld->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("Mysqld does not accept connections " .
"on port $mysqld->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
#
# Public operations.
#
##############################################################################
sub mtr_im_start($$) {
my $im = shift;
my $opts = shift;
mtr_debug("Starting Instance Manager...");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'});
foreach my $opt ( @{$opts} )
{
mtr_add_arg($args, $opt);
}
$im->{'pid'} =
mtr_spawn(
$::exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$im->{'path_log'}, # stdout
$im->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
unless ( $im->{'pid'} )
{
mtr_error('Could not start Instance Manager.')
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
mtr_debug("Waiting for IM to create PID file (" .
"path: '$im->{path_pid}'; " .
"timeout: $im->{start_timeout})...");
unless ( sleep_until_file_created($im->{'path_pid'},
$im->{'start_timeout'},
-1) ) # real PID is still unknown
{
mtr_debug("IM has not created PID file in $im->{start_timeout} secs.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("IM has not created PID file in $im->{start_timeout} secs.");
return 0;
}
$im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'});
mtr_debug("Instance Manager started. PID: $im->{pid}.");
# Wait until we can connect to IM.
my $IM_CONNECT_TIMEOUT= 30;
unless ( mtr_im_wait_for_connection($im,
$IM_CONNECT_TIMEOUT, 1) )
{
mtr_debug("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
return 0;
}
# Wait for IM to start guarded instances:
# - wait for PID files;
mtr_debug("Waiting for guarded mysqlds instances to create PID files...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $mysqld= $im->{'instances'}->[$idx];
if ( exists $mysqld->{'nonguarded'} )
{
next;
}
mtr_debug("Waiting for mysqld[$idx] to create PID file (" .
"path: '$mysqld->{path_pid}'; " .
"timeout: $mysqld->{start_timeout})...");
unless ( sleep_until_file_created($mysqld->{'path_pid'},
$mysqld->{'start_timeout'},
-1) ) # real PID is still unknown
{
mtr_debug("mysqld[$idx] has not created PID file in " .
"$mysqld->{start_timeout} secs.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("mysqld[$idx] has not created PID file in " .
"$mysqld->{start_timeout} secs.");
return 0;
}
mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created.");
}
# Wait until we can connect to guarded mysqld-instances
# (in other words -- wait for IM to start guarded instances).
mtr_debug("Waiting for guarded mysqlds to start accepting connections...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $mysqld= $im->{'instances'}->[$idx];
if ( exists $mysqld->{'nonguarded'} )
{
next;
}
mtr_debug("Waiting for mysqld[$idx] to accept connection...");
unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) )
{
mtr_debug("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
return 0;
}
mtr_debug("mysqld[$idx] started.");
}
mtr_debug("Instance Manager and its components are up and running.");
return 1;
}
##############################################################################
sub mtr_im_stop($) {
my $im= shift;
mtr_debug("Stopping Instance Manager...");
# Try graceful shutdown.
mtr_im_terminate($im);
# Check that all processes died.
unless ( mtr_im_check_alive($im) )
{
mtr_debug("Instance Manager has been stopped successfully.");
mtr_im_cleanup($im);
return 1;
}
# Instance Manager don't want to die. We should kill it.
mtr_im_errlog("Instance Manager did not shutdown gracefully.");
mtr_im_kill($im);
# Check again that all IM-related processes have been killed.
my $im_is_alive= mtr_im_check_alive($im);
mtr_im_cleanup($im);
if ( $im_is_alive )
{
mtr_debug("Can not kill Instance Manager or its children.");
return 0;
}
mtr_debug("Instance Manager has been killed successfully.");
return 1;
}
###########################################################################
1;
...@@ -12,6 +12,7 @@ sub mtr_fromfile ($); ...@@ -12,6 +12,7 @@ sub mtr_fromfile ($);
sub mtr_tofile ($@); sub mtr_tofile ($@);
sub mtr_tonewfile($@); sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($); sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
############################################################################## ##############################################################################
# #
...@@ -170,4 +171,17 @@ sub mtr_tonewfile ($@) { ...@@ -170,4 +171,17 @@ sub mtr_tonewfile ($@) {
close FILE; close FILE;
} }
sub mtr_appendfile_to_file ($$) {
my $from_file= shift;
my $to_file= shift;
open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!");
open(FROMFILE,">>",$from_file)
or mtr_error("can't open file \"$from_file\": $!");
print TOFILE while (<FROMFILE>);
close FROMFILE;
close TOFILE;
}
1; 1;
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
#use Carp qw(cluck);
use Socket; use Socket;
use Errno; use Errno;
use strict; use strict;
...@@ -26,28 +25,6 @@ sub mtr_kill_processes ($); ...@@ -26,28 +25,6 @@ sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($); sub mtr_ping_with_timeout($);
sub mtr_ping_port ($); sub mtr_ping_port ($);
# Private IM-related operations.
sub mtr_im_kill_process ($$$);
sub mtr_im_load_pids ($);
sub mtr_im_terminate ($);
sub mtr_im_check_alive ($);
sub mtr_im_check_main_alive ($);
sub mtr_im_check_angel_alive ($);
sub mtr_im_check_mysqlds_alive ($);
sub mtr_im_check_mysqld_alive ($$);
sub mtr_im_cleanup ($);
sub mtr_im_rm_file ($);
sub mtr_im_errlog ($);
sub mtr_im_kill ($);
sub mtr_im_wait_for_connection ($$$);
sub mtr_im_wait_for_mysqld($$$);
# Public IM-related operations.
sub mtr_im_start ($$);
sub mtr_im_stop ($$);
# static in C # static in C
sub spawn_impl ($$$$$$$$); sub spawn_impl ($$$$$$$$);
...@@ -115,8 +92,6 @@ sub spawn_impl ($$$$$$$$) { ...@@ -115,8 +92,6 @@ sub spawn_impl ($$$$$$$$) {
my $pid_file= shift; # FIXME my $pid_file= shift; # FIXME
my $spawn_opts= shift; my $spawn_opts= shift;
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print STDERR "\n"; print STDERR "\n";
...@@ -140,6 +115,9 @@ sub spawn_impl ($$$$$$$$) { ...@@ -140,6 +115,9 @@ sub spawn_impl ($$$$$$$$) {
print STDERR "#### ", "-" x 78, "\n"; print STDERR "#### ", "-" x 78, "\n";
} }
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
FORK: FORK:
{ {
my $pid= fork(); my $pid= fork();
...@@ -358,9 +336,16 @@ sub mtr_process_exit_status { ...@@ -358,9 +336,16 @@ sub mtr_process_exit_status {
# kill IM manager first, else it will restart the servers # kill IM manager first, else it will restart the servers
sub mtr_kill_leftovers () { sub mtr_kill_leftovers () {
mtr_report("Killing Possible Leftover Processes");
mtr_debug("mtr_kill_leftovers(): started."); mtr_debug("mtr_kill_leftovers(): started.");
mtr_im_stop($::instance_manager, 'mtr_kill_leftovers'); mkpath("$::opt_vardir/log"); # Needed for mysqladmin log
# Stop or kill Instance Manager and all its children. If we failed to do
# that, we can only abort -- there is nothing left to do.
# mtr_error("Failed to stop Instance Manager.")
# unless mtr_im_stop($::instance_manager);
# Start shutdown of masters and slaves. Don't touch IM-managed mysqld # Start shutdown of masters and slaves. Don't touch IM-managed mysqld
# instances -- they should be stopped by mtr_im_stop(). # instances -- they should be stopped by mtr_im_stop().
...@@ -392,8 +377,9 @@ sub mtr_kill_leftovers () { ...@@ -392,8 +377,9 @@ sub mtr_kill_leftovers () {
$srv->{'pid'}= 0; # Assume we are done with it $srv->{'pid'}= 0; # Assume we are done with it
} }
if ( ! $::opt_skip_ndbcluster )
{
# Start shutdown of clusters. # Start shutdown of clusters.
mtr_debug("Shutting down cluster..."); mtr_debug("Shutting down cluster...");
foreach my $cluster (@{$::clusters}) foreach my $cluster (@{$::clusters})
...@@ -414,7 +400,6 @@ sub mtr_kill_leftovers () { ...@@ -414,7 +400,6 @@ sub mtr_kill_leftovers () {
$cluster->{'pid'}= 0; # Assume we are done with it $cluster->{'pid'}= 0; # Assume we are done with it
foreach my $ndbd (@{$cluster->{'ndbds'}}) foreach my $ndbd (@{$cluster->{'ndbds'}})
{ {
mtr_debug(" - ndbd " . mtr_debug(" - ndbd " .
...@@ -428,6 +413,7 @@ sub mtr_kill_leftovers () { ...@@ -428,6 +413,7 @@ sub mtr_kill_leftovers () {
$ndbd->{'pid'}= 0; # Assume we are done with it $ndbd->{'pid'}= 0; # Assume we are done with it
} }
} }
}
# Wait for all the admin processes to complete # Wait for all the admin processes to complete
mtr_wait_blocking(\%admin_pids); mtr_wait_blocking(\%admin_pids);
...@@ -1095,7 +1081,7 @@ sub mtr_kill_processes ($) { ...@@ -1095,7 +1081,7 @@ sub mtr_kill_processes ($) {
{ {
foreach my $sig (15, 9) foreach my $sig (15, 9)
{ {
last if mtr_im_kill_process([ $pid ], $sig, 10); last if mtr_im_kill_process([ $pid ], $sig, 10, 1);
} }
} }
} }
...@@ -1130,679 +1116,6 @@ sub mtr_exit ($) { ...@@ -1130,679 +1116,6 @@ sub mtr_exit ($) {
exit($code); exit($code);
} }
##############################################################################
#
# Instance Manager management routines.
#
##############################################################################
sub mtr_im_kill_process ($$$) {
my $pid_lst= shift;
my $signal= shift;
my $timeout= shift;
my $total_attempts= $timeout * 10;
my %pids;
foreach my $pid (@{$pid_lst})
{
$pids{$pid}= 1;
}
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
foreach my $pid (keys %pids)
{
mtr_debug("Sending $signal to $pid...");
kill($signal, $pid);
unless (kill (0, $pid))
{
mtr_debug("Process $pid died.");
delete $pids{$pid};
}
}
return if scalar keys %pids == 0;
mtr_debug("Sleeping 100ms waiting for processes to die...");
select(undef, undef, undef, 0.1);
}
mtr_debug("Process(es) " .
join(' ', keys %pids) .
" is still alive after $total_attempts " .
"of sending signal $signal.");
}
###########################################################################
sub mtr_im_load_pids($) {
my $instance_manager= shift;
mtr_debug("Loading PID files...");
# Obtain mysqld-process pids.
my $instances = $instance_manager->{'instances'};
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
$instances->[$idx]->{'path_pid'} . "'.");
my $mysqld_pid;
if (-r $instances->[$idx]->{'path_pid'})
{
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
}
else
{
$mysqld_pid= undef;
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
}
$instances->[$idx]->{'pid'}= $mysqld_pid;
}
# Re-read Instance Manager PIDs from the file, since during tests Instance
# Manager could have been restarted, so its PIDs could have been changed.
# - IM-main
mtr_debug("IM-main PID file: '$instance_manager->{path_pid}'.");
if (-f $instance_manager->{'path_pid'})
{
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
mtr_debug("IM-main PID: $instance_manager->{pid}.");
}
else
{
mtr_debug("IM-main: no PID file.");
$instance_manager->{'pid'}= undef;
}
# - IM-angel
mtr_debug("IM-angel PID file: '$instance_manager->{path_angel_pid}'.");
if (-f $instance_manager->{'path_angel_pid'})
{
$instance_manager->{'angel_pid'} =
mtr_get_pid_from_file($instance_manager->{'path_angel_pid'});
mtr_debug("IM-angel PID: $instance_manager->{'angel_pid'}.");
}
else
{
mtr_debug("IM-angel: no PID file.");
$instance_manager->{'angel_pid'} = undef;
}
}
###########################################################################
sub mtr_im_terminate($) {
my $instance_manager= shift;
# Load pids from pid-files. We should do it first of all, because IM deletes
# them on shutdown.
mtr_im_load_pids($instance_manager);
mtr_debug("Shutting Instance Manager down...");
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Send SIGTERM to IM-main.
if (defined $instance_manager->{'pid'})
{
mtr_debug("IM-main pid: $instance_manager->{pid}.");
mtr_debug("Stopping IM-main...");
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'TERM', 10);
}
else
{
mtr_debug("IM-main pid: n/a.");
}
# If IM-angel was alive, wait for it to die.
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}.");
mtr_debug("Waiting for IM-angel to die...");
my $total_attempts= 10;
for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
unless (kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel died.");
last;
}
sleep(1);
}
}
else
{
mtr_debug("IM-angel pid: n/a.");
}
stop_reap_all();
# Re-load PIDs.
mtr_im_load_pids($instance_manager);
}
###########################################################################
sub mtr_im_check_alive($) {
my $instance_manager= shift;
mtr_debug("Checking whether IM-components are alive...");
return 1 if mtr_im_check_main_alive($instance_manager);
return 1 if mtr_im_check_angel_alive($instance_manager);
return 1 if mtr_im_check_mysqlds_alive($instance_manager);
return 0;
}
###########################################################################
sub mtr_im_check_main_alive($) {
my $instance_manager= shift;
# Check that the process, that we know to be IM's, is dead.
if (defined $instance_manager->{'pid'})
{
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("IM-main (PID: $instance_manager->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-main (PID: $instance_manager->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for IM-main.");
}
# Check that IM does not accept client connections.
if (mtr_ping_port($instance_manager->{'port'}))
{
mtr_debug("IM-main (port: $instance_manager->{port}) " .
"is accepting connections.");
mtr_im_errlog("IM-main is accepting connections on port " .
"$instance_manager->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("IM-main (port: $instance_manager->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_check_angel_alive($) {
my $instance_manager= shift;
# Check that the process, that we know to be the Angel, is dead.
if (defined $instance_manager->{'angel_pid'})
{
if (kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-angel (PID: $instance_manager->{angel_pid}) is dead.");
return 0;
}
}
else
{
mtr_debug("No PID file for IM-angel.");
return 0;
}
}
###########################################################################
sub mtr_im_check_mysqlds_alive($) {
my $instance_manager= shift;
mtr_debug("Checking for IM-guarded mysqld instances...");
my $instances = $instance_manager->{'instances'};
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_debug("Checking mysqld[$idx]...");
return 1
if mtr_im_check_mysqld_alive($instance_manager, $instances->[$idx]);
}
}
###########################################################################
sub mtr_im_check_mysqld_alive($$) {
my $instance_manager= shift;
my $mysqld_instance= shift;
# Check that the process is dead.
if (defined $instance_manager->{'pid'})
{
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for mysqld instance.");
}
# Check that mysqld does not accept client connections.
if (mtr_ping_port($mysqld_instance->{'port'}))
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"is accepting connections.");
mtr_im_errlog("Mysqld is accepting connections on port " .
"$mysqld_instance->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_cleanup($) {
my $instance_manager= shift;
mtr_im_rm_file($instance_manager->{'path_pid'});
mtr_im_rm_file($instance_manager->{'path_sock'});
mtr_im_rm_file($instance_manager->{'path_angel_pid'});
for (my $idx= 0; $idx < 2; ++$idx)
{
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_pid'});
mtr_im_rm_file($instance_manager->{'instances'}->[$idx]->{'path_sock'});
}
}
###########################################################################
sub mtr_im_rm_file($)
{
my $file_path= shift;
if (-f $file_path)
{
mtr_debug("Removing '$file_path'...");
mtr_warning("Can not remove '$file_path'.")
unless unlink($file_path);
}
else
{
mtr_debug("File '$file_path' does not exist already.");
}
}
###########################################################################
sub mtr_im_errlog($) {
my $msg= shift;
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
# that it can be seen on console and does not produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] $msg\n";
#
# close ERRLOG;
my $ts= localtime();
print "Warning: [$ts] $msg\n";
}
###########################################################################
sub mtr_im_kill($) {
my $instance_manager= shift;
# Re-load PIDs. That can be useful because some processes could have been
# restarted.
mtr_im_load_pids($instance_manager);
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Kill IM-angel first of all.
if (defined $instance_manager->{'angel_pid'})
{
mtr_debug("Killing IM-angel (PID: $instance_manager->{angel_pid})...");
mtr_im_kill_process([ $instance_manager->{'angel_pid'} ], 'KILL', 10);
}
else
{
mtr_debug("IM-angel is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($instance_manager);
# Kill IM-main.
if (defined $instance_manager->{'pid'})
{
mtr_debug("Killing IM-main (PID: $instance_manager->pid})...");
mtr_im_kill_process([ $instance_manager->{'pid'} ], 'KILL', 10);
}
else
{
mtr_debug("IM-main is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($instance_manager);
# Kill guarded mysqld instances.
my @mysqld_pids;
mtr_debug("Collecting PIDs of mysqld instances to kill...");
for (my $idx= 0; $idx < 2; ++$idx)
{
my $pid= $instance_manager->{'instances'}->[$idx]->{'pid'};
next unless defined $pid;
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
push (@mysqld_pids, $pid);
}
if (scalar @mysqld_pids > 0)
{
mtr_debug("Killing IM-guarded mysqld instances...");
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10);
}
# That's all.
stop_reap_all();
}
##############################################################################
sub mtr_im_wait_for_connection($$$) {
my $instance_manager= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM on port $instance_manager->{port} " .
"to start accepting connections...");
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
if (mtr_ping_port($instance_manager->{'port'}))
{
mtr_debug("IM is accepting connections " .
"on port $instance_manager->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("IM does not accept connections " .
"on port $instance_manager->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_wait_for_mysqld($$$) {
my $mysqld= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
"to start accepting connections...");
for (my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
mtr_debug("Trying to connect to mysqld " .
"($cur_attempt of $total_attempts)...");
if (mtr_ping_port($mysqld->{'port'}))
{
mtr_debug("Mysqld is accepting connections " .
"on port $mysqld->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("Mysqld does not accept connections " .
"on port $mysqld->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_start($$) {
my $instance_manager = shift;
my $opts = shift;
mtr_debug("Starting Instance Manager...");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s",
$instance_manager->{'defaults_file'});
foreach my $opt (@{$opts})
{
mtr_add_arg($args, $opt);
}
$instance_manager->{'pid'} =
mtr_spawn(
$::exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$instance_manager->{'path_log'}, # stdout
$instance_manager->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
if ( ! $instance_manager->{'pid'} )
{
mtr_report('Could not start Instance Manager');
return;
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
if ( ! sleep_until_file_created(
$instance_manager->{'path_pid'},
$instance_manager->{'start_timeout'},
-1)) # real PID is still unknown
{
mtr_report("Instance Manager PID file is missing");
return;
}
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
mtr_debug("Instance Manager started. PID: $instance_manager->{pid}.");
# Wait until we can connect to IM.
my $IM_CONNECT_TIMEOUT= 30;
unless (mtr_im_wait_for_connection($instance_manager,
$IM_CONNECT_TIMEOUT, 1))
{
mtr_debug("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_error("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
}
# Wait until we can connect to guarded mysqld-instances
# (in other words -- wait for IM to start guarded instances).
for (my $idx= 0; $idx < 2; ++$idx)
{
my $mysqld= $instance_manager->{'instances'}->[$idx];
next if exists $mysqld->{'nonguarded'};
mtr_debug("Waiting for mysqld[$idx] to start...");
unless (mtr_im_wait_for_mysqld($mysqld, 30, 1))
{
mtr_debug("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_error("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
}
mtr_debug("mysqld[$idx] started.");
}
mtr_debug("Instance Manager started.");
mtr_im_load_pids($instance_manager);
}
##############################################################################
sub mtr_im_stop($$) {
my $instance_manager= shift;
my $where= shift;
mtr_debug("Stopping Instance Manager...");
# Try graceful shutdown.
mtr_im_terminate($instance_manager);
# Check that all processes died.
unless (mtr_im_check_alive($instance_manager))
{
mtr_debug("Instance Manager has been stopped successfully.");
mtr_im_cleanup($instance_manager);
return 1;
}
# Instance Manager don't want to die. We should kill it.
mtr_im_errlog("[$where] Instance Manager did not shutdown gracefully.");
mtr_im_kill($instance_manager);
# Check again that all IM-related processes have been killed.
my $im_is_alive= mtr_im_check_alive($instance_manager);
mtr_im_cleanup($instance_manager);
if ($im_is_alive)
{
mtr_error("Can not kill Instance Manager or its children.");
return 0;
}
mtr_debug("Instance Manager has been killed successfully.");
return 1;
}
########################################################################### ###########################################################################
1; 1;
...@@ -66,10 +66,6 @@ ...@@ -66,10 +66,6 @@
# "http://www.plover.com/~mjd/perl/Trace/" and run this script like # "http://www.plover.com/~mjd/perl/Trace/" and run this script like
# "perl -d:Trace mysql-test-run.pl" # "perl -d:Trace mysql-test-run.pl"
# #
# FIXME Save a PID file from this code as well, to record the process
# id we think it has. In Cygwin, a fork creates one Cygwin process,
# and then the real Win32 process. Cygwin Perl can only kill Cygwin
# processes. And "mysqld --bootstrap ..." doesn't save a PID file.
$Devel::Trace::TRACE= 0; # Don't trace boring init stuff $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
...@@ -80,14 +76,19 @@ use File::Copy; ...@@ -80,14 +76,19 @@ use File::Copy;
use Cwd; use Cwd;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
#use Carp;
use IO::Socket; use IO::Socket;
use IO::Socket::INET; use IO::Socket::INET;
use Data::Dumper; use Data::Dumper;
use strict; use strict;
#use diagnostics; #use diagnostics;
our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
our $glob_netware= ($^O eq "NetWare"); # NetWare
require "lib/mtr_cases.pl"; require "lib/mtr_cases.pl";
require "lib/mtr_im.pl";
require "lib/mtr_process.pl"; require "lib/mtr_process.pl";
require "lib/mtr_timer.pl"; require "lib/mtr_timer.pl";
require "lib/mtr_io.pl"; require "lib/mtr_io.pl";
...@@ -129,10 +130,7 @@ our @mysqld_src_dirs= ...@@ -129,10 +130,7 @@ our @mysqld_src_dirs=
# structs. We let each struct be a separate hash. # structs. We let each struct be a separate hash.
# Misc global variables # Misc global variables
our $mysql_version_id;
our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_mysql_test_dir= undef; our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef; our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef; our $glob_hostname= undef;
...@@ -146,42 +144,36 @@ our @glob_test_mode; ...@@ -146,42 +144,36 @@ our @glob_test_mode;
our $glob_basedir; our $glob_basedir;
# The total result
our $path_charsetsdir; our $path_charsetsdir;
our $path_client_bindir; our $path_client_bindir;
our $path_language; our $path_language;
our $path_timefile; our $path_timefile;
our $path_snapshot; our $path_snapshot;
our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log; our $path_mysqltest_log;
our $path_current_test_log; our $path_current_test_log;
our $path_my_basedir; our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_trace; # unix formatted opt_vardir for trace files our $path_vardir_trace; # unix formatted opt_vardir for trace files
our $opt_tmpdir; # A path but set directly on cmd line our $opt_tmpdir; # A path but set directly on cmd line
our $opt_usage; our $opt_usage;
our $opt_suite; our $opt_suite;
our $opt_netware;
our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose our $opt_verbose= 0; # Verbose output, enable with --verbose
# Options FIXME not all....
our $exe_master_mysqld; our $exe_master_mysqld;
our $exe_mysql; our $exe_mysql;
our $exe_mysqladmin; our $exe_mysqladmin;
our $exe_mysqlbinlog; our $exe_mysqlbinlog;
our $exe_mysql_client_test; our $exe_mysql_client_test;
our $exe_mysqld; our $exe_mysqld;
our $exe_mysqlcheck; # Called from test case our $exe_mysqlcheck;
our $exe_mysqldump; # Called from test case our $exe_mysqldump;
our $exe_mysqlslap; # Called from test case our $exe_mysqlslap;
our $exe_mysqlimport; # Called from test case our $exe_mysqlimport;
our $exe_mysqlshow; # Called from test case our $exe_mysqlshow;
our $exe_mysql_fix_system_tables; our $exe_mysql_fix_system_tables;
our $exe_mysqltest; our $exe_mysqltest;
our $exe_ndbd; our $exe_ndbd;
...@@ -238,7 +230,7 @@ our $opt_gprof_dir; ...@@ -238,7 +230,7 @@ our $opt_gprof_dir;
our $opt_gprof_master; our $opt_gprof_master;
our $opt_gprof_slave; our $opt_gprof_slave;
our $master; # Will be struct in C our $master;
our $slave; our $slave;
our $clusters; our $clusters;
...@@ -268,7 +260,7 @@ our $opt_sleep_time_for_delete= 10; ...@@ -268,7 +260,7 @@ our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout; our $opt_testcase_timeout;
our $opt_suite_timeout; our $opt_suite_timeout;
my $default_testcase_timeout= 15; # 15 min max my $default_testcase_timeout= 15; # 15 min max
my $default_suite_timeout= 120; # 2 hours max my $default_suite_timeout= 180; # 3 hours max
our $opt_socket; our $opt_socket;
...@@ -325,14 +317,16 @@ our $exe_ndb_waiter; ...@@ -325,14 +317,16 @@ our $exe_ndb_waiter;
our $path_ndb_tools_dir; our $path_ndb_tools_dir;
our $path_ndb_examples_dir; our $path_ndb_examples_dir;
our $exe_ndb_example; our $exe_ndb_example;
our $file_ndb_testrun_log; our $path_ndb_testrun_log;
our @data_dir_lst; our @data_dir_lst;
our $used_binlog_format; our $used_binlog_format;
our $debug_compiled_binaries; our $debug_compiled_binaries;
our $glob_tot_real_time= 0; our $glob_tot_real_time= 0;
our $glob_innodb_supported;
# Default values read from mysqld
our $default_mysqld_port;
###################################################################### ######################################################################
# #
...@@ -348,10 +342,9 @@ sub executable_setup (); ...@@ -348,10 +342,9 @@ sub executable_setup ();
sub environment_setup (); sub environment_setup ();
sub kill_running_server (); sub kill_running_server ();
sub cleanup_stale_files (); sub cleanup_stale_files ();
sub check_ssl_support (); sub check_ssl_support ($);
sub check_running_as_root(); sub check_running_as_root();
sub check_ndbcluster_support (); sub check_ndbcluster_support ($);
sub check_innodb_support ();
sub rm_ndbcluster_tables ($); sub rm_ndbcluster_tables ($);
sub ndbcluster_start_install ($); sub ndbcluster_start_install ($);
sub ndbcluster_start ($$); sub ndbcluster_start ($$);
...@@ -390,12 +383,6 @@ sub main () { ...@@ -390,12 +383,6 @@ sub main () {
initial_setup(); initial_setup();
command_line_setup(); command_line_setup();
executable_setup(); executable_setup();
check_ndbcluster_support();
check_innodb_support();
check_ssl_support();
check_debug_support();
environment_setup(); environment_setup();
signal_setup(); signal_setup();
...@@ -465,13 +452,8 @@ sub initial_setup () { ...@@ -465,13 +452,8 @@ sub initial_setup () {
$glob_scriptname= basename($0); $glob_scriptname= basename($0);
$glob_win32_perl= ($^O eq "MSWin32");
$glob_cygwin_perl= ($^O eq "cygwin");
$glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
# We require that we are in the "mysql-test" directory # We require that we are in the "mysql-test" directory
# to run mysql-test-run # to run mysql-test-run
if (! -f $glob_scriptname) if (! -f $glob_scriptname)
{ {
mtr_error("Can't find the location for the mysql-test-run script\n" . mtr_error("Can't find the location for the mysql-test-run script\n" .
...@@ -495,13 +477,11 @@ sub initial_setup () { ...@@ -495,13 +477,11 @@ sub initial_setup () {
chomp($glob_mysql_test_dir); chomp($glob_mysql_test_dir);
} }
$glob_basedir= dirname($glob_mysql_test_dir); $glob_basedir= dirname($glob_mysql_test_dir);
# Expect mysql-bench to be located adjacent to the source tree, by default # Expect mysql-bench to be located adjacent to the source tree, by default
$glob_mysql_bench_dir= "$glob_basedir/../mysql-bench" $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
unless defined $glob_mysql_bench_dir; unless defined $glob_mysql_bench_dir;
# needs to be same length to test logging (FIXME what???)
$path_slave_load_tmpdir= "../../var/tmp";
$path_my_basedir= $path_my_basedir=
$opt_source_dist ? $glob_mysql_test_dir : $glob_basedir; $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
...@@ -668,7 +648,6 @@ sub command_line_setup () { ...@@ -668,7 +648,6 @@ sub command_line_setup () {
'comment=s' => \$opt_comment, 'comment=s' => \$opt_comment,
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
'netware' => \$opt_netware,
'reorder' => \$opt_reorder, 'reorder' => \$opt_reorder,
'enable-disabled' => \$opt_enable_disabled, 'enable-disabled' => \$opt_enable_disabled,
'script-debug' => \$opt_script_debug, 'script-debug' => \$opt_script_debug,
...@@ -744,9 +723,15 @@ sub command_line_setup () { ...@@ -744,9 +723,15 @@ sub command_line_setup () {
{ {
$opt_vardir= "$glob_mysql_test_dir/var"; $opt_vardir= "$glob_mysql_test_dir/var";
} }
$opt_vardir_trace= $opt_vardir; elsif ( $mysql_version_id < 50000 )
{
# --vardir was specified
mtr_error("--vardir option not supported until MySQL 5.0");
}
$path_vardir_trace= $opt_vardir;
# Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/... # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
$opt_vardir_trace=~ s/^\w://; $path_vardir_trace=~ s/^\w://;
# We make the path absolute, as the server will do a chdir() before usage # We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or unless ( $opt_vardir =~ m,^/, or
...@@ -767,12 +752,6 @@ sub command_line_setup () { ...@@ -767,12 +752,6 @@ sub command_line_setup () {
# Do sanity checks of command line arguments # Do sanity checks of command line arguments
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ( ! $opt_socket )
{ # FIXME set default before reading options?
# $opt_socket= '@MYSQL_UNIX_ADDR@';
$opt_socket= "/tmp/mysql.sock"; # FIXME
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Look at the command line options and set script flags # Look at the command line options and set script flags
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
...@@ -1054,6 +1033,7 @@ sub command_line_setup () { ...@@ -1054,6 +1033,7 @@ sub command_line_setup () {
path_datadir => "$opt_vardir/im_mysqld_1.data", path_datadir => "$opt_vardir/im_mysqld_1.data",
path_sock => "$sockdir/mysqld_1.sock", path_sock => "$sockdir/mysqld_1.sock",
path_pid => "$opt_vardir/run/mysqld_1.pid", path_pid => "$opt_vardir/run/mysqld_1.pid",
start_timeout => 400, # enough time create innodb tables
old_log_format => 1 old_log_format => 1
}; };
...@@ -1065,6 +1045,7 @@ sub command_line_setup () { ...@@ -1065,6 +1045,7 @@ sub command_line_setup () {
path_sock => "$sockdir/mysqld_2.sock", path_sock => "$sockdir/mysqld_2.sock",
path_pid => "$opt_vardir/run/mysqld_2.pid", path_pid => "$opt_vardir/run/mysqld_2.pid",
nonguarded => 1, nonguarded => 1,
start_timeout => 400, # enough time create innodb tables
old_log_format => 1 old_log_format => 1
}; };
...@@ -1120,6 +1101,7 @@ sub command_line_setup () { ...@@ -1120,6 +1101,7 @@ sub command_line_setup () {
$path_timefile= "$opt_vardir/log/mysqltest-time"; $path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_current_test_log= "$opt_vardir/log/current_test"; $path_current_test_log= "$opt_vardir/log/current_test";
$path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
} }
...@@ -1152,6 +1134,96 @@ sub snapshot_setup () { ...@@ -1152,6 +1134,96 @@ sub snapshot_setup () {
# #
############################################################################## ##############################################################################
sub check_mysqld_features () {
#
# Execute "mysqld --no-defaults --help --verbose", that will
# print out version and a list of all features and settings
#
my $found_variable_list_start= 0;
my $spec_file= "$opt_vardir/mysqld.spec";
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--verbose",
"--help"],
"", "$spec_file", "$spec_file", "") != 0 )
{
mtr_error("Failed to get version and list of features from %s",
$exe_mysqld);
}
my %mysqld_variables;
my $F= IO::File->new($spec_file) or
mtr_error("can't open file \"$spec_file\": $!");
while ( my $line= <$F> )
{
# First look for version
if ( !$mysql_version_id )
{
# Look for version
if ( $line =~ /^$exe_mysqld\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
{
print "Major: $1 Minor: $2 Build: $3\n";
$mysql_version_id= $1*10000 + $2*100 + $3;
print "mysql_version_id: $mysql_version_id\n";
}
}
else
{
if (!$found_variable_list_start)
{
# Look for start of variables list
if ( $line =~ /[\-]+\s[\-]+/ )
{
$found_variable_list_start= 1;
}
}
else
{
# Put variables into hash
if ( $line =~ /^([\S]+)[ \t]+(.*)$/ )
{
# print "$1=$2\n";
$mysqld_variables{$1}= $2;
}
else
{
# The variable list is ended with a blank line, so when a line
# doesn't match the above regex, break the loop
last;
}
}
}
}
unlink($spec_file);
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
mtr_error("Could not find variabes list") unless $found_variable_list_start;
check_ndbcluster_support(\%mysqld_variables);
check_ssl_support(\%mysqld_variables);
check_debug_support(\%mysqld_variables);
if ( $mysql_version_id < 50000 )
{
# Instance manager is not supported until 5.0
$opt_skip_im= 1;
}
if ( $mysql_version_id < 50100 )
{
# Slave cluster is not supported until 5.1
$opt_skip_ndbcluster_slave= 1;
}
# Set default values from mysqld_variables
$opt_socket= %mysqld_variables->{'socket'};
$default_mysqld_port = %mysqld_variables->{'port'};
}
sub executable_setup () { sub executable_setup () {
# #
...@@ -1169,71 +1241,65 @@ sub executable_setup () { ...@@ -1169,71 +1241,65 @@ sub executable_setup () {
} }
} }
if ( $opt_source_dist ) # Look for the path where to find the client binaries
{ $path_client_bindir= mtr_path_exists("$glob_basedir/client",
if ( $glob_win32 ) "$glob_basedir/client_release",
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/client_debug", "$glob_basedir/client_debug",
"$glob_basedir/bin",
# New CMake locations.
"$glob_basedir/client/release", "$glob_basedir/client/release",
"$glob_basedir/client/debug"); "$glob_basedir/client/debug",
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max-nt", "$glob_basedir/bin");
# Look for the mysqld executable
$exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max", "$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt", "$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld", "$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-debug", "$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max",
"$glob_basedir/libexec/mysqld",
"$glob_basedir/sql/release/mysqld", "$glob_basedir/sql/release/mysqld",
"$glob_basedir/sql/debug/mysqld"); "$glob_basedir/sql/debug/mysqld");
$path_language= mtr_path_exists("$glob_basedir/share/english/",
"$glob_basedir/sql/share/english/"); $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets", $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
"$glob_basedir/sql/share/charsets");
# Use the mysqld found above to find out what features are available
check_mysqld_features();
# Look for language files and charsetsdir, use same share
my $path_share= mtr_path_exists("$glob_basedir/share",
"$glob_basedir/sql/share",
"$glob_basedir/share/mysql",
"$glob_basedir/share");
$path_language= mtr_path_exists("$path_share/english");
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
# Look for my_print_defaults
$exe_my_print_defaults= $exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults", mtr_exe_exists("$path_client_bindir/my_print_defaults",
"$glob_basedir/extra/my_print_defaults",
"$glob_basedir/extra/release/my_print_defaults", "$glob_basedir/extra/release/my_print_defaults",
"$glob_basedir/extra/debug/my_print_defaults"); "$glob_basedir/extra/debug/my_print_defaults");
$exe_perror=
mtr_exe_exists("$path_client_bindir/perror", # Look for perror
$exe_perror= mtr_exe_exists("$glob_basedir/extra/perror",
"$path_client_bindir/perror",
"$glob_basedir/extra/release/perror", "$glob_basedir/extra/release/perror",
"$glob_basedir/extra/debug/perror"); "$glob_basedir/extra/debug/perror");
}
else
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client");
$exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld");
$exe_mysqlslap= mtr_exe_exists ("$path_client_bindir/mysqlslap");
$path_language= mtr_path_exists("$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/sql/share/charsets");
$exe_im= mtr_exe_exists(
"$glob_basedir/server-tools/instance-manager/mysqlmanager");
$exe_my_print_defaults=
mtr_exe_exists("$glob_basedir/extra/my_print_defaults");
$exe_perror=
mtr_exe_exists("$glob_basedir/extra/perror");
}
if ( $glob_use_embedded_server ) if ( ! $opt_skip_im )
{
my $path_examples= "$glob_basedir/libmysqld/examples";
$exe_mysqltest= mtr_exe_exists("$path_examples/mysqltest_embedded");
$exe_mysql_client_test=
mtr_exe_exists("$path_examples/mysql_client_test_embedded",
"/usr/bin/false");
}
else
{ {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); # Look for instance manager binary - mysqlmanager
$exe_mysql_client_test= $exe_im=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test", mtr_exe_exists(
"$glob_basedir/tests/release/mysql_client_test", "$glob_basedir/server-tools/instance-manager/mysqlmanager",
"$glob_basedir/tests/debug/mysql_client_test", "$glob_basedir/libexec/mysqlmanager");
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
} }
# Look for the client binaries
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
...@@ -1241,89 +1307,65 @@ sub executable_setup () { ...@@ -1241,89 +1307,65 @@ sub executable_setup () {
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
# Look for mysql_fix_system_table script
$exe_mysql_fix_system_tables= $exe_mysql_fix_system_tables=
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"/usr/bin/false"); "$path_client_bindir/mysql_fix_privilege_tables");
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools");
$path_ndb_examples_dir= mtr_path_exists("$glob_basedir/storage/ndb/ndbapi-examples"); if ( ! $opt_skip_ndbcluster)
$exe_ndb_example= mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); {
$exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm"; # Look for ndb tols and binaries
$exe_ndb_waiter= "$glob_basedir/storage/ndb/tools/ndb_waiter"; my $ndb_path= mtr_path_exists("$glob_basedir/ndb",
$exe_ndbd= "$glob_basedir/storage/ndb/src/kernel/ndbd"; "$glob_basedir/storage/ndb");
$exe_ndb_mgmd= "$glob_basedir/storage/ndb/src/mgmsrv/ndb_mgmd";
$path_ndb_tools_dir= mtr_path_exists("$ndb_path/tools",
"$glob_basedir/bin");
$exe_ndb_mgm=
mtr_exe_exists("$ndb_path/src/mgmclient/ndb_mgm",
"$glob_basedir/bin/ndb_mgm");
$exe_ndb_mgmd=
mtr_exe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
"$glob_basedir/bin/ndb_mgmd");
$exe_ndb_waiter=
mtr_exe_exists("$ndb_path/tools/ndb_waiter",
"$glob_basedir/bin/ndb_waiter");
$exe_ndbd=
mtr_exe_exists("$ndb_path/src/kernel/ndbd",
"$glob_basedir/bin/ndbd");
}
# Look for the udf_example library
$lib_udf_example= $lib_udf_example=
mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so", mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so");
"$glob_basedir/sql/release/udf_example.dll",
"$glob_basedir/sql/debug/udf_example.dll");
}
else
{
$path_client_bindir= mtr_path_exists("$glob_basedir/bin");
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_fix_system_tables=
mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables",
"$glob_basedir/scripts/mysql_fix_privilege_tables",
"/usr/bin/false");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
$exe_perror=
mtr_exe_exists("$path_client_bindir/perror");
$path_language= mtr_path_exists("$glob_basedir/share/mysql/english/",
"$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/mysql/charsets",
"$glob_basedir/share/charsets");
if ( $glob_win32 ) # Look for mysqltest executable
if ( $glob_use_embedded_server )
{ {
$exe_mysqld= mtr_exe_exists ("$glob_basedir/bin/mysqld-nt", $exe_mysqltest=
"$glob_basedir/bin/mysqld", mtr_exe_exists("$glob_basedir/libmysqld/examples/mysqltest_embedded",
"$glob_basedir/bin/mysqld-debug",); "$path_client_bindir/mysqltest_embedded");
} }
else else
{ {
$exe_mysqld= mtr_exe_exists ("$glob_basedir/libexec/mysqld", $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
"$glob_basedir/bin/mysqld");
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
} }
$exe_im= mtr_exe_exists("$glob_basedir/libexec/mysqlmanager",
"$glob_basedir/bin/mysqlmanager"); # Look for mysql_client_test executable
if ( $glob_use_embedded_server ) if ( $glob_use_embedded_server )
{ {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest_embedded");
$exe_mysql_client_test= $exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test_embedded", mtr_exe_exists("$glob_basedir/libmysqld/examples/mysql_client_test_embedded",
"$path_client_bindir/mysql_client_test_embedded", "$glob_basedir/tests/mysqltest_embedded");
"/usr/bin/false");
} }
else else
{ {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysql_client_test= $exe_mysql_client_test=
mtr_exe_exists("$path_client_bindir/mysql_client_test", mtr_exe_exists("$glob_basedir/tests/mysql_client_test");
"$glob_basedir/tests/release/mysql_client_test",
"$glob_basedir/tests/debug/mysql_client_test",
"/usr/bin/false"); # FIXME temporary
} }
$path_ndb_tools_dir= "$glob_basedir/bin";
$path_ndb_examples_dir= "$glob_basedir/ndbapi-examples";
$exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm";
$exe_ndb_waiter= "$glob_basedir/bin/ndb_waiter";
$exe_ndbd= "$glob_basedir/bin/ndbd";
$exe_ndb_mgmd= "$glob_basedir/bin/ndb_mgmd";
}
$exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
$exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
$file_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
} }
...@@ -1422,8 +1464,7 @@ sub environment_setup () { ...@@ -1422,8 +1464,7 @@ sub environment_setup () {
$ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'}; $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'};
$ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
$ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME $ENV{'MYSQL_TCP_PORT'}= $default_mysqld_port;
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
...@@ -1440,12 +1481,12 @@ sub environment_setup () { ...@@ -1440,12 +1481,12 @@ sub environment_setup () {
$ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
$ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log; $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
$ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring; $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
$ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
$ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
$ENV{'NDB_EXAMPLES_OUTPUT'}= $file_ndb_testrun_log; $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env for IM # Setup env for IM
...@@ -1475,7 +1516,7 @@ sub environment_setup () { ...@@ -1475,7 +1516,7 @@ sub environment_setup () {
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlcheck .= $cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
} }
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
...@@ -1488,9 +1529,9 @@ sub environment_setup () { ...@@ -1488,9 +1529,9 @@ sub environment_setup () {
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqldump .= $cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
$cmdline_mysqldumpslave .= $cmdline_mysqldumpslave .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
} }
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
...@@ -1510,7 +1551,7 @@ sub environment_setup () { ...@@ -1510,7 +1551,7 @@ sub environment_setup () {
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlslap .= $cmdline_mysqlslap .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
} }
$ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap; $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
} }
...@@ -1526,7 +1567,7 @@ sub environment_setup () { ...@@ -1526,7 +1567,7 @@ sub environment_setup () {
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlimport .= $cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
} }
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
...@@ -1542,7 +1583,7 @@ sub environment_setup () { ...@@ -1542,7 +1583,7 @@ sub environment_setup () {
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlshow .= $cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
} }
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
...@@ -1551,13 +1592,16 @@ sub environment_setup () { ...@@ -1551,13 +1592,16 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
my $cmdline_mysqlbinlog= my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" . "$exe_mysqlbinlog" .
" --no-defaults --local-load=$opt_tmpdir" . " --no-defaults --local-load=$opt_tmpdir";
" --character-sets-dir=$path_charsetsdir"; if ( $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
}
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlbinlog .= $cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
} }
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
...@@ -1578,13 +1622,16 @@ sub environment_setup () { ...@@ -1578,13 +1622,16 @@ sub environment_setup () {
my $cmdline_mysql_client_test= my $cmdline_mysql_client_test=
"$exe_mysql_client_test --no-defaults --testcase --user=root --silent " . "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
"--port=$master->[0]->{'port'} " . "--port=$master->[0]->{'port'} " .
"--vardir=$opt_vardir " .
"--socket=$master->[0]->{'path_sock'}"; "--socket=$master->[0]->{'path_sock'}";
if ( $mysql_version_id >= 50000 )
{
$cmdline_mysql_client_test .=" --vardir=$opt_vardir";
}
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysql_client_test .= $cmdline_mysql_client_test .=
" --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace"; " --debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace";
} }
if ( $glob_use_embedded_server ) if ( $glob_use_embedded_server )
...@@ -1601,7 +1648,8 @@ sub environment_setup () { ...@@ -1601,7 +1648,8 @@ sub environment_setup () {
# Setup env so childs can execute mysql_fix_system_tables # Setup env so childs can execute mysql_fix_system_tables
# ---------------------------------------------------- # ----------------------------------------------------
my $cmdline_mysql_fix_system_tables= my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " . "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
"--user=root --password= " .
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
"--port=$master->[0]->{'port'} " . "--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}"; "--socket=$master->[0]->{'path_sock'}";
...@@ -1641,12 +1689,21 @@ sub environment_setup () { ...@@ -1641,12 +1689,21 @@ sub environment_setup () {
print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n"; print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n"; print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
if ( ! $opt_skip_ndbcluster )
{
print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n"; print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
if ( ! $opt_skip_ndbcluster_slave )
{
print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n"; print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
}
}
if ( ! $opt_skip_im )
{
print "Using IM_PORT = $ENV{IM_PORT}\n"; print "Using IM_PORT = $ENV{IM_PORT}\n";
print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n"; print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n"; print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
} }
}
} }
...@@ -1694,11 +1751,7 @@ sub kill_running_server () { ...@@ -1694,11 +1751,7 @@ sub kill_running_server () {
# started from this run of the script, this is terminating # started from this run of the script, this is terminating
# leftovers from previous runs. # leftovers from previous runs.
mtr_report("Killing Possible Leftover Processes");
mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers(); mtr_kill_leftovers();
} }
} }
...@@ -1801,8 +1854,8 @@ sub check_running_as_root () { ...@@ -1801,8 +1854,8 @@ sub check_running_as_root () {
} }
sub check_ssl_support ($) {
sub check_ssl_support () { my $mysqld_variables= shift;
if ($opt_skip_ssl || $opt_extern) if ($opt_skip_ssl || $opt_extern)
{ {
...@@ -1812,13 +1865,7 @@ sub check_ssl_support () { ...@@ -1812,13 +1865,7 @@ sub check_ssl_support () {
return; return;
} }
# check ssl support by testing using a switch if ( ! $mysqld_variables->{'ssl'} )
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--ssl",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{ {
if ( $opt_ssl) if ( $opt_ssl)
{ {
...@@ -1835,17 +1882,12 @@ sub check_ssl_support () { ...@@ -1835,17 +1882,12 @@ sub check_ssl_support () {
} }
sub check_debug_support () { sub check_debug_support ($) {
my $mysqld_variables= shift;
# check debug support by testing using a switch if ( $mysqld_variables->{'debug'} )
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--debug",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{ {
# mtr_report("Binaries are not debug compiled"); #mtr_report("Binaries are not debug compiled");
$debug_compiled_binaries= 0; $debug_compiled_binaries= 0;
if ( $opt_debug ) if ( $opt_debug )
...@@ -1858,32 +1900,14 @@ sub check_debug_support () { ...@@ -1858,32 +1900,14 @@ sub check_debug_support () {
$debug_compiled_binaries= 1; $debug_compiled_binaries= 1;
} }
sub check_innodb_support () {
# check innodb support by testing using a switch
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--innodb-data-file-path",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{
# mtr_report("Binaries does not support innodb");
$glob_innodb_supported= 0;
return;
}
mtr_report("Using innodb when necessary");
$glob_innodb_supported= 1;
}
############################################################################## ##############################################################################
# #
# Start the ndb cluster # Start the ndb cluster
# #
############################################################################## ##############################################################################
sub check_ndbcluster_support () { sub check_ndbcluster_support ($) {
my $mysqld_variables= shift;
if ($opt_skip_ndbcluster) if ($opt_skip_ndbcluster)
{ {
...@@ -1892,13 +1916,7 @@ sub check_ndbcluster_support () { ...@@ -1892,13 +1916,7 @@ sub check_ndbcluster_support () {
return; return;
} }
# check ndbcluster support by runnning mysqld using a switch if ( ! $mysqld_variables->{'ndb-connectstring'} )
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--ndb-use-exact-count",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{ {
mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster"); mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
$opt_skip_ndbcluster= 1; $opt_skip_ndbcluster= 1;
...@@ -1964,6 +1982,11 @@ sub ndbcluster_start_install ($) { ...@@ -1964,6 +1982,11 @@ sub ndbcluster_start_install ($) {
s/CHOOSE_HOSTNAME_.*/$ndb_host/; s/CHOOSE_HOSTNAME_.*/$ndb_host/;
s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/; s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
s/CHOOSE_PORT_MGM/$cluster->{'port'}/; s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
if ( $mysql_version_id < 50000 )
{
my $base_port= $cluster->{'port'} + 1;
s/CHOOSE_PORT_TRANSPORTER/$base_port/;
}
s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/; s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
print OUT "$_ \n"; print OUT "$_ \n";
...@@ -2085,7 +2108,10 @@ sub ndbd_start ($$$) { ...@@ -2085,7 +2108,10 @@ sub ndbd_start ($$$) {
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--core"); mtr_add_arg($args, "--core");
mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}"); mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
if ( $mysql_version_id >= 50000)
{
mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir"); mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
}
mtr_add_arg($args, "--nodaemon"); mtr_add_arg($args, "--nodaemon");
mtr_add_arg($args, "$extra_args"); mtr_add_arg($args, "$extra_args");
...@@ -2186,8 +2212,6 @@ sub run_benchmarks ($) { ...@@ -2186,8 +2212,6 @@ sub run_benchmarks ($) {
chdir($glob_mysql_bench_dir) chdir($glob_mysql_bench_dir)
or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!"); or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
# FIXME write shorter....
if ( ! $benchmark ) if ( ! $benchmark )
{ {
mtr_add_arg($args, "--log"); mtr_add_arg($args, "--log");
...@@ -2219,9 +2243,6 @@ sub run_benchmarks ($) { ...@@ -2219,9 +2243,6 @@ sub run_benchmarks ($) {
# #
############################################################################## ##############################################################################
# FIXME how to specify several suites to run? Comma separated list?
sub run_suite () { sub run_suite () {
my ($suite, $tests)= @_; my ($suite, $tests)= @_;
...@@ -2316,7 +2337,8 @@ sub mysql_install_db () { ...@@ -2316,7 +2337,8 @@ sub mysql_install_db () {
my $cluster_started_ok= 1; # Assume it can be started my $cluster_started_ok= 1; # Assume it can be started
if (ndbcluster_start_install($clusters->[0]) || if (ndbcluster_start_install($clusters->[0]) ||
$max_slave_num && ndbcluster_start_install($clusters->[1])) ($max_slave_num && !$opt_skip_ndbcluster_slave &&
ndbcluster_start_install($clusters->[1])))
{ {
mtr_warning("Failed to start install of cluster"); mtr_warning("Failed to start install of cluster");
$cluster_started_ok= 0; $cluster_started_ok= 0;
...@@ -2419,10 +2441,10 @@ sub install_db ($$) { ...@@ -2419,10 +2441,10 @@ sub install_db ($$) {
if ( $opt_debug ) if ( $opt_debug )
{ {
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace", mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
$opt_vardir_trace, $type); $path_vardir_trace, $type);
} }
if ( ! $opt_netware ) if ( ! $glob_netware )
{ {
mtr_add_arg($args, "--language=%s", $path_language); mtr_add_arg($args, "--language=%s", $path_language);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
...@@ -2612,12 +2634,10 @@ sub do_before_run_mysqltest($) ...@@ -2612,12 +2634,10 @@ sub do_before_run_mysqltest($)
unlink("suite/$opt_suite/r/$tname.reject"); unlink("suite/$opt_suite/r/$tname.reject");
} }
# MASV cleanup...
mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics # output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); mtr_tofile($path_ndb_testrun_log,"CURRENT TEST $tname\n");
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} ) if ( $master->[1]->{'pid'} )
...@@ -2631,12 +2651,11 @@ sub do_after_run_mysqltest($) ...@@ -2631,12 +2651,11 @@ sub do_after_run_mysqltest($)
my $tinfo= shift; my $tinfo= shift;
my $tname= $tinfo->{'name'}; my $tname= $tinfo->{'name'};
#MASV cleanup
# Save info from this testcase run to mysqltest.log # Save info from this testcase run to mysqltest.log
my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile; mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
if -f $path_timefile;
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
mtr_tofile($path_mysqltest_log, $testcase_log); }
}
############################################################################## ##############################################################################
...@@ -2728,7 +2747,10 @@ sub run_testcase ($) { ...@@ -2728,7 +2747,10 @@ sub run_testcase ($) {
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' ) if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
{ {
mtr_im_stop($instance_manager, $tinfo->{'name'}); unless ( mtr_im_stop($instance_manager, $tinfo->{'name'}) )
{
mtr_error("Failed to stop Instance Manager.")
}
} }
} }
...@@ -2951,7 +2973,11 @@ sub mysqld_arguments ($$$$$) { ...@@ -2951,7 +2973,11 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
if ( $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
}
mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
...@@ -3000,9 +3026,12 @@ sub mysqld_arguments ($$$$$) { ...@@ -3000,9 +3026,12 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndbcluster", $prefix); mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$cluster->{'connect_string'}); $cluster->{'connect_string'});
if ( $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
} }
} }
}
if ( $type eq 'slave' ) if ( $type eq 'slave' )
{ {
...@@ -3018,7 +3047,7 @@ sub mysqld_arguments ($$$$$) { ...@@ -3018,7 +3047,7 @@ sub mysqld_arguments ($$$$$) {
$opt_vardir, $sidx); # FIXME use own dir for binlogs $opt_vardir, $sidx); # FIXME use own dir for binlogs
mtr_add_arg($args, "%s--log-slave-updates", $prefix); mtr_add_arg($args, "%s--log-slave-updates", $prefix);
} }
# FIXME option duplicated for slave
mtr_add_arg($args, "%s--log=%s", $prefix, mtr_add_arg($args, "%s--log=%s", $prefix,
$slave->[$idx]->{'path_mylog'}); $slave->[$idx]->{'path_mylog'});
mtr_add_arg($args, "%s--master-retry-count=10", $prefix); mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
...@@ -3075,8 +3104,11 @@ sub mysqld_arguments ($$$$$) { ...@@ -3075,8 +3104,11 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndbcluster", $prefix); mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'}); $clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'});
if ( $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
} }
}
} # end slave } # end slave
if ( $opt_debug ) if ( $opt_debug )
...@@ -3084,12 +3116,12 @@ sub mysqld_arguments ($$$$$) { ...@@ -3084,12 +3116,12 @@ sub mysqld_arguments ($$$$$) {
if ( $type eq 'master' ) if ( $type eq 'master' )
{ {
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace", mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
$prefix, $opt_vardir_trace, $sidx); $prefix, $path_vardir_trace, $sidx);
} }
if ( $type eq 'slave' ) if ( $type eq 'slave' )
{ {
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace", mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
$prefix, $opt_vardir_trace, $sidx); $prefix, $path_vardir_trace, $sidx);
} }
} }
...@@ -3097,7 +3129,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -3097,7 +3129,6 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
if ( $opt_ssl_supported ) if ( $opt_ssl_supported )
{ {
...@@ -3275,8 +3306,14 @@ sub stop_all_servers () { ...@@ -3275,8 +3306,14 @@ sub stop_all_servers () {
print "Stopping All Servers\n"; print "Stopping All Servers\n";
if ( ! $opt_skip_im )
{
print "Shutting-down Instance Manager\n"; print "Shutting-down Instance Manager\n";
mtr_im_stop($instance_manager, "stop_all_servers"); unless (mtr_im_stop($instance_manager, "stop_all_servers"))
{
mtr_error("Failed to stop Instance Manager.")
}
}
my %admin_pids; # hash of admin processes that requests shutdown my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill my @kill_pids; # list of processes to shutdown/kill
...@@ -3627,6 +3664,11 @@ sub run_testcase_start_servers($) { ...@@ -3627,6 +3664,11 @@ sub run_testcase_start_servers($) {
return; return;
} }
# -------------------------------------------------------
# Init variables that can change between server starts
# -------------------------------------------------------
$ENV{'TZ'}= $tinfo->{'timezone'};
if ( $tinfo->{'component_id'} eq 'mysqld' ) if ( $tinfo->{'component_id'} eq 'mysqld' )
{ {
if ( ! $opt_skip_ndbcluster and if ( ! $opt_skip_ndbcluster and
...@@ -3650,17 +3692,22 @@ sub run_testcase_start_servers($) { ...@@ -3650,17 +3692,22 @@ sub run_testcase_start_servers($) {
{ {
# Test needs cluster, start an extra mysqld connected to cluster # Test needs cluster, start an extra mysqld connected to cluster
# First wait for first mysql server to have created ndb system tables ok if ( $mysql_version_id >= 50100 )
# FIXME This is a workaround so that only one mysqld creates the tables {
# First wait for first mysql server to have created ndb system
# tables ok FIXME This is a workaround so that only one mysqld
# create the tables
if ( ! sleep_until_file_created( if ( ! sleep_until_file_created(
"$master->[0]->{'path_myddir'}/cluster/apply_status.ndb", "$master->[0]->{'path_myddir'}/cluster/apply_status.ndb",
$master->[0]->{'start_timeout'}, $master->[0]->{'start_timeout'},
$master->[0]->{'pid'})) $master->[0]->{'pid'}))
{ {
mtr_report_test_name($tinfo);
mtr_report("Failed to create 'cluster/apply_status' table"); mtr_report("Failed to create 'cluster/apply_status' table");
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
return; return;
} }
}
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
mysqld_start($master->[1],$tinfo->{'master_opt'},[]); mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
...@@ -3681,7 +3728,14 @@ sub run_testcase_start_servers($) { ...@@ -3681,7 +3728,14 @@ sub run_testcase_start_servers($) {
im_create_defaults_file($instance_manager); im_create_defaults_file($instance_manager);
mtr_im_start($instance_manager, $tinfo->{im_opts}); unless ( mtr_im_start($instance_manager, $tinfo->{im_opts}) )
{
mtr_report_test_name($tinfo);
report_failure_and_restart($tinfo);
mtr_report("Failed to start Instance Manager. " .
"The test '$tname' is marked as failed.");
return;
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -3885,7 +3939,7 @@ sub run_mysqltest ($) { ...@@ -3885,7 +3939,7 @@ sub run_mysqltest ($) {
if ( $opt_debug ) if ( $opt_debug )
{ {
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
$opt_vardir_trace); $path_vardir_trace);
} }
if ( $opt_ssl_supported ) if ( $opt_ssl_supported )
...@@ -3982,11 +4036,6 @@ sub run_mysqltest ($) { ...@@ -3982,11 +4036,6 @@ sub run_mysqltest ($) {
} }
} }
# -------------------------------------------------------
# Init variables that change for each testcase
# -------------------------------------------------------
$ENV{'TZ'}= $tinfo->{'timezone'};
my $res = mtr_run_test($exe,$args,"","",$path_timefile,""); my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases ) if ( $opt_check_testcases )
...@@ -4216,9 +4265,7 @@ sub usage ($) { ...@@ -4216,9 +4265,7 @@ sub usage ($) {
print STDERR <<HERE; print STDERR <<HERE;
mysql-test-run [ OPTIONS ] [ TESTCASE ] $0 [ OPTIONS ] [ TESTCASE ]
FIXME when is TESTCASE arg used or not?!
Options to control what engine/variation to run Options to control what engine/variation to run
......
...@@ -195,7 +195,7 @@ select (@before:=unix_timestamp())*0; ...@@ -195,7 +195,7 @@ select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0 (@before:=unix_timestamp())*0
0 0
begin; begin;
select * from t1 for update; select * from t1 for update;
insert into t2 values (20); insert into t2 values (20);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select (@after:=unix_timestamp())*0; select (@after:=unix_timestamp())*0;
......
drop table if exists t1; drop table if exists t1;
create table t1(n int not null, key(n), key(n), key(n), key(n)); create table t1(n int not null, key(n), key(n), key(n), key(n));
check table t1 extended; check table t1 extended;
insert into t1 values (200000); insert into t1 values (200000);
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
......
...@@ -79,9 +79,9 @@ drop table if exists t1; ...@@ -79,9 +79,9 @@ drop table if exists t1;
create table t1 (i int); create table t1 (i int);
lock tables t1 read; lock tables t1 read;
create database mysqltest; create database mysqltest;
drop table t1; drop table t1;
show open tables; show open tables;
drop database mysqltest; drop database mysqltest;
select 1; select 1;
1 1
1 1
......
...@@ -9,13 +9,13 @@ n ...@@ -9,13 +9,13 @@ n
flush tables with read lock; flush tables with read lock;
drop table t2; drop table t2;
ERROR HY000: Can't execute the query because you have a conflicting read lock ERROR HY000: Can't execute the query because you have a conflicting read lock
drop table t2; drop table t2;
unlock tables; unlock tables;
create database mysqltest; create database mysqltest;
create table mysqltest.t1(n int); create table mysqltest.t1(n int);
insert into mysqltest.t1 values (23); insert into mysqltest.t1 values (23);
flush tables with read lock; flush tables with read lock;
drop database mysqltest; drop database mysqltest;
select * from mysqltest.t1; select * from mysqltest.t1;
n n
23 23
...@@ -51,7 +51,7 @@ drop table t1, t2, t3; ...@@ -51,7 +51,7 @@ drop table t1, t2, t3;
create table t1 (c1 int); create table t1 (c1 int);
create table t2 (c1 int); create table t2 (c1 int);
lock table t1 write; lock table t1 write;
flush tables with read lock; flush tables with read lock;
insert into t2 values(1); insert into t2 values(1);
unlock tables; unlock tables;
drop table t1, t2; drop table t1, t2;
...@@ -5,7 +5,7 @@ insert into t1 values(1); ...@@ -5,7 +5,7 @@ insert into t1 values(1);
flush tables with read lock; flush tables with read lock;
select * from t1; select * from t1;
a a
commit; commit;
select * from t1; select * from t1;
a a
unlock tables; unlock tables;
...@@ -14,8 +14,8 @@ select * from t1 for update; ...@@ -14,8 +14,8 @@ select * from t1 for update;
a a
1 1
begin; begin;
select * from t1 for update; select * from t1 for update;
flush tables with read lock; flush tables with read lock;
commit; commit;
a a
1 1
...@@ -45,7 +45,7 @@ flush tables with read lock; ...@@ -45,7 +45,7 @@ flush tables with read lock;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 102 master-bin.000001 102
commit; commit;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 102 master-bin.000001 102
......
drop table if exists t1; drop table if exists t1;
create table t1 (kill_id int); create table t1 (kill_id int);
insert into t1 values(connection_id()); insert into t1 values(connection_id());
flush tables with read lock; flush tables with read lock;
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
......
...@@ -63,7 +63,7 @@ FROM t1 ...@@ -63,7 +63,7 @@ FROM t1
WHERE conn = 'default'; WHERE conn = 'default';
IS_USED_LOCK('bug16501') = connection_id IS_USED_LOCK('bug16501') = connection_id
1 1
SELECT GET_LOCK('bug16501',600); SELECT GET_LOCK('bug16501',600);
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID(); SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID() IS_USED_LOCK('bug16501') = CONNECTION_ID()
1 1
......
...@@ -336,12 +336,12 @@ drop database mysqltest_1; ...@@ -336,12 +336,12 @@ drop database mysqltest_1;
set password = password("changed"); set password = password("changed");
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql' ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
lock table mysql.user write; lock table mysql.user write;
flush privileges; flush privileges;
grant all on *.* to 'mysqltest_1'@'localhost'; grant all on *.* to 'mysqltest_1'@'localhost';
unlock tables; unlock tables;
lock table mysql.user write; lock table mysql.user write;
set password for 'mysqltest_1'@'localhost' = password(''); set password for 'mysqltest_1'@'localhost' = password('');
revoke all on *.* from 'mysqltest_1'@'localhost'; revoke all on *.* from 'mysqltest_1'@'localhost';
unlock tables; unlock tables;
drop user 'mysqltest_1'@'localhost'; drop user 'mysqltest_1'@'localhost';
create database TESTDB; create database TESTDB;
......
...@@ -476,7 +476,7 @@ handler t1 read first; ...@@ -476,7 +476,7 @@ handler t1 read first;
c1 c1
1 1
send the below to another connection, do not wait for the result send the below to another connection, do not wait for the result
optimize table t1; optimize table t1;
proceed with the normal connection proceed with the normal connection
handler t1 read next; handler t1 read next;
c1 c1
...@@ -502,7 +502,7 @@ flush tables with read lock; ...@@ -502,7 +502,7 @@ flush tables with read lock;
drop table t1; drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock ERROR HY000: Can't execute the query because you have a conflicting read lock
send the below to another connection, do not wait for the result send the below to another connection, do not wait for the result
drop table t1; drop table t1;
proceed with the normal connection proceed with the normal connection
select * from t1; select * from t1;
c1 c1
......
...@@ -10,7 +10,7 @@ start transaction; ...@@ -10,7 +10,7 @@ start transaction;
select f1(); select f1();
f1() f1()
100 100
update t1 set col2=0 where col1=1; update t1 set col2=0 where col1=1;
select * from t1; select * from t1;
col1 col2 col1 col2
1 100 1 100
......
...@@ -22,7 +22,7 @@ create table t2 (id int unsigned not null); ...@@ -22,7 +22,7 @@ create table t2 (id int unsigned not null);
insert into t2 select id from t1; insert into t2 select id from t1;
create table t3 (kill_id int); create table t3 (kill_id int);
insert into t3 values(connection_id()); insert into t3 values(connection_id());
select id from t1 where id in (select distinct id from t2); select id from t1 where id in (select distinct id from t2);
select ((@id := kill_id) - kill_id) from t3; select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
...@@ -32,7 +32,7 @@ drop table t1, t2, t3; ...@@ -32,7 +32,7 @@ drop table t1, t2, t3;
select get_lock("a", 10); select get_lock("a", 10);
get_lock("a", 10) get_lock("a", 10)
1 1
select get_lock("a", 10); select get_lock("a", 10);
get_lock("a", 10) get_lock("a", 10)
NULL NULL
select 1; select 1;
......
...@@ -509,8 +509,8 @@ create table t2 (a int); ...@@ -509,8 +509,8 @@ create table t2 (a int);
insert into t2 values (10), (20), (30); insert into t2 values (10), (20), (30);
create view v1 as select a as b, a/10 as a from t2; create view v1 as select a as b, a/10 as a from t2;
lock table t1 write; lock table t1 write;
alter table t1 add column c int default 100 after a; alter table t1 add column c int default 100 after a;
update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
unlock tables; unlock tables;
select * from t1; select * from t1;
a c b a c b
......
...@@ -154,6 +154,19 @@ mysqltest: At line 1: End of line junk detected: "sleep 7 ...@@ -154,6 +154,19 @@ mysqltest: At line 1: End of line junk detected: "sleep 7
" "
mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: The sqlstate definition must start with an uppercase S
mysqltest: At line 1: The error name definition must start with an uppercase E
mysqltest: At line 1: Invalid argument to error: '9eeeee' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Invalid argument to error: '1sssss' - the errno may only consist of digits[0-9]
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
mysqltest: At line 1: The sqlstate may only consist of digits[0-9] and _uppercase_ letters
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
mysqltest: At line 1: Unknown SQL error name 'E9999'
mysqltest: At line 1: Invalid argument to error: '999e9' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Invalid argument to error: '9b' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Too many errorcodes specified
MySQL MySQL
"MySQL" "MySQL"
MySQL: The world''s most popular open source database MySQL: The world''s most popular open source database
...@@ -239,7 +252,7 @@ mysqltest: At line 1: Missing assignment operator in let ...@@ -239,7 +252,7 @@ mysqltest: At line 1: Missing assignment operator in let
1 1
# Execute: echo $success ; # Execute: echo $success ;
1 1
mysqltest: At line 1: Missing file name in source mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open file ./non_existingFile mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
...@@ -332,7 +345,7 @@ Counter is greater than 0, (counter=10) ...@@ -332,7 +345,7 @@ Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0) Counter is not 0, (counter=0)
1 1
Testing while with not Testing while with not
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: Missing '{' after while. Found "dec $i" mysqltest: At line 1: Missing '{' after while. Found "dec $i"
...@@ -371,17 +384,15 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 ...@@ -371,17 +384,15 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
mysqltest: At line 1: Syntax error in connect - expected '(' found 'mysqltest: At line 1: Missing connection host mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
mysqltest: At line 1: Missing connection host mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
mysqltest: At line 1: Missing connection user mysqltest: At line 1: Missing required argument 'host' to command 'connect'
mysqltest: At line 1: Missing connection user mysqltest: At line 1: Missing required argument 'host' to command 'connect'
mysqltest: At line 1: Missing connection password mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db'
mysqltest: At line 1: Missing connection db
mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP mysqltest: At line 1: Illegal option to connect: SMTP
OK OK
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted, you can have max 128 connections
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET); connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
...@@ -449,7 +460,6 @@ sleep; ...@@ -449,7 +460,6 @@ sleep;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
; ;
ERROR 42000: Query was empty ERROR 42000: Query was empty
End of 5.0 tests
select "b" as col1, "c" as col2; select "b" as col1, "c" as col2;
col1 col2 col1 col2
b c b c
...@@ -492,4 +502,3 @@ mysqltest: At line 1: Max delimiter length(16) exceeded ...@@ -492,4 +502,3 @@ mysqltest: At line 1: Max delimiter length(16) exceeded
hello hello
hello hello
End of tests End of tests
End of 5.1 tests
...@@ -326,7 +326,7 @@ insert into t1 values(3); ...@@ -326,7 +326,7 @@ insert into t1 values(3);
set i_var = sleep(3); set i_var = sleep(3);
return 0; return 0;
end;| end;|
select f1(); select f1();
select sleep(4); select sleep(4);
sleep(4) sleep(4)
0 0
......
...@@ -43,7 +43,7 @@ Note 1051 Unknown table 't4' ...@@ -43,7 +43,7 @@ Note 1051 Unknown table 't4'
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t3 (a int); CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
RENAME TABLE t1 TO t2, t3 to t4; RENAME TABLE t1 TO t2, t3 to t4;
show tables; show tables;
Tables_in_test Tables_in_test
t1 t1
......
...@@ -26,7 +26,7 @@ create table t2 (a int primary key); ...@@ -26,7 +26,7 @@ create table t2 (a int primary key);
insert into t2 values(1); insert into t2 values(1);
create table t3 (id int); create table t3 (id int);
insert into t3 values(connection_id()); insert into t3 values(connection_id());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
select (@id := id) - id from t3; select (@id := id) - id from t3;
(@id := id) - id (@id := id) - id
0 0
......
...@@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)` Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0); select master_pos_wait('master-bin.999999',0);
stop slave sql_thread; stop slave sql_thread;
master_pos_wait('master-bin.999999',0) master_pos_wait('master-bin.999999',0)
NULL NULL
...@@ -44,7 +44,7 @@ create table t2(id int); ...@@ -44,7 +44,7 @@ create table t2(id int);
insert into t2 values(connection_id()); insert into t2 values(connection_id());
create temporary table t3(n int); create temporary table t3(n int);
insert into t3 select get_lock('crash_lock%20C', 1) from t2; insert into t3 select get_lock('crash_lock%20C', 1) from t2;
update t1 set n = n + get_lock('crash_lock%20C', 2); update t1 set n = n + get_lock('crash_lock%20C', 2);
select (@id := id) - id from t2; select (@id := id) - id from t2;
(@id := id) - id (@id := id) - id
0 0
......
...@@ -31,7 +31,7 @@ create procedure bug9486() ...@@ -31,7 +31,7 @@ create procedure bug9486()
update t1, t2 set val= 1 where id1=id2; update t1, t2 set val= 1 where id1=id2;
call bug9486(); call bug9486();
lock tables t2 write; lock tables t2 write;
call bug9486(); call bug9486();
show processlist; show processlist;
Id User Host db Command Time State Info Id User Host db Command Time State Info
# root localhost test Sleep # NULL # root localhost test Sleep # NULL
...@@ -77,7 +77,7 @@ select * from t1; ...@@ -77,7 +77,7 @@ select * from t1;
end| end|
use test; use test;
lock table t1 write; lock table t1 write;
call p2(); call p2();
use test; use test;
drop procedure p1; drop procedure p1;
create procedure p1() select * from t1; create procedure p1() select * from t1;
......
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 (x1 int); CREATE TABLE t1 (x1 int);
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` ( ...@@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` ( ...@@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` ( ...@@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` ( ...@@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` ( ...@@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` ( ...@@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` ( ...@@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` ( ...@@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` ( ...@@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` ( ...@@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` ( ...@@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` ( ...@@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` ( ...@@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` ( ...@@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` ( ...@@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` ( ...@@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` ( ...@@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` ( ...@@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` ( ...@@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
......
...@@ -59,6 +59,7 @@ flush privileges; ...@@ -59,6 +59,7 @@ flush privileges;
connect (con10,localhost,test,gambling2,); connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql); connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password=""; set password="";
--error 1372 --error 1372
set password='gambling3'; set password='gambling3';
......
...@@ -317,7 +317,6 @@ select 3 from t1 ; ...@@ -317,7 +317,6 @@ select 3 from t1 ;
# #
#select 3 from t1 ; #select 3 from t1 ;
# End of 4.1 tests
--error 1 --error 1
--exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1 --exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
...@@ -388,6 +387,67 @@ select 3 from t1 ; ...@@ -388,6 +387,67 @@ select 3 from t1 ;
--sleep 1 # Wait for insert delayed to be executed. --sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed. --sleep 1 # Wait for insert delayed to be executed.
# ----------------------------------------------------------------------------
# Test error
# ----------------------------------------------------------------------------
# Missing argument
--error 1
--exec echo "error;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--error" | $MYSQL_TEST 2>&1
# First char must be uppercase 'S' or 'E' or [0-9]
--error 1
--exec echo "--error s99999" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--error e99999" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--error 9eeeee" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--error 1sssss" | $MYSQL_TEST 2>&1
# First char 'S' but too long
--error 1
--exec echo "--error S999999" | $MYSQL_TEST 2>&1
# First char 'S' but lowercase char found
--error 1
--exec echo "--error S99a99" | $MYSQL_TEST 2>&1
# First char 'S' but too short
--error 1
--exec echo "--error S9999" | $MYSQL_TEST 2>&1
# First char 'E' but not found in error array
--error 1
--exec echo "--error E9999" | $MYSQL_TEST 2>&1
# First char [0-9] but contains chars
--error 1
--exec echo "--error 999e9" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--error 9b" | $MYSQL_TEST 2>&1
# Multiple errorcodes separated by ','
--error 1,1,1,1
#--error 9,ER_PARSE_ERROR
#--error ER_PARSE_ERROR
#--error 9,ER_PARSE_ERROR,9,ER_PARSE_ERROR
#--error 9, ER_PARSE_ERROR, 9, ER_PARSE_ERROR
#--error 9,S00000,9,ER_PARSE_ERROR
#--error 9,S00000,9,ER_PARSE_ERROR,ER_PARSE_ERROR,ER_PARSE_ERROR,9,10,11,12
--error 9,S00000,9
--error 9,S00000,9,9,10,11,12
--error 9 ,10
--error 9 , 10
--error 9 , 10
--error 9 , 10
# Too many errorcodes specified
--error 1
--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test echo command # Test echo command
...@@ -610,6 +670,7 @@ echo $var3_var3; ...@@ -610,6 +670,7 @@ echo $var3_var3;
# Fix win paths # Fix win paths
--replace_result \\ / --replace_result \\ /
# Source a nonexisting file
--error 1 --error 1
--exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1 --exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1
...@@ -627,13 +688,16 @@ echo $var3_var3; ...@@ -627,13 +688,16 @@ echo $var3_var3;
# Test execution of source in a while loop # Test execution of source in a while loop
--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
echo here is the sourced script;
EOF
--disable_query_log --disable_query_log
let $outer= 2; # Number of outer loops let $outer= 2; # Number of outer loops
while ($outer) while ($outer)
{ {
eval SELECT '$outer = outer loop variable after while' AS ""; eval SELECT '$outer = outer loop variable after while' AS "";
--source include/sourced.inc --source $MYSQLTEST_VARDIR/tmp/sourced.inc
eval SELECT '$outer = outer loop variable before dec' AS ""; eval SELECT '$outer = outer loop variable before dec' AS "";
dec $outer; dec $outer;
...@@ -661,11 +725,12 @@ let $num= 9; ...@@ -661,11 +725,12 @@ let $num= 9;
while ($num) while ($num)
{ {
SELECT 'In loop' AS ""; SELECT 'In loop' AS "";
--source include/sourced1.inc --source $MYSQLTEST_VARDIR/tmp/sourced.inc
dec $num; dec $num;
} }
--enable_abort_on_error --enable_abort_on_error
--enable_query_log --enable_query_log
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test sleep command # Test sleep command
...@@ -817,10 +882,150 @@ while (!$i) ...@@ -817,10 +882,150 @@ while (!$i)
} }
# Exceed max nesting level # Exceed max nesting level
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
let $1 = 10;
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
echo $1;
dec $1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
EOF
# Fix win path # Fix win path
--replace_result \\ / --replace_result \\ / $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1 --error 1
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
--error 1 --error 1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1 --exec echo "while \$i;" | $MYSQL_TEST 2>&1
--error 1 --error 1
...@@ -925,12 +1130,6 @@ select "a" as col1, "c" as col2; ...@@ -925,12 +1130,6 @@ select "a" as col1, "c" as col2;
--error 1 --error 1
--exec echo "connect (con2,);" | $MYSQL_TEST 2>&1 --exec echo "connect (con2,);" | $MYSQL_TEST 2>&1
--error 1 --error 1
--exec echo "connect (con2,localhost);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2, localhost, root);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2, localhost, root,);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1 --exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1
--error 1 --error 1
--exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1 --exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1
...@@ -938,13 +1137,15 @@ select "a" as col1, "c" as col2; ...@@ -938,13 +1137,15 @@ select "a" as col1, "c" as col2;
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1 --exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect # Repeat connect/disconnect
--system echo "let \$i=100;" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
--system echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=100;
--system echo "{" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql while ($i)
--system echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql {
--system echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql connect (test_con1,localhost,root,,);
--system echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql disconnect test_con1;
--system echo "}" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql dec $i;
}
EOF
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections # Repeat connect/disconnect, exceed max number of connections
...@@ -1149,8 +1350,6 @@ query sleep; ...@@ -1149,8 +1350,6 @@ query sleep;
--error 1065 --error 1065
query ; query ;
--echo End of 5.0 tests
# test for replace_regex # test for replace_regex
--replace_regex /at/b/ --replace_regex /at/b/
select "at" as col1, "c" as col2; select "at" as col1, "c" as col2;
...@@ -1289,4 +1488,3 @@ EOF ...@@ -1289,4 +1488,3 @@ EOF
--echo End of tests --echo End of tests
--echo End of 5.1 tests
...@@ -354,14 +354,14 @@ create table t1 (a int, b int); ...@@ -354,14 +354,14 @@ create table t1 (a int, b int);
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2); insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
prepare stmt from prepare stmt from
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?"; "explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
set @v=5; set @v=5;
execute stmt using @v;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - --replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
set @v=0;
execute stmt using @v; execute stmt using @v;
set @v=0;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - --replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v;
set @v=5; set @v=5;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v; execute stmt using @v;
drop table t1; drop table t1;
deallocate prepare stmt; deallocate prepare stmt;
......
...@@ -316,8 +316,8 @@ prepare stmt4 from ' show table status from test like ''t9%'' '; ...@@ -316,8 +316,8 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
--replace_column 8 # 12 # 13 # 14 # --replace_column 8 # 12 # 13 # 14 #
# Bug#4288 # Bug#4288
execute stmt4; execute stmt4;
--replace_column 2 #
prepare stmt4 from ' show status like ''Threads_running'' '; prepare stmt4 from ' show status like ''Threads_running'' ';
--replace_column 2 #
execute stmt4; execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' '; prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4; execute stmt4;
......
...@@ -35,7 +35,7 @@ use mysqltest; ...@@ -35,7 +35,7 @@ use mysqltest;
--source include/ps_create.inc --source include/ps_create.inc
--source include/ps_renew.inc --source include/ps_renew.inc
--enable_query_log --enable_query_log
eval use $DB; use test;
grant usage on mysqltest.* to second_user@localhost grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ; identified by 'looser' ;
grant select on mysqltest.t9 to second_user@localhost grant select on mysqltest.t9 to second_user@localhost
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment