mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#2789 "Instance Manager: test using mysql-test-run testing framework"
1) Add support to testing Instance Manager in daemon mode; 2) Don't run Instance Manager tests when running with --ps-protocol option;
This commit is contained in:
@ -61,22 +61,6 @@ sub collect_test_cases ($) {
|
|||||||
$elem= $tname;
|
$elem= $tname;
|
||||||
$tname =~ s/\.imtest$//;
|
$tname =~ s/\.imtest$//;
|
||||||
$component_id= 'im';
|
$component_id= 'im';
|
||||||
|
|
||||||
if ( $::glob_use_embedded_server )
|
|
||||||
{
|
|
||||||
mtr_report(
|
|
||||||
"Instance Manager's tests are not available in embedded mode." .
|
|
||||||
"Test case '$tname' is skipped.");
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
unless ( $::exe_im )
|
|
||||||
{
|
|
||||||
mtr_report(
|
|
||||||
"Instance Manager executable is unavailable. " .
|
|
||||||
"Test case '$tname' is skipped.");
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If target component is known, check that the specified test case
|
# If target component is known, check that the specified test case
|
||||||
@ -115,7 +99,7 @@ sub collect_test_cases ($) {
|
|||||||
$component_id= 'im';
|
$component_id= 'im';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{},
|
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{},
|
||||||
$component_id);
|
$component_id);
|
||||||
}
|
}
|
||||||
@ -403,6 +387,34 @@ sub collect_one_test_case($$$$$$$) {
|
|||||||
$tinfo->{'comment'}= mtr_fromfile($disabled_file);
|
$tinfo->{'comment'}= mtr_fromfile($disabled_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $component_id eq 'im' )
|
||||||
|
{
|
||||||
|
if ( $::glob_use_embedded_server )
|
||||||
|
{
|
||||||
|
$tinfo->{'skip'}= 1;
|
||||||
|
|
||||||
|
mtr_report(
|
||||||
|
"Instance Manager tests are not available in embedded mode. " .
|
||||||
|
"Test case '$tname' is skipped.");
|
||||||
|
}
|
||||||
|
elsif ( $::opt_ps_protocol )
|
||||||
|
{
|
||||||
|
$tinfo->{'skip'}= 1;
|
||||||
|
|
||||||
|
mtr_report(
|
||||||
|
"Instance Manager tests are not run with --ps-protocol. " .
|
||||||
|
"Test case '$tname' is skipped.");
|
||||||
|
}
|
||||||
|
elsif ( !$::exe_im )
|
||||||
|
{
|
||||||
|
$tinfo->{'skip'}= 1;
|
||||||
|
|
||||||
|
mtr_report(
|
||||||
|
"Instance Manager executable is unavailable." .
|
||||||
|
"Test case '$tname' is skipped.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# We can't restart a running server that may be in use
|
# We can't restart a running server that may be in use
|
||||||
|
|
||||||
if ( $::glob_use_running_server and
|
if ( $::glob_use_running_server and
|
||||||
|
@ -848,14 +848,16 @@ sub sleep_until_file_created ($$$) {
|
|||||||
sub mtr_kill_processes ($) {
|
sub mtr_kill_processes ($) {
|
||||||
my $pids = shift;
|
my $pids = shift;
|
||||||
|
|
||||||
foreach my $sig (15,9)
|
foreach my $sig (15, 9)
|
||||||
{
|
{
|
||||||
my $retries= 20; # FIXME 20 seconds, this is silly!
|
my $retries= 10;
|
||||||
kill($sig, @{$pids});
|
while (1)
|
||||||
while ( $retries-- and kill(0, @{$pids}) )
|
|
||||||
{
|
{
|
||||||
mtr_debug("Sleep 1 second waiting for processes to die");
|
kill($sig, @{$pids});
|
||||||
sleep(1) # Wait one second
|
last unless kill (0, @{$pids}) and $retries--;
|
||||||
|
|
||||||
|
mtr_debug("Sleep 2 second waiting for processes to die");
|
||||||
|
sleep(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1017,10 +1017,14 @@ sub environment_setup () {
|
|||||||
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
|
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
|
||||||
$ENV{'MYSQL_TCP_PORT'}= 3306;
|
$ENV{'MYSQL_TCP_PORT'}= 3306;
|
||||||
|
|
||||||
|
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
|
||||||
|
|
||||||
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
|
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
|
||||||
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
|
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
|
||||||
|
$ENV{'IM_MYSQLD1_PATH_PID'}=$instance_manager->{instances}->[0]->{path_pid};
|
||||||
$ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
|
$ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
|
||||||
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
|
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
|
||||||
|
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
|
||||||
|
|
||||||
if ( $glob_cygwin_perl )
|
if ( $glob_cygwin_perl )
|
||||||
{
|
{
|
||||||
@ -2317,6 +2321,12 @@ sub im_stop($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Re-read pid from the file, since during tests Instance Manager could have
|
||||||
|
# been restarted, so its pid could have been changed.
|
||||||
|
|
||||||
|
$instance_manager->{'pid'} =
|
||||||
|
mtr_get_pid_from_file($instance_manager->{'path_pid'});
|
||||||
|
|
||||||
# Inspired from mtr_stop_mysqld_servers().
|
# Inspired from mtr_stop_mysqld_servers().
|
||||||
|
|
||||||
start_reap_all();
|
start_reap_all();
|
||||||
|
Reference in New Issue
Block a user