Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2303 06/04/07 15:20:17 msvensson@neptunus.(none) +1 -0
Bug#18415 mysql-test-run.pl does not run on ActiveState perl
- Part 1, better handling of subprocess and stdout to be done
mysql-test/lib/mtr_process.pl
1.29 06/04/07 15:20:12 msvensson@neptunus.(none) +25 -20
Dont redirect stdout if ActiveState perl since fork creates a new thread and not
another process.
Change waitpid to allow for negative pid as we get on Windows, strange but that is how
it is. It should never create a process with pid -1 though.
Remove And if foir cygwin that does not do anything.
Add "print" in the potoentially hanging while loop in "start_reap_all"
Dont use "getpgrp" on windows.
Remove "sleep 2" in mtr_exit
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/my51-bug18415
--- 1.28/mysql-test/lib/mtr_process.pl 2006-03-06 11:33:42 +01:00
+++ 1.29/mysql-test/lib/mtr_process.pl 2006-04-07 15:20:12 +02:00
@@ -144,17 +144,6 @@
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
- if ( $::glob_cygwin_shell and $mode eq 'test' )
- {
- # Programs started from mysqltest under Cygwin, are to
- # execute them within Cygwin. Else simple things in test
- # files like
- # --system "echo 1 > file"
- # will fail.
- # FIXME not working :-(
-# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
- }
-
my $log_file_open_mode = '>';
if ($spawn_opts and $spawn_opts->{'append_log_file'})
@@ -164,7 +153,13 @@
if ( $output )
{
- if ( ! open(STDOUT,$log_file_open_mode,$output) )
+ if ( $::glob_win32_perl )
+ {
+ # Don't redirect stdout on ActiveState perl - same process.
+ # Should be fixed so that the thread that is created with fork
+ # executes the exe in another process and wait's for it to return
+ }
+ elsif ( ! open(STDOUT,$log_file_open_mode,$output) )
{
mtr_child_error("can't redirect STDOUT to \"$output\": $!");
}
@@ -216,8 +211,7 @@
{
# Simple run of command, we wait for it to return
my $ret_pid= waitpid($pid,0);
-
- if ( $ret_pid <= 0 )
+ if ( $ret_pid == -1 )
{
mtr_error("$path ($pid) got lost somehow");
}
@@ -702,7 +696,7 @@
{
foreach my $pid (keys %mysql_admin_pids)
{
- if ( waitpid($pid,0) > 0 )
+ if ( waitpid($pid,0) != 0 )
{
delete $mysql_admin_pids{$pid};
}
@@ -756,7 +750,7 @@
# FIXME the man page says to wait for -1 to terminate,
# but on OS X we get '0' all the time...
- while ( ($ret_pid= waitpid(-1,&WNOHANG)) > 0 )
+ while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 )
{
mtr_debug("waitpid() catched exit of child $ret_pid");
foreach my $idx (0..1)
@@ -785,11 +779,14 @@
# the need for (or possibility of) explicit waitpid().
$SIG{CHLD}= 'IGNORE';
+ my $pid;
# On some platforms (Linux, QNX, OSX, ...) there is potential race
# here. If a process terminated before setting $SIG{CHLD} (but after
# any attempt to waitpid() it), it will still be a zombie. So we
# have to handle any such process here.
- while(waitpid(-1, &WNOHANG) > 0) { };
+ while( ($pid= waitpid(-1, &WNOHANG)) != 0) {
+ print "start_reap_all: pid: $pid.\n";
+ };
}
sub stop_reap_all {
@@ -843,7 +840,7 @@
}
# Check if it died after the fork() was successful
- if ( $pid > 0 && waitpid($pid,&WNOHANG) == $pid )
+ if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
{
return 0;
}
@@ -905,8 +902,16 @@
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
- kill('HUP', -$$) if $$ == getpgrp();
- sleep 2;
+ if ( $::glob_win32_perl )
+ {
+ # getpgrp no implemented
+ kill('HUP', -$$);
+ }
+ else
+ {
+ kill('HUP', -$$) if $$ == getpgrp();
+ }
+
exit($code);
}
| Thread |
|---|
| • bk commit into 5.1 tree (msvensson:1.2303) BUG#18415 | msvensson | 7 Apr |