Commit beb0eaa9 authored by Magnus Svensson's avatar Magnus Svensson

Bug#43983 Support force restart of all servers after test ended

 - Some tests need to modify the server(s) so much that a total restart of all servers are
   necessary after test. Make it possible for a test to signal it want mtr.pl to restart
   all servers.
parent 5a8243be
...@@ -57,3 +57,13 @@ BEGIN ...@@ -57,3 +57,13 @@ BEGIN
mysql.user; mysql.user;
END|| END||
--
-- Procedure used by test case used to force all
-- servers to restart after testcase and thus skipping
-- check test case after test
--
CREATE DEFINER=root@localhost PROCEDURE force_restart()
BEGIN
SELECT 1 INTO OUTFILE 'force_restart';
END||
...@@ -3067,6 +3067,26 @@ sub find_analyze_request ...@@ -3067,6 +3067,26 @@ sub find_analyze_request
} }
# The test can leave a file in var/tmp/ to signal
# that all servers should be restarted
sub restart_forced_by_test
{
my $restart = 0;
foreach my $mysqld ( mysqlds() )
{
my $datadir = $mysqld->value('datadir');
my $force_restart_file = "$datadir/mtr/force_restart";
if ( -f $force_restart_file )
{
mtr_verbose("Restart of servers forced by test");
$restart = 1;
last;
}
}
return $restart;
}
# Return timezone value of tinfo or default value # Return timezone value of tinfo or default value
sub timezone { sub timezone {
my ($tinfo)= @_; my ($tinfo)= @_;
...@@ -3235,7 +3255,11 @@ sub run_testcase ($) { ...@@ -3235,7 +3255,11 @@ sub run_testcase ($) {
if ( $res == 0 ) if ( $res == 0 )
{ {
my $check_res; my $check_res;
if ( $opt_check_testcases and if ( restart_forced_by_test() )
{
stop_all_servers();
}
elsif ( $opt_check_testcases and
$check_res= check_testcase($tinfo, "after")) $check_res= check_testcase($tinfo, "after"))
{ {
if ($check_res == 1) { if ($check_res == 1) {
......
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