1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

better skip reasons, longer waiting for startup of servers (due to slow/loaded

host), added retrying/waiting for slow stunnel startups
This commit is contained in:
Daniel Stenberg 2004-01-12 14:34:48 +00:00
parent 11e8600390
commit b291bbc9a6

View File

@ -344,7 +344,7 @@ sub runhttpserver {
} }
my $verified; my $verified;
for(1 .. 5) { for(1 .. 10) {
# verify that our server is up and running: # verify that our server is up and running:
my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver 2>/dev/null`; my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver 2>/dev/null`;
@ -354,7 +354,10 @@ sub runhttpserver {
last; last;
} }
else { else {
sleep(1); if($verbose) {
print STDERR "RUN: Retrying HTTP server existence in 3 sec\n";
}
sleep(3);
next; next;
} }
} }
@ -377,12 +380,13 @@ sub runhttpsserver {
my $verbose = $_[0]; my $verbose = $_[0];
my $STATUS; my $STATUS;
my $RUNNING; my $RUNNING;
my $pid=checkserver($HTTPSPIDFILE );
if(!$stunnel) { if(!$stunnel) {
return 0; return 0;
} }
my $pid=checkserver($HTTPSPIDFILE );
if($pid > 0) { if($pid > 0) {
# kill previous stunnel! # kill previous stunnel!
if($verbose) { if($verbose) {
@ -398,8 +402,21 @@ sub runhttpsserver {
print "CMD: $cmd\n"; print "CMD: $cmd\n";
} }
sleep(1); sleep(1);
for(1 .. 10) {
$pid=checkserver($HTTPSPIDFILE); $pid=checkserver($HTTPSPIDFILE);
if($pid <= 0) {
if($verbose) {
print STDERR "RUN: waiting 3 sec for HTTPS server\n";
}
sleep(3);
}
else {
last;
}
}
return $pid; return $pid;
} }
@ -458,7 +475,7 @@ sub runftpserver {
system($cmd); system($cmd);
my $verified; my $verified;
for(1 .. 5) { for(1 .. 10) {
# verify that our server is up and running: # verify that our server is up and running:
my $data=`$CURL --silent -i ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`; my $data=`$CURL --silent -i ftp://$HOSTIP:$FTPPORT/verifiedserver 2>/dev/null`;
@ -469,9 +486,9 @@ sub runftpserver {
} }
else { else {
if($verbose) { if($verbose) {
print STDERR "RUN: Retrying FTP server existance in 1 sec\n"; print STDERR "RUN: Retrying FTP server existence in 3 sec\n";
} }
sleep(1); sleep(3);
next; next;
} }
} }
@ -494,11 +511,11 @@ sub runftpsserver {
my $verbose = $_[0]; my $verbose = $_[0];
my $STATUS; my $STATUS;
my $RUNNING; my $RUNNING;
my $pid=checkserver($FTPSPIDFILE );
if(!$stunnel) { if(!$stunnel) {
return 0; return 0;
} }
my $pid=checkserver($FTPSPIDFILE );
if($pid > 0) { if($pid > 0) {
# kill previous stunnel! # kill previous stunnel!
@ -516,8 +533,21 @@ sub runftpsserver {
} }
sleep(1); sleep(1);
for(1 .. 10) {
$pid=checkserver($FTPSPIDFILE ); $pid=checkserver($FTPSPIDFILE );
if($pid <= 0) {
if($verbose) {
print STDERR "RUN: waiting 3 sec for FTPS server\n";
}
sleep(3);
}
else {
last;
}
}
return $pid; return $pid;
} }
@ -716,7 +746,7 @@ sub singletest {
} }
} }
$why = "lacks $f"; $why = "curl lacks $f support";
$serverproblem = 15; # set it here $serverproblem = 15; # set it here
last; last;
} }
@ -741,7 +771,10 @@ sub singletest {
# set above, a lacking prereq # set above, a lacking prereq
} }
elsif($serverproblem == 1) { elsif($serverproblem == 1) {
$why = "no SSL-capable server"; $why = "no HTTPS server";
}
elsif($serverproblem == 3) {
$why = "no FTPS server";
} }
else { else {
$why = "unfulfilled requirements"; $why = "unfulfilled requirements";
@ -1170,9 +1203,9 @@ sub startservers {
} }
elsif($what eq "ftps") { elsif($what eq "ftps") {
if(!$stunnel || !$ssl_version) { if(!$stunnel || !$ssl_version) {
# we can't run https tests without stunnel # we can't run ftps tests without stunnel
# or if libcurl is SSL-less # or if libcurl is SSL-less
return 1; return 3;
} }
if(!$run{'ftp'}) { if(!$run{'ftp'}) {
$pid = runftpserver($verbose); $pid = runftpserver($verbose);
@ -1234,8 +1267,9 @@ sub startservers {
# Returns: # Returns:
# 100 if this is not a test case # 100 if this is not a test case
# 99 if this test case has no servers specified # 99 if this test case has no servers specified
# 3 if this test is skipped due to no FTPS server
# 2 if one of the required servers couldn't be started # 2 if one of the required servers couldn't be started
# 1 if this test is skipped due to unfulfilled SSL/stunnel-requirements # 1 if this test is skipped due to no HTTPS server
sub serverfortest { sub serverfortest {
my ($testnum)=@_; my ($testnum)=@_;