X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fhelper%2Fserver.inc;h=af71a0e2a66f2244ed350f0801e46fa5cb1e6aed;hb=9a02b1a9ef8dc62a241148405be8058e0df4250e;hp=265a861a4a9129656c24adc529d4f70fd99780f8;hpb=455306442cd599c5a5750a70053b1a5f47b08538;p=m6w6%2Fext-http diff --git a/tests/helper/server.inc b/tests/helper/server.inc index 265a861..af71a0e 100644 --- a/tests/helper/server.inc +++ b/tests/helper/server.inc @@ -1,5 +1,19 @@ getMessage()); /* ignore disconnect */ if ($ex->getMessage() !== "Empty message received from stream") { fprintf(STDERR, "%s\n", $ex); @@ -33,7 +70,7 @@ function serve($cb) { break; } } - } while ($select !== false); + } while ($select); return; } } @@ -50,16 +87,17 @@ function server($handler, $cb) { function nghttpd($cb) { $spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w")); - foreach (range(8000+PHP_INT_SIZE, 9000) as $port) { + $offset = rand(0,2000); + foreach (range(8000+$offset, 9000+$offset) as $port) { $comm = "exec nghttpd -d html $port http2.key http2.crt"; if (($proc = proc_open($comm, $spec, $pipes, __DIR__))) { $stdin = $pipes[0]; $stdout = $pipes[1]; $stderr = $pipes[2]; - usleep(50000); + sleep(1); $status = proc_get_status($proc); - + logger("nghttpd: %s", new http\Params($status)); if (!$status["running"]) { continue; } @@ -83,6 +121,7 @@ function nghttpd($cb) { function proc($bin, $args, $cb) { $spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w")); $comm = escapeshellcmd($bin) . " ". implode(" ", array_map("escapeshellarg", $args)); + logger("proc: %s %s", $bin, implode(" ", $args)); if (($proc = proc_open($comm, $spec, $pipes, __DIR__))) { $stdin = $pipes[0]; $stdout = $pipes[1]; @@ -106,4 +145,4 @@ function proc($bin, $args, $cb) { fpassthru($stderr); fpassthru($stdout); } -} \ No newline at end of file +}