Commit bfac8534 authored by unknown's avatar unknown

mtr_misc.pl, mtr_report.pl:

  Try kill all children to the mysql-test-run process when exiting
mtr_process.pl:
  Added new function mtr_exit() that try kill all children to the mysql-test-run process when exiting
mysql-test-run.pl:
  Try kill all children to the mysql-test-run process when exiting
  New --vardir caused problems on Windows
  Changed faulty calls to error() to mtr_error()


mysql-test/mysql-test-run.pl:
  Try kill all children to the mysql-test-run process when exiting
  New --vardir caused problems on Windows
  Changed faulty calls to error() to mtr_error()
mysql-test/lib/mtr_report.pl:
  Try kill all children to the mysql-test-run process when exiting
mysql-test/lib/mtr_process.pl:
  Added new function mtr_exit() that try kill all children to the mysql-test-run process when exiting
mysql-test/lib/mtr_misc.pl:
  Try kill all children to the mysql-test-run process when exiting
parent 062a1b8b
...@@ -25,7 +25,7 @@ sub mtr_full_hostname () { ...@@ -25,7 +25,7 @@ sub mtr_full_hostname () {
if ( $hostname !~ /\./ ) if ( $hostname !~ /\./ )
{ {
my $address= gethostbyname($hostname) my $address= gethostbyname($hostname)
or die "Couldn't resolve $hostname : $!"; or mtr_error("Couldn't resolve $hostname : $!");
my $fullname= gethostbyaddr($address, AF_INET); my $fullname= gethostbyaddr($address, AF_INET);
$hostname= $fullname if $fullname; $hostname= $fullname if $fullname;
} }
......
...@@ -17,6 +17,7 @@ sub mtr_spawn ($$$$$$); ...@@ -17,6 +17,7 @@ sub mtr_spawn ($$$$$$);
sub mtr_stop_mysqld_servers ($); sub mtr_stop_mysqld_servers ($);
sub mtr_kill_leftovers (); sub mtr_kill_leftovers ();
sub mtr_record_dead_children (); sub mtr_record_dead_children ();
sub mtr_exit ($);
sub sleep_until_file_created ($$$); sub sleep_until_file_created ($$$);
# static in C # static in C
...@@ -784,4 +785,17 @@ sub sleep_until_file_created ($$$) { ...@@ -784,4 +785,17 @@ sub sleep_until_file_created ($$$) {
} }
##############################################################################
#
# When we exit, we kill off all children
#
##############################################################################
sub mtr_exit ($) {
my $code= shift;
local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$);
exit($code);
}
1; 1;
...@@ -268,7 +268,8 @@ sub mtr_warning (@) { ...@@ -268,7 +268,8 @@ sub mtr_warning (@) {
} }
sub mtr_error (@) { sub mtr_error (@) {
die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n"; print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
mtr_exit(1);
} }
sub mtr_debug (@) { sub mtr_debug (@) {
......
...@@ -398,7 +398,7 @@ sub main () { ...@@ -398,7 +398,7 @@ sub main () {
} }
} }
exit(0); mtr_exit(0);
} }
############################################################################## ##############################################################################
...@@ -568,7 +568,9 @@ sub command_line_setup () { ...@@ -568,7 +568,9 @@ sub command_line_setup () {
$opt_vardir= "$glob_mysql_test_dir/var"; $opt_vardir= "$glob_mysql_test_dir/var";
} }
if ( $opt_vardir !~ m,^/, ) # We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
{ {
# Make absolute path, relative test dir # Make absolute path, relative test dir
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
...@@ -1295,9 +1297,9 @@ sub install_db ($$) { ...@@ -1295,9 +1297,9 @@ sub install_db ($$) {
mtr_report("Installing \u$type Databases"); mtr_report("Installing \u$type Databases");
open(IN, $init_db_sql) open(IN, $init_db_sql)
or error("Can't open $init_db_sql: $!"); or mtr_error("Can't open $init_db_sql: $!");
open(OUT, ">", $init_db_sql_tmp) open(OUT, ">", $init_db_sql_tmp)
or error("Can't write to $init_db_sql_tmp: $!"); or mtr_error("Can't write to $init_db_sql_tmp: $!");
while (<IN>) while (<IN>)
{ {
chomp; chomp;
...@@ -1571,7 +1573,7 @@ sub report_failure_and_restart ($) { ...@@ -1571,7 +1573,7 @@ sub report_failure_and_restart ($) {
{ {
stop_masters_slaves(); stop_masters_slaves();
} }
exit(1); mtr_exit(1);
} }
# FIXME always terminate on failure?! # FIXME always terminate on failure?!
...@@ -2270,5 +2272,5 @@ Options not yet described, or that I want to look into more ...@@ -2270,5 +2272,5 @@ Options not yet described, or that I want to look into more
with-openssl with-openssl
HERE HERE
exit(1); mtr_exit(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