Commit e010add5 authored by wax@mysql.com's avatar wax@mysql.com

Merge

parents 795736fa de85fdb7
...@@ -252,7 +252,7 @@ if (defined $opt_changelog) ...@@ -252,7 +252,7 @@ if (defined $opt_changelog)
$msg= "Adding $target_dir/ChangeLog"; $msg= "Adding $target_dir/ChangeLog";
$msg.= " (down to revision $opt_changelog)" if $opt_changelog ne ""; $msg.= " (down to revision $opt_changelog)" if $opt_changelog ne "";
&logger($msg); &logger($msg);
$command= "bk changes -mv"; $command= "bk changes -v";
$command.= " -r" if ($opt_changelog ne "" || $opt_revision); $command.= " -r" if ($opt_changelog ne "" || $opt_revision);
$command.= $opt_changelog if $opt_changelog ne ""; $command.= $opt_changelog if $opt_changelog ne "";
$command.= ".." if ($opt_changelog ne "" && !$opt_revision); $command.= ".." if ($opt_changelog ne "" && !$opt_revision);
......
...@@ -51,8 +51,8 @@ BSC32=bscmake.exe ...@@ -51,8 +51,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
!ELSEIF "$(CFG)" == "mysqldump - Win32 Debug" !ELSEIF "$(CFG)" == "mysqldump - Win32 Debug"
...@@ -76,8 +76,8 @@ BSC32=bscmake.exe ...@@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ELSEIF "$(CFG)" == "mysqldump - Win32 classic" !ELSEIF "$(CFG)" == "mysqldump - Win32 classic"
...@@ -103,8 +103,8 @@ BSC32=bscmake.exe ...@@ -103,8 +103,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\" # ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\"
!ENDIF !ENDIF
......
...@@ -67,8 +67,8 @@ LINK32=link.exe ...@@ -67,8 +67,8 @@ LINK32=link.exe
# PROP Output_Dir ".\classic" # PROP Output_Dir ".\classic"
# PROP Intermediate_Dir ".\classic" # PROP Intermediate_Dir ".\classic"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX # ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX # ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32 # ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32 # ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG" # ADD BASE RSC /l 1033 /d "NDEBUG"
...@@ -77,8 +77,8 @@ BSC32=bscmake.exe ...@@ -77,8 +77,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
!ELSEIF "$(CFG)" == "mysqltest - Win32 Release" !ELSEIF "$(CFG)" == "mysqltest - Win32 Release"
...@@ -92,8 +92,8 @@ LINK32=link.exe ...@@ -92,8 +92,8 @@ LINK32=link.exe
# PROP Output_Dir ".\release" # PROP Output_Dir ".\release"
# PROP Intermediate_Dir ".\release" # PROP Intermediate_Dir ".\release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX # ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX # ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32 # ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32 # ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG" # ADD BASE RSC /l 1033 /d "NDEBUG"
...@@ -102,8 +102,8 @@ BSC32=bscmake.exe ...@@ -102,8 +102,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
!ENDIF !ENDIF
......
...@@ -76,8 +76,8 @@ BSC32=bscmake.exe ...@@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
!ENDIF !ENDIF
......
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
# 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 strict; use strict;
use POSIX ":sys_wait_h"; use POSIX ":sys_wait_h";
sub mtr_run ($$$$$$); sub mtr_run ($$$$$$);
sub mtr_spawn ($$$$$$); sub mtr_spawn ($$$$$$);
sub mtr_stop_servers ($); sub mtr_stop_mysqld_servers ($$);
sub mtr_kill_leftovers (); sub mtr_kill_leftovers ();
# static in C # static in C
...@@ -77,13 +78,21 @@ sub spawn_impl ($$$$$$$) { ...@@ -77,13 +78,21 @@ sub spawn_impl ($$$$$$$) {
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print STDERR "-" x 78, "\n"; print STDERR "\n";
print STDERR "STDIN $input\n" if $input; print STDERR "#### ", "-" x 78, "\n";
print STDERR "STDOUT $output\n" if $output; print STDERR "#### ", "STDIN $input\n" if $input;
print STDERR "STDERR $error\n" if $error; print STDERR "#### ", "STDOUT $output\n" if $output;
print STDERR "DAEMON\n" if !$join; print STDERR "#### ", "STDERR $error\n" if $error;
print STDERR "EXEC $path ", join(" ",@$arg_list_t), "\n"; if ( $join )
print STDERR "-" x 78, "\n"; {
print STDERR "#### ", "run";
}
else
{
print STDERR "#### ", "spawn";
}
print STDERR "$path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "-" x 78, "\n";
} }
my $pid= fork(); my $pid= fork();
...@@ -101,11 +110,11 @@ sub spawn_impl ($$$$$$$) { ...@@ -101,11 +110,11 @@ sub spawn_impl ($$$$$$$) {
my $dumped_core= $? & 128; my $dumped_core= $? & 128;
if ( $signal_num ) if ( $signal_num )
{ {
die("spawn got signal $signal_num"); mtr_error("spawn got signal $signal_num");
} }
if ( $dumped_core ) if ( $dumped_core )
{ {
die("spawn dumped core"); mtr_error("spawn dumped core");
} }
return $exit_value; return $exit_value;
} }
...@@ -127,22 +136,34 @@ sub spawn_impl ($$$$$$$) { ...@@ -127,22 +136,34 @@ sub spawn_impl ($$$$$$$) {
if ( $output ) if ( $output )
{ {
open(STDOUT,">",$output) or die "Can't redirect STDOUT to \"$output\": $!"; if ( ! open(STDOUT,">",$output) )
{
mtr_error("can't redirect STDOUT to \"$output\": $!");
}
} }
if ( $error ) if ( $error )
{ {
if ( $output eq $error ) if ( $output eq $error )
{ {
open(STDERR,">&STDOUT") or die "Can't dup STDOUT: $!"; if ( ! open(STDERR,">&STDOUT") )
{
mtr_error("can't dup STDOUT: $!");
}
} }
else else
{ {
open(STDERR,">",$error) or die "Can't redirect STDERR to \"$output\": $!"; if ( ! open(STDERR,">",$error) )
{
mtr_error("can't redirect STDERR to \"$output\": $!");
}
} }
} }
if ( $input ) if ( $input )
{ {
open(STDIN,"<",$input) or die "Can't redirect STDIN to \"$input\": $!"; if ( ! open(STDIN,"<",$input) )
{
mtr_error("can't redirect STDIN to \"$input\": $!");
}
} }
exec($path,@$arg_list_t); exec($path,@$arg_list_t);
} }
...@@ -163,27 +184,25 @@ sub mtr_kill_leftovers () { ...@@ -163,27 +184,25 @@ sub mtr_kill_leftovers () {
for ( my $idx; $idx < 2; $idx++ ) for ( my $idx; $idx < 2; $idx++ )
{ {
# if ( $::master->[$idx]->{'pid'} ) push(@args,{
# { pid => 0, # We don't know the PID
push(@args, pidfile => $::master->[$idx]->{'path_mypid'},
$::master->[$idx]->{'path_mypid'}, sockfile => $::master->[$idx]->{'path_mysock'},
$::master->[$idx]->{'path_mysock'}, port => $::master->[$idx]->{'path_myport'},
); });
# }
} }
for ( my $idx; $idx < 3; $idx++ ) for ( my $idx; $idx < 3; $idx++ )
{ {
# if ( $::slave->[$idx]->{'pid'} ) push(@args,{
# { pid => 0, # We don't know the PID
push(@args, pidfile => $::slave->[$idx]->{'path_mypid'},
$::slave->[$idx]->{'path_mypid'}, sockfile => $::slave->[$idx]->{'path_mysock'},
$::slave->[$idx]->{'path_mysock'}, port => $::slave->[$idx]->{'path_myport'},
); });
# }
} }
mtr_stop_servers(\@args); mtr_stop_mysqld_servers(\@args, 1);
# We scan the "var/run/" directory for other process id's to kill # We scan the "var/run/" directory for other process id's to kill
my $rundir= "$::glob_mysql_test_dir/var/run"; # FIXME $path_run_dir or something my $rundir= "$::glob_mysql_test_dir/var/run"; # FIXME $path_run_dir or something
...@@ -211,6 +230,16 @@ sub mtr_kill_leftovers () { ...@@ -211,6 +230,16 @@ sub mtr_kill_leftovers () {
} }
closedir(RUNDIR); closedir(RUNDIR);
start_reap_all();
if ( $::glob_cygwin_perl )
{
# We have no (easy) way of knowing the Cygwin controlling
# process, in the PID file we only have the Windows process id.
system("kill -f " . join(" ",@pids)); # Hope for the best....
}
else
{
my $retries= 10; # 10 seconds my $retries= 10; # 10 seconds
do do
{ {
...@@ -221,7 +250,9 @@ sub mtr_kill_leftovers () { ...@@ -221,7 +250,9 @@ sub mtr_kill_leftovers () {
{ {
mtr_error("can't kill processes " . join(" ", @pids)); mtr_error("can't kill processes " . join(" ", @pids));
} }
}
stop_reap_all();
} }
} }
...@@ -237,185 +268,200 @@ sub mtr_kill_leftovers () { ...@@ -237,185 +268,200 @@ sub mtr_kill_leftovers () {
# This is not perfect, there could still be other server processes # This is not perfect, there could still be other server processes
# left. # left.
sub mtr_stop_servers ($) { # Force flag is to be set only for killing mysqld servers this script
my $spec= shift; # didn't create in this run, i.e. initial cleanup before we start working.
# If force flag is set, we try to kill all with mysqladmin, and
# First try nice normal shutdown using 'mysqladmin' # give up if we have no PIDs.
{ # FIXME On some operating systems, $srv->{'pid'} and $srv->{'pidfile'}
my @args= @$spec; # will not be the same PID. We need to try to kill both I think.
while ( @args )
{
my $pidfile= shift @args; # FIXME not used here....
my $sockfile= shift @args;
if ( -f $sockfile ) sub mtr_stop_mysqld_servers ($$) {
{ my $spec= shift;
my $force= shift;
# FIXME wrong log..... # ----------------------------------------------------------------------
# FIXME, stderr..... # If the process was not started from this file, we got no PID,
# Shutdown time must be high as slave may be in reconnect # we try to find it in the PID file.
my $opts= # ----------------------------------------------------------------------
[
"--no-defaults",
"-uroot",
"--socket=$sockfile",
"--connect_timeout=5",
"--shutdown_timeout=70",
"shutdown",
];
# We don't wait for termination of mysqladmin
mtr_spawn($::exe_mysqladmin, $opts,
"", $::path_manager_log, $::path_manager_log, "");
}
}
}
# Wait for them all to remove their socket file my $any_pid= 0; # If we have any PIDs
SOCKREMOVED: foreach my $srv ( @$spec )
for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
{ {
my $sockfiles_left= 0; if ( ! $srv->{'pid'} and -f $srv->{'pidfile'} )
my @args= @$spec;
while ( @args )
{ {
my $pidfile= shift @args; $srv->{'pid'}= mtr_get_pid_from_file($srv->{'pidfile'});
my $sockfile= shift @args;
if ( -f $sockfile or -f $pidfile )
{
$sockfiles_left++; # Could be that pidfile is left
}
} }
if ( ! $sockfiles_left ) if ( $srv->{'pid'} )
{ {
last SOCKREMOVED; $any_pid= 1;
} }
if ( $loop > 1 )
{
sleep(1); # One second
} }
# If the processes where started from this script, and we know
# no PIDs, then we don't have to do anything.
if ( ! $any_pid and ! $force )
{
# cluck "This is how we got here!";
return;
} }
# We may have killed all that left a socket, but we are not sure we got # ----------------------------------------------------------------------
# them all killed. We now check the PID file, if any # First try nice normal shutdown using 'mysqladmin'
# ----------------------------------------------------------------------
# Try nice kill with SIG_TERM start_reap_all(); # Don't require waitpid() of children
foreach my $srv ( @$spec )
{ {
my @args= @$spec; if ( -e $srv->{'sockfile'} or $srv->{'port'} )
while ( @args )
{ {
my $pidfile= shift @args; # FIXME wrong log.....
my $sockfile= shift @args; # FIXME, stderr.....
if (-f $pidfile) # Shutdown time must be high as slave may be in reconnect
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "-uroot");
if ( -e $srv->{'sockfile'} )
{ {
my $pid= mtr_get_pid_from_file($pidfile); mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
mtr_warning("process $pid not cooperating with mysqladmin, " .
"will send TERM signal to process");
kill(15,$pid); # SIG_TERM
} }
if ( $srv->{'port'} )
{
mtr_add_arg($args, "--port=%s", $srv->{'port'});
}
mtr_add_arg($args, "--connect_timeout=5");
mtr_add_arg($args, "--shutdown_timeout=70");
mtr_add_arg($args, "shutdown");
# We don't wait for termination of mysqladmin
mtr_spawn($::exe_mysqladmin, $args,
"", $::path_manager_log, $::path_manager_log, "");
} }
} }
# Wait for them all to die # Wait for them all to remove their pid and socket file
PIDSOCKFILEREMOVED:
for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--) for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
{ {
my $pidfiles_left= 0; my $pidsockfiles_left= 0;
my @args= @$spec; foreach my $srv ( @$spec )
while ( @args )
{ {
my $pidfile= shift @args; if ( -e $srv->{'sockfile'} or -f $srv->{'pidfile'} )
my $sockfile= shift @args;
if ( -f $pidfile )
{ {
$pidfiles_left++; $pidsockfiles_left++; # Could be that pidfile is left
} }
} }
if ( ! $pidfiles_left ) if ( ! $pidsockfiles_left )
{ {
return; last PIDSOCKFILEREMOVED;
} }
if ( $loop > 1 ) mtr_debug("Sleep for 1 second waiting for pid and socket file removal");
{
sleep(1); # One second sleep(1); # One second
} }
# ----------------------------------------------------------------------
# If no known PIDs, we have nothing more to try
# ----------------------------------------------------------------------
if ( ! $any_pid )
{
stop_reap_all();
return;
} }
# Try hard kill with SIG_KILL # ----------------------------------------------------------------------
# We may have killed all that left a socket, but we are not sure we got
# them all killed. If we suspect it lives, try nice kill with SIG_TERM.
# Note that for true Win32 processes, kill(0,$pid) will not return 1.
# ----------------------------------------------------------------------
SIGNAL:
foreach my $sig (15,9)
{ {
my @args= @$spec; my $process_left= 0;
while ( @args ) foreach my $srv ( @$spec )
{ {
my $pidfile= shift @args; if ( $srv->{'pid'} and
my $sockfile= shift @args; ( -f $srv->{'pidfile'} or kill(0,$srv->{'pid'}) ) )
if (-f $pidfile)
{ {
my $pid= mtr_get_pid_from_file($pidfile); $process_left++;
mtr_warning("$pid did not die from TERM signal, ", mtr_warning("process $srv->{'pid'} not cooperating, " .
"will send KILL signal to process"); "will send signal $sig to process");
kill(9,$pid); kill($sig,$srv->{'pid'}); # SIG_TERM
}
if ( ! $process_left )
{
last SIGNAL;
} }
} }
mtr_debug("Sleep for 5 seconds waiting for processes to die");
sleep(5); # We wait longer than usual
} }
# We check with Perl "kill 0" if process still exists # ----------------------------------------------------------------------
# Now, we check if all we can find using kill(0,$pid) are dead,
# and just assume the rest are. We cleanup socket and PID files.
# ----------------------------------------------------------------------
PIDFILES:
for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
{ {
my $not_terminated= 0; my $errors= 0;
my @args= @$spec; foreach my $srv ( @$spec )
while ( @args )
{ {
my $pidfile= shift @args; if ( $srv->{'pid'} )
my $sockfile= shift @args;
if (-f $pidfile)
{ {
my $pid= mtr_get_pid_from_file($pidfile); if ( kill(0,$srv->{'pid'}) )
if ( ! kill(0,$pid) )
{ {
$not_terminated++; # FIXME In Cygwin there seem to be some fast reuse
mtr_warning("could't kill $pid"); # of PIDs, so dying may not be the right thing to do.
$errors++;
mtr_warning("can't kill process $srv->{'pid'}");
} }
} else
}
if ( ! $not_terminated )
{
last PIDFILES;
}
if ( $loop > 1 )
{ {
sleep(1); # One second # We managed to kill it at last
} # FIXME In Cygwin, we will get here even if the process lives.
}
# Not needed as we know the process is dead, but to be safe
# we unlink and check success in two steps. We first unlink
# without checking the error code, and then check if the
# file still exists.
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{ {
my $pidfiles_left= 0; unlink($file);
my @args= @$spec; if ( -e $file )
while ( @args )
{
my $pidfile= shift @args;
my $sockfile= shift @args;
if ( -f $pidfile )
{
if ( ! unlink($pidfile) )
{ {
$pidfiles_left++; $errors++;
mtr_warning("could't delete $pidfile"); mtr_warning("couldn't delete $file");
}
} }
} }
} }
if ( $pidfiles_left ) }
if ( $errors )
{ {
mtr_error("one or more pid files could not be deleted"); # We are in trouble, just die....
mtr_error("we could not kill or clean up all processes");
} }
} }
stop_reap_all();
# FIXME We just assume they are all dead, we don't know.... # FIXME We just assume they are all dead, we don't know....
} }
sub start_reap_all {
$SIG{CHLD}= 'IGNORE'; # FIXME is this enough?
}
sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT';
}
1; 1;
...@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($); ...@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($);
sub mtr_show_failed_diff ($); sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
sub mtr_print_line (); sub mtr_print_line ();
sub mtr_print_thick_line ();
sub mtr_print_header (); sub mtr_print_header ();
sub mtr_report (@); sub mtr_report (@);
sub mtr_warning (@); sub mtr_warning (@);
...@@ -214,6 +215,10 @@ sub mtr_print_line () { ...@@ -214,6 +215,10 @@ sub mtr_print_line () {
print '-' x 55, "\n"; print '-' x 55, "\n";
} }
sub mtr_print_thick_line () {
print '=' x 55, "\n";
}
sub mtr_print_header () { sub mtr_print_header () {
print "\n"; print "\n";
if ( $::opt_timer ) if ( $::opt_timer )
...@@ -250,7 +255,7 @@ sub mtr_error (@) { ...@@ -250,7 +255,7 @@ sub mtr_error (@) {
sub mtr_debug (@) { sub mtr_debug (@) {
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print "mysql-test-run: DEBUG: ",join(" ", @_),"\n"; print STDERR "####: ",join(" ", @_),"\n";
} }
} }
......
...@@ -327,7 +327,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input, ...@@ -327,7 +327,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
int spawn(char *path, arg_list_t *al, int join, char *input, int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error, HANDLE *pid) char *output, char *error, HANDLE *pid)
{ {
intptr_t result; bool result;
int i; int i;
STARTUPINFO startup_info; STARTUPINFO startup_info;
PROCESS_INFORMATION process_information; PROCESS_INFORMATION process_information;
...@@ -665,7 +665,11 @@ void del_tree(char *dir) ...@@ -665,7 +665,11 @@ void del_tree(char *dir)
rmdir(dir); rmdir(dir);
#else #else
struct _finddata_t parent; struct _finddata_t parent;
#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle; intptr_t handle;
#else
long handle;
#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN]; char temp[FN_REFLEN];
char mask[FN_REFLEN]; char mask[FN_REFLEN];
...@@ -728,7 +732,11 @@ int removef(const char *format, ...) ...@@ -728,7 +732,11 @@ int removef(const char *format, ...)
va_list ap; va_list ap;
char path[FN_REFLEN]; char path[FN_REFLEN];
struct _finddata_t parent; struct _finddata_t parent;
#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle; intptr_t handle;
#else
long handle;
#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN]; char temp[FN_REFLEN];
char *p; char *p;
......
...@@ -67,6 +67,11 @@ ...@@ -67,6 +67,11 @@
# is to use the Devel::Trace package found at # is to use the Devel::Trace package found at
# "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
...@@ -147,7 +152,9 @@ our @mysqld_src_dirs= ...@@ -147,7 +152,9 @@ our @mysqld_src_dirs=
# Misc global variables # Misc global variables
our $glob_win32= 0; 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;
...@@ -172,6 +179,9 @@ our $path_slave_load_tmpdir; # What is this?! ...@@ -172,6 +179,9 @@ our $path_slave_load_tmpdir; # What is this?!
our $path_my_basedir; our $path_my_basedir;
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_suite;
our $opt_netware; 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
...@@ -290,6 +300,7 @@ sub initial_setup (); ...@@ -290,6 +300,7 @@ sub initial_setup ();
sub command_line_setup (); sub command_line_setup ();
sub executable_setup (); sub executable_setup ();
sub kill_and_cleanup (); sub kill_and_cleanup ();
sub collect_test_cases ($);
sub sleep_until_file_created ($$); sub sleep_until_file_created ($$);
sub ndbcluster_start (); sub ndbcluster_start ();
sub ndbcluster_stop (); sub ndbcluster_stop ();
...@@ -306,6 +317,7 @@ sub stop_masters_slaves (); ...@@ -306,6 +317,7 @@ sub stop_masters_slaves ();
sub stop_masters (); sub stop_masters ();
sub stop_slaves (); sub stop_slaves ();
sub run_mysqltest ($$); sub run_mysqltest ($$);
sub usage ($);
###################################################################### ######################################################################
# #
...@@ -378,7 +390,9 @@ sub initial_setup () { ...@@ -378,7 +390,9 @@ sub initial_setup () {
$glob_scriptname= basename($0); $glob_scriptname= basename($0);
$glob_win32= ($^O eq "MSWin32"); $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
...@@ -399,6 +413,12 @@ sub initial_setup () { ...@@ -399,6 +413,12 @@ sub initial_setup () {
# 'basedir' is always parent of "mysql-test" directory # 'basedir' is always parent of "mysql-test" directory
$glob_mysql_test_dir= cwd(); $glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl )
{
# Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;
chomp($glob_mysql_test_dir);
}
$glob_basedir= dirname($glob_mysql_test_dir); $glob_basedir= dirname($glob_mysql_test_dir);
$glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable
...@@ -423,6 +443,7 @@ sub command_line_setup () { ...@@ -423,6 +443,7 @@ sub command_line_setup () {
# These are defaults for things that are set on the command line # These are defaults for things that are set on the command line
$opt_suite= "main"; # Special default suite
$opt_tmpdir= "$glob_mysql_test_dir/var/tmp"; $opt_tmpdir= "$glob_mysql_test_dir/var/tmp";
# FIXME maybe unneded? # FIXME maybe unneded?
$path_manager_log= "$glob_mysql_test_dir/var/log/manager.log"; $path_manager_log= "$glob_mysql_test_dir/var/log/manager.log";
...@@ -436,61 +457,85 @@ sub command_line_setup () { ...@@ -436,61 +457,85 @@ sub command_line_setup () {
my $opt_user; my $opt_user;
# Read the command line # Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
GetOptions( GetOptions(
'bench' => \$opt_bench, # Control what engine/variation to run
'big-test' => \$opt_big_test,
'client-gdb' => \$opt_client_gdb,
'compress' => \$opt_compress,
'ddd' => \$opt_ddd,
'debug' => \$opt_debug,
'do-test=s' => \$opt_do_test,
'embedded-server' => \$opt_embedded_server, 'embedded-server' => \$opt_embedded_server,
'ps-protocol' => \$opt_ps_protocol, 'ps-protocol' => \$opt_ps_protocol,
'extern' => \$opt_extern, 'bench' => \$opt_bench,
'fast' => \$opt_fast, 'small-bench' => \$opt_small_bench,
'no-manager' => \$opt_no_manager,
# Control what test suites or cases to run
'force' => \$opt_force, 'force' => \$opt_force,
'gcov' => \$opt_gcov, 'with-ndbcluster' => \$opt_with_ndbcluster,
'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl,
'skip-test=s' => \$opt_skip_test,
# Specify ports
'master_port=i' => \$opt_master_myport,
'slave_port=i' => \$opt_slave_myport,
'ndbcluster_port=i' => \$opt_ndbcluster_port,
# Test case authoring
'record' => \$opt_record,
# ???
'mysqld=s' => \$opt_extra_mysqld_opt,
# Run test on running server
'extern' => \$opt_extern,
'ndbconnectstring=s' => \$opt_ndbconnectstring,
# Debugging
'gdb' => \$opt_gdb, 'gdb' => \$opt_gdb,
'manual-gdb' => \$opt_manual_gdb,
'client-gdb' => \$opt_client_gdb,
'ddd' => \$opt_ddd,
'strace-client' => \$opt_strace_client,
'master-binary=s' => \$exe_master_mysqld,
'slave-binary=s' => \$exe_slave_mysqld,
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof, 'gprof' => \$opt_gprof,
'valgrind' => \$opt_valgrind,
'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
# Misc
'big-test' => \$opt_big_test,
'compress' => \$opt_compress,
'debug' => \$opt_debug,
'fast' => \$opt_fast,
'local' => \$opt_local, 'local' => \$opt_local,
'local-master' => \$opt_local_master, 'local-master' => \$opt_local_master,
'manual-gdb' => \$opt_manual_gdb,
'master-binary=s' => \$exe_master_mysqld,
'master_port=i' => \$opt_master_myport,
'mysqld=s' => \$opt_extra_mysqld_opt,
'ndbcluster_port=i' => \$opt_ndbcluster_port,
'ndbconnectstring=s' => \$opt_ndbconnectstring,
'netware' => \$opt_netware, 'netware' => \$opt_netware,
'no-manager' => \$opt_no_manager,
'old-master' => \$opt_old_master, 'old-master' => \$opt_old_master,
'ps-protocol' => \$opt_ps_protocol,
'record' => \$opt_record,
'script-debug' => \$opt_script_debug, 'script-debug' => \$opt_script_debug,
'skip-rpl' => \$opt_skip_rpl,
'skip-test=s' => \$opt_skip_test,
'slave-binary=s' => \$exe_slave_mysqld,
'slave_port=i' => \$opt_slave_myport,
'sleep=i' => \$opt_sleep, 'sleep=i' => \$opt_sleep,
'small-bench' => \$opt_small_bench,
'socket=s' => \$opt_socket, 'socket=s' => \$opt_socket,
'start-and-exit' => \$opt_start_and_exit, 'start-and-exit' => \$opt_start_and_exit,
'start-from=s' => \$opt_start_from, 'start-from=s' => \$opt_start_from,
'strace-client' => \$opt_strace_client,
'timer' => \$opt_timer, 'timer' => \$opt_timer,
'tmpdir=s' => \$opt_tmpdir, 'tmpdir=s' => \$opt_tmpdir,
'user-test=s' => \$opt_user_test, 'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user, 'user=s' => \$opt_user,
'valgrind' => \$opt_valgrind,
'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
'verbose' => \$opt_verbose, 'verbose' => \$opt_verbose,
'wait-timeout=i' => \$opt_wait_timeout, 'wait-timeout=i' => \$opt_wait_timeout,
'warnings|log-warnings' => \$opt_warnings, 'warnings|log-warnings' => \$opt_warnings,
'with-ndbcluster' => \$opt_with_ndbcluster,
'with-openssl' => \$opt_with_openssl, 'with-openssl' => \$opt_with_openssl,
'help|h' => \$opt_usage,
) or usage("Can't read options"); ) or usage("Can't read options");
if ( $opt_usage )
{
usage("");
}
# Put this into a hash, will be a C struct # Put this into a hash, will be a C struct
...@@ -811,8 +856,22 @@ sub handle_int_signal () { ...@@ -811,8 +856,22 @@ sub handle_int_signal () {
# #
############################################################################## ##############################################################################
sub collect_test_cases () { sub collect_test_cases ($) {
my $testdir= "$glob_mysql_test_dir/t"; my $suite= shift; # Test suite name
my $testdir;
my $resdir;
if ( $suite eq "main" )
{
$testdir= "$glob_mysql_test_dir/t";
$resdir= "$glob_mysql_test_dir/r";
}
else
{
$testdir= "$glob_mysql_test_dir/suite/$suite/t";
$resdir= "$glob_mysql_test_dir/suite/$suite/r";
}
my @tests; # Array of hash, will be array of C struct my @tests; # Array of hash, will be array of C struct
...@@ -839,7 +898,7 @@ sub collect_test_cases () { ...@@ -839,7 +898,7 @@ sub collect_test_cases () {
my $tinfo= {}; my $tinfo= {};
$tinfo->{'name'}= $tname; $tinfo->{'name'}= $tname;
$tinfo->{'result_file'}= "r/$tname.result"; $tinfo->{'result_file'}= "$resdir/$tname.result";
push(@tests, $tinfo); push(@tests, $tinfo);
if ( $opt_skip_test and defined mtr_match_prefix($tname,$opt_skip_test) ) if ( $opt_skip_test and defined mtr_match_prefix($tname,$opt_skip_test) )
...@@ -947,7 +1006,7 @@ sub collect_test_cases () { ...@@ -947,7 +1006,7 @@ sub collect_test_cases () {
if ( -f $master_sh ) if ( -f $master_sh )
{ {
if ( $glob_win32 ) if ( $glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
} }
...@@ -960,7 +1019,7 @@ sub collect_test_cases () { ...@@ -960,7 +1019,7 @@ sub collect_test_cases () {
if ( -f $slave_sh ) if ( -f $slave_sh )
{ {
if ( $glob_win32 ) if ( $glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
} }
...@@ -1071,6 +1130,7 @@ sub sleep_until_file_created ($$) { ...@@ -1071,6 +1130,7 @@ sub sleep_until_file_created ($$) {
{ {
return; return;
} }
mtr_debug("Sleep for 1 second waiting for creation of $pidfile");
sleep(1); sleep(1);
} }
...@@ -1180,13 +1240,22 @@ sub run_benchmarks ($) { ...@@ -1180,13 +1240,22 @@ sub run_benchmarks ($) {
# #
############################################################################## ##############################################################################
# FIXME how to specify several suites to run? Comma separated list?
sub run_tests () { sub run_tests () {
run_suite($opt_suite);
}
sub run_suite () {
my $suite= shift;
mtr_print_thick_line();
mtr_report("Finding Tests"); mtr_report("Finding Tests in $suite suite");
my $tests= collect_test_cases(); my $tests= collect_test_cases($suite);
mtr_report("Starting Tests"); mtr_report("Starting Tests in $suite suite");
mtr_print_header(); mtr_print_header();
...@@ -1343,6 +1412,8 @@ sub run_testcase ($) { ...@@ -1343,6 +1412,8 @@ sub run_testcase ($) {
# the preparation. # the preparation.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
mtr_report_test_name($tinfo);
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
do_before_start_master($tname,$tinfo->{'master_sh'}); do_before_start_master($tname,$tinfo->{'master_sh'});
...@@ -1350,8 +1421,6 @@ sub run_testcase ($) { ...@@ -1350,8 +1421,6 @@ sub run_testcase ($) {
# Start masters # Start masters
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
mtr_report_test_name($tinfo);
if ( ! $glob_use_running_server and ! $glob_use_embedded_server ) if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
{ {
# FIXME give the args to the embedded server?! # FIXME give the args to the embedded server?!
...@@ -1861,15 +1930,17 @@ sub stop_masters () { ...@@ -1861,15 +1930,17 @@ sub stop_masters () {
# the mysqld process from being killed # the mysqld process from being killed
if ( $master->[$idx]->{'pid'} ) if ( $master->[$idx]->{'pid'} )
{ {
push(@args, push(@args,{
$master->[$idx]->{'path_mypid'}, pid => $master->[$idx]->{'pid'},
$master->[$idx]->{'path_mysock'}, pidfile => $master->[$idx]->{'path_mypid'},
); sockfile => $master->[$idx]->{'path_mysock'},
$master->[$idx]->{'pid'}= 0; port => $master->[$idx]->{'path_myport'},
});
$master->[$idx]->{'pid'}= 0; # Assume we are done with it
} }
} }
mtr_stop_servers(\@args); mtr_stop_mysqld_servers(\@args, 0);
} }
sub stop_slaves () { sub stop_slaves () {
...@@ -1881,15 +1952,17 @@ sub stop_slaves () { ...@@ -1881,15 +1952,17 @@ sub stop_slaves () {
{ {
if ( $slave->[$idx]->{'pid'} ) if ( $slave->[$idx]->{'pid'} )
{ {
push(@args, push(@args,{
$slave->[$idx]->{'path_mypid'}, pid => $slave->[$idx]->{'pid'},
$slave->[$idx]->{'path_mysock'}, pidfile => $slave->[$idx]->{'path_mypid'},
); sockfile => $slave->[$idx]->{'path_mysock'},
$slave->[$idx]->{'pid'}= 0; port => $slave->[$idx]->{'path_myport'},
});
$slave->[$idx]->{'pid'}= 0; # Assume we are done with it
} }
} }
mtr_stop_servers(\@args); mtr_stop_mysqld_servers(\@args, 0);
} }
...@@ -2006,3 +2079,104 @@ sub run_mysqltest ($$) { ...@@ -2006,3 +2079,104 @@ sub run_mysqltest ($$) {
return mtr_run($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,""); return mtr_run($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,"");
} }
##############################################################################
#
# Usage
#
##############################################################################
sub usage ($)
{
print STDERR <<HERE;
mysql-test-run [ OPTIONS ] [ TESTCASE ]
FIXME when is TESTCASE arg used or not?!
Options to control what engine/variation to run
embedded-server Use the embedded server, i.e. no mysqld daemons
ps-protocol Use the binary protocol between client and server
bench Run the benchmark suite FIXME
small-bench FIXME
no-manager Use the istanse manager (currently disabled)
Options to control what test suites or cases to run
force Continue to run the suite after failure
with-ndbcluster Use cluster, and enable test cases that requres it
do-test=PREFIX Run test cases which name are prefixed with PREFIX
start-from=PREFIX Run test cases starting from test prefixed with PREFIX
suite=NAME Run the test suite named NAME. The default is "main"
skip-rpl Skip the replication test cases.
skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
Options that specify ports
master_port=PORT Specify the port number used by the first master
slave_port=PORT Specify the port number used by the first slave
ndbcluster_port=i Specify the port number used by cluster FIXME
Options for test case authoring
record TESTNAME (Re)genereate the result file for TESTNAME
Options that pass on options
mysqld=ARGS Specify additional arguments to "mysqld"
Options to run test on running server
extern Use running server for tests FIXME DANGEROUS
ndbconnectstring=STR Use running cluster, and connect using STR
user=USER The databse user name
Options for debugging the product
gdb FIXME
manual-gdb FIXME
client-gdb FIXME
ddd FIXME
strace-client FIXME
master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use
Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind FIXME
valgrind-all FIXME
valgrind-options=ARGS Extra options to give valgrind
Misc options
verbose Verbose output from this script
script-debug Debug this script itself
compress Use the compressed protocol between client and server
timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers
fast Don't try to cleanup from earlier runs
help Get this help text
Options not yet described, or that I want to look into more
big-test
debug
local
local-master
netware
old-master
sleep=SECONDS
socket=PATH
tmpdir=DIR
user-test=s
wait-timeout=SECONDS
warnings
log-warnings
with-openssl
HERE
exit(1);
}
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#include <sys/mode.h> #include <sys/mode.h>
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
#include <Shlwapi.h> #include <windows.h>
#include <shlwapi.h>
#include <direct.h> #include <direct.h>
#endif #endif
......
...@@ -235,7 +235,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length, ...@@ -235,7 +235,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
if (my_hash_insert(&hash->hash, (byte*) entry)) if (my_hash_insert(&hash->hash, (byte*) entry))
{ {
/* This can only happen if hash got out of memory */ /* This can only happen if hash got out of memory */
my_delete((char*) entry, MYF(0)); my_free((char*) entry, MYF(0));
error= 1; error= 1;
goto end; goto end;
} }
......
...@@ -31,12 +31,48 @@ ...@@ -31,12 +31,48 @@
#define HAVE_STRCASECMP #define HAVE_STRCASECMP
#define strcasecmp _strcmpi #define strcasecmp _strcmpi
#pragma warning(disable: 4503 4786) #pragma warning(disable: 4503 4786)
typedef unsigned __int64 Uint64;
typedef signed __int64 Int64;
#else #else
#undef NDB_WIN32 #undef NDB_WIN32
#define DIR_SEPARATOR "/" #define DIR_SEPARATOR "/"
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif #endif
#include <my_global.h> #include <my_global.h>
typedef signed char Int8;
typedef unsigned char Uint8;
typedef signed short Int16;
typedef unsigned short Uint16;
typedef signed int Int32;
typedef unsigned int Uint32;
typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#elif SIZEOF_CHARP == 4
typedef Uint32 UintPtr;
#elif SIZEOF_CHARP == 8
typedef Uint64 UintPtr;
#else
#error "Unknown size of (char *)"
#endif
#if ! (SIZEOF_CHAR == 1)
#error "Invalid define for Uint8"
#endif
#if ! (SIZEOF_INT == 4)
#error "Invalid define for Uint32"
#endif
#if ! (SIZEOF_LONG_LONG == 8)
#error "Invalid define for Uint64"
#endif
#include <my_alarm.h> #include <my_alarm.h>
#ifdef _AIX #ifdef _AIX
......
...@@ -21,40 +21,6 @@ ...@@ -21,40 +21,6 @@
#ifndef NDB_TYPES_H #ifndef NDB_TYPES_H
#define NDB_TYPES_H #define NDB_TYPES_H
typedef signed char Int8; #include "ndb_global.h"
typedef unsigned char Uint8;
typedef signed short Int16;
typedef unsigned short Uint16;
typedef signed int Int32;
typedef unsigned int Uint32;
typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#else
#include <ndb_global.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef Uint32 UintPtr;
#else
typedef uintptr_t UintPtr;
#endif
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef unsigned __int64 Uint64;
typedef signed __int64 Int64;
typedef UintPtr ssize_t;
#else
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif
#endif #endif
...@@ -322,13 +322,13 @@ do ...@@ -322,13 +322,13 @@ do
# but should work for the rest of the servers. # but should work for the rest of the servers.
# The only thing is ps x => redhat 5 gives warnings when using ps -x. # The only thing is ps x => redhat 5 gives warnings when using ps -x.
# kill -9 is used or the process won't react on the kill. # kill -9 is used or the process won't react on the kill.
numofproces=`ps xa | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"` numofproces=`ps xaww | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
I=1 I=1
while test "$I" -le "$numofproces" while test "$I" -le "$numofproces"
do do
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'` PROC=`ps xaww | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'`
for T in $PROC for T in $PROC
do do
......
...@@ -1039,7 +1039,7 @@ try_and_report("Automatic row id", "automatic_rowid", ...@@ -1039,7 +1039,7 @@ try_and_report("Automatic row id", "automatic_rowid",
["MATCH UNIQUE","match_unique", ["MATCH UNIQUE","match_unique",
"1 match unique (select a from crash_me)",1,0], "1 match unique (select a from crash_me)",1,0],
["MATCH","match","1 match (select a from crash_me)",1,0], ["MATCH","match","1 match (select a from crash_me)",1,0],
["MATCHES","matches","b matcjhes 'a*'",1,0], ["MATCHES","matches","b matches 'a*'",1,0],
["NOT BETWEEN","not_between","7 not between 4 and 6",1,0], ["NOT BETWEEN","not_between","7 not between 4 and 6",1,0],
["NOT EXISTS","not_exists", ["NOT EXISTS","not_exists",
"not exists (select * from crash_me where a = 2)",1,0], "not exists (select * from crash_me where a = 2)",1,0],
......
...@@ -882,7 +882,7 @@ static const char *default_options[]= ...@@ -882,7 +882,7 @@ static const char *default_options[]=
"connect-timeout", "local-infile", "disable-local-infile", "connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query", "replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name", "ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name",
"multi-results", "multi-queries", "secure-auth", "multi-results", "multi-statements", "multi-queries", "secure-auth",
NullS NullS
}; };
...@@ -1088,9 +1088,10 @@ void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1088,9 +1088,10 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->client_flag|= CLIENT_MULTI_RESULTS; options->client_flag|= CLIENT_MULTI_RESULTS;
break; break;
case 31: case 31:
case 32:
options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS; options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
break; break;
case 32: /* secure-auth */ case 33: /* secure-auth */
options->secure_auth= TRUE; options->secure_auth= TRUE;
break; break;
default: default:
......
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