mirror of
https://github.com/curl/curl.git
synced 2026-07-30 11:48:08 +03:00
improve synchronization between test harness runtests.pl script
and test harness servers to minimize risk of false test failures. http://curl.haxx.se/mail/lib-2008-04/0392.html
This commit is contained in:
parent
3783b455c0
commit
96edebf4d9
7 changed files with 132 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
|
|
@ -85,6 +85,8 @@ my $port = 8921; # just a default
|
|||
my $listenaddr = "127.0.0.1"; # just a default
|
||||
my $pidfile = ".ftpd.pid"; # a default, use --pidfile
|
||||
|
||||
my $SERVERLOGS_LOCK="log/serverlogs.lock"; # server logs advisor read lock
|
||||
|
||||
do {
|
||||
if($ARGV[0] eq "-v") {
|
||||
$verbose=1;
|
||||
|
|
@ -121,6 +123,7 @@ sub catch_zap {
|
|||
my $signame = shift;
|
||||
print STDERR "ftpserver.pl received SIG$signame, exiting\n";
|
||||
ftpkillslaves(1);
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
die "Somebody sent me a SIG$signame";
|
||||
}
|
||||
$SIG{INT} = \&catch_zap;
|
||||
|
|
@ -146,6 +149,7 @@ sub sysread_or_die {
|
|||
logmsg "Error: ftp$ftpdnum$ext sysread error: $!\n";
|
||||
kill(9, $sfpid);
|
||||
waitpid($sfpid, 0);
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
die "Died in sysread_or_die() at $fcaller " .
|
||||
"line $lcaller. ftp$ftpdnum$ext sysread error: $!\n";
|
||||
}
|
||||
|
|
@ -155,6 +159,7 @@ sub sysread_or_die {
|
|||
logmsg "Error: ftp$ftpdnum$ext read zero\n";
|
||||
kill(9, $sfpid);
|
||||
waitpid($sfpid, 0);
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
die "Died in sysread_or_die() at $fcaller " .
|
||||
"line $lcaller. ftp$ftpdnum$ext read zero\n";
|
||||
}
|
||||
|
|
@ -176,6 +181,7 @@ sub startsf {
|
|||
logmsg "Failed sockfilt command: $cmd\n";
|
||||
kill(9, $sfpid);
|
||||
waitpid($sfpid, 0);
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
die "Failed to start sockfilt!";
|
||||
}
|
||||
}
|
||||
|
|
@ -784,6 +790,8 @@ while(1) {
|
|||
}
|
||||
logmsg "====> Client connect\n";
|
||||
|
||||
set_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
|
||||
# flush data:
|
||||
$| = 1;
|
||||
|
||||
|
|
@ -888,8 +896,13 @@ while(1) {
|
|||
|
||||
} # while(1)
|
||||
logmsg "====> Client disconnected\n";
|
||||
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
}
|
||||
|
||||
print SFWRITE "QUIT\n";
|
||||
waitpid $sfpid, 0;
|
||||
|
||||
clear_advisor_read_lock($SERVERLOGS_LOCK);
|
||||
|
||||
exit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue