X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fhelper%2Fserver.inc;h=af71a0e2a66f2244ed350f0801e46fa5cb1e6aed;hb=3781fedcdef297da28e6f1ffe6f556e7ce659ac5;hp=3d49a85363d7a714ebd80d2d020bd2c1f9cda454;hpb=62e6b88c7223f15646c8dcfd0e974b03cd5cf63a;p=m6w6%2Fext-http diff --git a/tests/helper/server.inc b/tests/helper/server.inc index 3d49a85..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, 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 +}