mirror of
https://github.com/curl/curl.git
synced 2026-05-30 07:37:33 +03:00
tests: await portfile to be complete
When running under load, a started server may not produce a valid portfile before the runner starts reading it. If the read is not successful, wait for 100ms and try again, timing out after 15 seconds. Fixes #17492 Closes #17495
This commit is contained in:
parent
fe81a80ae7
commit
759d33a25c
1 changed files with 10 additions and 1 deletions
|
|
@ -29,6 +29,7 @@
|
|||
package servers;
|
||||
|
||||
use IO::Socket;
|
||||
use Time::HiRes;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
|
@ -1145,8 +1146,16 @@ sub runhttpserver {
|
|||
|
||||
# where is it?
|
||||
my $port = 0;
|
||||
if(!$port_or_path) {
|
||||
my $waits = 0;
|
||||
# wait at max 15 seconds to the port file to become valid
|
||||
while(!$port_or_path && ($waits < (15 * 10))) {
|
||||
$port = $port_or_path = pidfromfile($portfile);
|
||||
Time::HiRes::sleep(0.1) unless $port_or_path;
|
||||
++$waits;
|
||||
}
|
||||
if(!$port) {
|
||||
logmsg "RUN: failed waiting for server to produce port file $portfile\n";
|
||||
return (1, 0, 0, 0);
|
||||
}
|
||||
|
||||
if($verb) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue