summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.(none)>2007-06-26 12:26:21 +0200
committerunknown <msvensson@pilot.(none)>2007-06-26 12:26:21 +0200
commit6437c0356a1d9730213183a7b8ed1dd24c3bf318 (patch)
tree51977d94166e1e0362da7454be749fb6c0ccdce3 /mysql-test/lib
parent74331b3f5f941b84120f7ddb01c19dcfd0a63d10 (diff)
downloadmariadb-git-6437c0356a1d9730213183a7b8ed1dd24c3bf318.tar.gz
Bug#25657 mysql-test-run.pl kill itself under ActiveState perl
- Various fixes for running mysql-test-run.pl on ActiveState perl for windows. Reading it's source in win32/win32.c helps... mysql-test/lib/mtr_process.pl: Use "real_pid" when killing the process on ActiveState perl for windows Wait blocking for the pseudo pid to exit. Change "sleep_until_file_created" to return 1 when pidfile has been created - this should avoid early wakeup if $pid was 0 mysql-test/lib/mtr_timer.pl: Wake timer process with signal 15 to avoid to avoid resource leak on ActiveState perl for windows. Install signal handler in timer process to exit gracefully mysql-test/mysql-test-run.pl: Read "real_pid" of process from pid_file - to be used when killing the process on ActiveState perl Drop the --console option to mysqld Pass "real_pid" to mtr_check_stop_server so it can select to use it Correct two argument declarations
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/mtr_process.pl17
-rw-r--r--mysql-test/lib/mtr_timer.pl9
2 files changed, 23 insertions, 3 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index e4fd3390c5f..57f9cf571bb 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -611,6 +611,11 @@ sub mtr_check_stop_servers ($) {
if ( $pid )
{
# Server is still alive, put it in list to be hard killed
+ if ($::glob_win32_perl)
+ {
+ # Kill the real process if it's known
+ $pid= $srv->{'real_pid'} if ($srv->{'real_pid'});
+ }
$kill_pids{$pid}= 1;
# Write a message to the process's error log (if it has one)
@@ -664,6 +669,16 @@ sub mtr_check_stop_servers ($) {
}
}
+ if ($::glob_win32_perl and $srv->{'real_pid'})
+ {
+ # Wait for the pseudo pid - if the real_pid was known
+ # the pseudo pid has not been waited for yet, wai blocking
+ # since it's "such a simple program"
+ mtr_verbose("Wait for pseudo process $srv->{'pid'}");
+ my $ret_pid= waitpid($srv->{'pid'}, 0);
+ mtr_verbose("Pseudo process $ret_pid died");
+ }
+
$srv->{'pid'}= 0;
}
}
@@ -1041,7 +1056,7 @@ sub sleep_until_file_created ($$$) {
{
if ( -r $pidfile )
{
- return $pid;
+ return 1;
}
# Check if it died after the fork() was successful
diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl
index 523799f7cf5..86a9f58514f 100644
--- a/mysql-test/lib/mtr_timer.pl
+++ b/mysql-test/lib/mtr_timer.pl
@@ -97,9 +97,14 @@ sub mtr_timer_start($$$) {
# clearing the signal handler.
$SIG{INT}= 'DEFAULT';
+ $SIG{TERM}= sub {
+ mtr_verbose("timer woke up, exiting!");
+ exit(0);
+ };
+
$0= "mtr_timer(timers,$name,$duration)";
- mtr_verbose("timer child $name, sleep $duration");
sleep($duration);
+ mtr_verbose("timer expired after $duration seconds");
exit(0);
}
}
@@ -118,7 +123,7 @@ sub mtr_timer_stop ($$) {
# FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?!
- kill(9, $tpid);
+ kill(15, $tpid);
# As the timers are so simple programs, we trust them to terminate,
# and use blocking wait for it. We wait just to avoid a zombie.