[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc trunk/sapi/cli/tests/php_cli_server.inc
pierrick Fri, 18 Nov 2011 06:15:25 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319436 Log: Don't load php.ini file to test the built-in web server Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc U php/php-src/trunk/sapi/cli/tests/php_cli_server.inc Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc === --- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-18 06:15:23 UTC (rev 319435) +++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-18 06:15:25 UTC (rev 319436) @@ -16,14 +16,14 @@ ); if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; + $cmd = {$php_executable} -t {$doc_root} -n -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); } else { - $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; + $cmd = exec {$php_executable} -t {$doc_root} -n -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server.inc === --- php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-18 06:15:23 UTC (rev 319435) +++ php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-18 06:15:25 UTC (rev 319436) @@ -16,14 +16,14 @@ ); if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; + $cmd = {$php_executable} -t {$doc_root} -n -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); } else { - $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; + $cmd = exec {$php_executable} -t {$doc_root} -n -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc trunk/sapi/cli/tests/php_cli_server.inc
laruence Thu, 17 Nov 2011 02:22:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319382 Log: improve the test, let it say about errors Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc U php/php-src/trunk/sapi/cli/tests/php_cli_server.inc Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc === --- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-17 00:17:22 UTC (rev 319381) +++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:22:06 UTC (rev 319382) @@ -12,7 +12,7 @@ $descriptorspec = array( 0 = STDIN, 1 = STDOUT, - 2 = STDERR, + 2 = array(pipe, w), ); if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -21,25 +21,35 @@ $cmd .= {$router}; } - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true)); } else { $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } - $cmd .= 2/dev/null; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } + //@FIXME is there a better way to make sure the process is ready? + usleep(5); + + stream_set_blocking($pipes[2], 0); + if ($err = stream_get_contents($pipes[2])) { + fclose($pipes[2]); + proc_terminate($handle); + @unlink(__DIR__ . /{$router}); + die(Cli sever could not be started: . $err); + } + register_shutdown_function( - function($handle) use($router) { + function($handle, $router, $pipes) { + stream_get_contents($pipes[2]); + fclose($pipes[2]); proc_terminate($handle); @unlink(__DIR__ . /{$router}); }, - $handle + $handle, $router, $pipes ); - usleep(5); } ? - Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server.inc === --- php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-17 00:17:22 UTC (rev 319381) +++ php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:22:06 UTC (rev 319382) @@ -12,7 +12,7 @@ $descriptorspec = array( 0 = STDIN, 1 = STDOUT, - 2 = STDERR, + 2 = array(pipe, w), ); if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -21,25 +21,35 @@ $cmd .= {$router}; } - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true)); } else { $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } - $cmd .= 2/dev/null; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } + //@FIXME is there a better way to make sure the process is ready? + usleep(5); + + stream_set_blocking($pipes[2], 0); + if ($err = stream_get_contents($pipes[2])) { + fclose($pipes[2]); + proc_terminate($handle); + @unlink(__DIR__ . /{$router}); + die(Cli sever could not be started: . $err); + } + register_shutdown_function( - function($handle) use($router) { + function($handle, $router, $pipes) { + stream_get_contents($pipes[2]); + fclose($pipes[2]); proc_terminate($handle); @unlink(__DIR__ . /{$router}); }, - $handle + $handle, $router, $pipes ); - usleep(5); } ? - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc trunk/sapi/cli/tests/php_cli_server.inc
laruence Thu, 17 Nov 2011 02:32:21 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319383 Log: revert my previous change, tests hangs on windows Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc U php/php-src/trunk/sapi/cli/tests/php_cli_server.inc Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc === --- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:22:06 UTC (rev 319382) +++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:32:21 UTC (rev 319383) @@ -12,7 +12,7 @@ $descriptorspec = array( 0 = STDIN, 1 = STDOUT, - 2 = array(pipe, w), + 2 = STDERR, ); if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -21,35 +21,25 @@ $cmd .= {$router}; } - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true)); + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); } else { $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } + $cmd .= 2/dev/null; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } - //@FIXME is there a better way to make sure the process is ready? - usleep(5); - - stream_set_blocking($pipes[2], 0); - if ($err = stream_get_contents($pipes[2])) { - fclose($pipes[2]); - proc_terminate($handle); - @unlink(__DIR__ . /{$router}); - die(Cli sever could not be started: . $err); - } - register_shutdown_function( - function($handle, $router, $pipes) { - stream_get_contents($pipes[2]); - fclose($pipes[2]); + function($handle) use($router) { proc_terminate($handle); @unlink(__DIR__ . /{$router}); }, - $handle, $router, $pipes + $handle ); + usleep(5); } ? + Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server.inc === --- php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:22:06 UTC (rev 319382) +++ php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-11-17 02:32:21 UTC (rev 319383) @@ -12,7 +12,7 @@ $descriptorspec = array( 0 = STDIN, 1 = STDOUT, - 2 = array(pipe, w), + 2 = STDERR, ); if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -21,35 +21,25 @@ $cmd .= {$router}; } - $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true)); + $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array(bypass_shell = true, suppress_errors = true)); } else { $cmd = exec {$php_executable} -t {$doc_root} -S . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= {$router}; } + $cmd .= 2/dev/null; $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); } - //@FIXME is there a better way to make sure the process is ready? - usleep(5); - - stream_set_blocking($pipes[2], 0); - if ($err = stream_get_contents($pipes[2])) { - fclose($pipes[2]); - proc_terminate($handle); - @unlink(__DIR__ . /{$router}); - die(Cli sever could not be started: . $err); - } - register_shutdown_function( - function($handle, $router, $pipes) { - stream_get_contents($pipes[2]); - fclose($pipes[2]); + function($handle) use($router) { proc_terminate($handle); @unlink(__DIR__ . /{$router}); }, - $handle, $router, $pipes + $handle ); + usleep(5); } ? + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php