Commit a0081378 authored by unknown's avatar unknown

Improve restart logic all code to detect restart is now in the functions

'run_testcase_need_master/slave_restart'
Remove the faulty qw
Only look for mysql_fix_privilege_tables if not windows


mysql-test/lib/mtr_cases.pl:
  Move all code to determine when to restart into 'run_testcase_need_master/slave_restart' 
  Add possibility to wite --force-restart in -master.opt file, this will force a restart and
  since master is not started with any special options there is no need to restart
  again afterwards.
mysql-test/mysql-test-run.pl:
  Remove the qw surrounding ENV{'LD_LIBRARY_PATH'}
  Only look for the sh script mysql_fix_privileges when not on windows
  Remove warnings about using unitialized variables
  Improve the restart logic, eall code to determine when to restart is
  now in run_testcase_need_master_restart and run_testcase_need_slave_restart
mysql-test/t/bdb-alter-table-2-master.opt:
  Use --force-restart
mysql-test/t/not_embedded_server-master.opt:
  Use --force-restart
parent 3caef95e
...@@ -152,9 +152,7 @@ sub collect_test_cases ($) { ...@@ -152,9 +152,7 @@ sub collect_test_cases ($) {
closedir TESTDIR; closedir TESTDIR;
} }
# To speed things up, we sort first in if the test require a restart # Reorder the test cases in an order that wil make them faster to run
# or not, second in alphanumeric order.
if ( $::opt_reorder ) if ( $::opt_reorder )
{ {
...@@ -207,7 +205,6 @@ sub collect_test_cases ($) { ...@@ -207,7 +205,6 @@ sub collect_test_cases ($) {
# Append the criteria for sorting, in order of importance. # Append the criteria for sorting, in order of importance.
# #
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
push(@criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
# Group test with equal options together. # Group test with equal options together.
# Ending with "~" makes empty sort later than filled # Ending with "~" makes empty sort later than filled
push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~");
...@@ -313,18 +310,18 @@ sub collect_one_test_case($$$$$$$) { ...@@ -313,18 +310,18 @@ sub collect_one_test_case($$$$$$$) {
{ {
# This is an ndb test or all tests should be run with ndb cluster started # This is an ndb test or all tests should be run with ndb cluster started
$tinfo->{'ndb_test'}= 1; $tinfo->{'ndb_test'}= 1;
if ( $::opt_skip_ndbcluster ) if ( ! $::opt_ndbcluster_supported )
{ {
# All ndb test's should be skipped # Ndb is not supported, skip them
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster test(--skip-ndbcluster)"; $tinfo->{'comment'}= "No ndbcluster support";
return; return;
} }
if ( ! $::opt_ndbcluster_supported ) elsif ( $::opt_skip_ndbcluster )
{ {
# Ndb is not supported, skip them # All ndb test's should be skipped
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster support"; $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)";
return; return;
} }
} }
...@@ -357,52 +354,58 @@ sub collect_one_test_case($$$$$$$) { ...@@ -357,52 +354,58 @@ sub collect_one_test_case($$$$$$$) {
if ( -f $master_opt_file ) if ( -f $master_opt_file )
{ {
$tinfo->{'master_restart'}= 1; # We think so for now
MASTER_OPT: my $master_opt= mtr_get_opts_from_file($master_opt_file);
{
my $master_opt= mtr_get_opts_from_file($master_opt_file);
foreach my $opt ( @$master_opt ) foreach my $opt ( @$master_opt )
{ {
my $value; my $value;
# This is a dirty hack from old mysql-test-run, we use the opt # The opt file is used both to send special options to the mysqld
# file to flag other things as well, it is not a opt list at # as well as pass special test case specific options to this
# all # script
$value= mtr_match_prefix($opt, "--timezone="); $value= mtr_match_prefix($opt, "--timezone=");
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'timezone'}= $value; $tinfo->{'timezone'}= $value;
last MASTER_OPT; next;
} }
$value= mtr_match_prefix($opt, "--result-file="); $value= mtr_match_prefix($opt, "--result-file=");
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'result_file'}= "r/$value.result"; # Specifies the file mysqltest should compare
$tinfo->{'master_restart'}= 0; # output against
last MASTER_OPT; $tinfo->{'result_file'}= "r/$value.result";
} next;
}
# If we set default time zone, remove the one we have # If we set default time zone, remove the one we have
$value= mtr_match_prefix($opt, "--default-time-zone="); $value= mtr_match_prefix($opt, "--default-time-zone=");
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'master_opt'}= []; $tinfo->{'timezone'}= "";
} # Fallthrough, add this option
}
# The --restart option forces a restart even if no special
# option is set. If the options are the same as next testcase
# there is no need to restart after the testcase
# has completed
if ( $opt eq "--force-restart" )
{
$tinfo->{'force_restart'}= 1;
next;
} }
# Ok, this was a real option list, add it # Ok, this was a real option, add it
push(@{$tinfo->{'master_opt'}}, @$master_opt); push(@{$tinfo->{'master_opt'}}, $opt);
} }
} }
if ( -f $slave_opt_file ) if ( -f $slave_opt_file )
{ {
$tinfo->{'slave_restart'}= 1;
my $slave_opt= mtr_get_opts_from_file($slave_opt_file); my $slave_opt= mtr_get_opts_from_file($slave_opt_file);
foreach my $opt ( @$slave_opt ) foreach my $opt ( @$slave_opt )
...@@ -417,7 +420,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -417,7 +420,6 @@ sub collect_one_test_case($$$$$$$) {
if ( -f $slave_mi_file ) if ( -f $slave_mi_file )
{ {
$tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file); $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file);
$tinfo->{'slave_restart'}= 1;
} }
if ( -f $master_sh ) if ( -f $master_sh )
...@@ -431,7 +433,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -431,7 +433,6 @@ sub collect_one_test_case($$$$$$$) {
else else
{ {
$tinfo->{'master_sh'}= $master_sh; $tinfo->{'master_sh'}= $master_sh;
$tinfo->{'master_restart'}= 1;
} }
} }
...@@ -446,7 +447,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -446,7 +447,6 @@ sub collect_one_test_case($$$$$$$) {
else else
{ {
$tinfo->{'slave_sh'}= $slave_sh; $tinfo->{'slave_sh'}= $slave_sh;
$tinfo->{'slave_restart'}= 1;
} }
} }
...@@ -551,17 +551,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -551,17 +551,6 @@ sub collect_one_test_case($$$$$$$) {
return; return;
} }
} }
# We can't restart a running server that may be in use
if ( $::glob_use_running_server and
( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Can't restart a running server";
return;
}
} }
......
This diff is collapsed.
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