laruence Tue, 25 Oct 2011 10:54:39 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=318401
Log:
Fix test, now can run on windows
Changed paths:
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_001.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_002.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_003.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_004.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_005.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_006.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_007.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_008.phpt
U php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_009.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server.inc
U php/php-src/trunk/sapi/cli/tests/php_cli_server_001.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_002.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_003.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_004.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_005.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_006.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_007.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_008.phpt
U php/php-src/trunk/sapi/cli/tests/php_cli_server_009.phpt
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-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server.inc 2011-10-25 10:54:39 UTC (rev 318401)
@@ -2,7 +2,7 @@
define ("PHP_CLI_SERVER_ADDRESS", "localhost:8964");
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
- $php_executable = getenv('TEST_PHP_EXECUTABLE');
+ $php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$router = "index.php";
file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>');
@@ -13,21 +13,31 @@
2 => STDERR,
);
- $cmd = "exec {$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $cmd = "{$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+ if (!$no_router) {
+ $cmd .= " {$router}";
+ }
- 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;
+ if (!$no_router) {
+ $cmd .= " {$router}";
+ }
+ $cmd .= " 2>/dev/null";
+
+ $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
}
- $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
-
- register_shutdown_function(
- function($handle) use($router) {
- proc_terminate($handle);
- @unlink(__DIR__ . "/{$router}");
- },
- $handle
- );
+ register_shutdown_function(
+ function($handle) use($router) {
+ proc_terminate($handle);
+ @unlink(__DIR__ . "/{$router}");
+ },
+ $handle
+ );
usleep(50000);
}
?>
+
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_001.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_001.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_001.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_002.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_002.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_002.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_003.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_003.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_003.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_004.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_004.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_004.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_005.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_005.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_005.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_006.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_006.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_006.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_007.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_007.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_007.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_008.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_008.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_008.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_009.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_009.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_009.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -6,9 +6,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
@@ -79,7 +76,6 @@
fclose($fp);
?>
--EXPECTF--
-[%s] %s
HTTP/1.1 200 OK
Host: %s
Connection: closed
@@ -87,7 +83,6 @@
Content-type: text/html
string(8) "/foo/bar"
-[%s] %s
HTTP/1.0 200 OK
Host: %s
Connection: closed
@@ -95,5 +90,4 @@
Content-type: text/html
string(9) "/foo/bar/"
-[%s] %s
HTTP/1.0 404 Not Found
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server.inc
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server.inc 2011-10-25 10:54:39 UTC (rev 318401)
@@ -2,7 +2,7 @@
define ("PHP_CLI_SERVER_ADDRESS", "localhost:8964");
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
- $php_executable = getenv('TEST_PHP_EXECUTABLE');
+ $php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$router = "index.php";
file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>');
@@ -13,21 +13,31 @@
2 => STDERR,
);
- $cmd = "exec {$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $cmd = "{$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+ if (!$no_router) {
+ $cmd .= " {$router}";
+ }
- 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;
+ if (!$no_router) {
+ $cmd .= " {$router}";
+ }
+ $cmd .= " 2>/dev/null";
+
+ $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
}
- $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
-
- register_shutdown_function(
- function($handle) use($router) {
- proc_terminate($handle);
- @unlink(__DIR__ . "/{$router}");
- },
- $handle
- );
+ register_shutdown_function(
+ function($handle) use($router) {
+ proc_terminate($handle);
+ @unlink(__DIR__ . "/{$router}");
+ },
+ $handle
+ );
usleep(50000);
}
?>
+
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_001.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_001.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_001.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_002.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_002.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_002.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_003.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_003.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_003.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_004.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_004.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_004.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -5,9 +5,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_005.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_005.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_005.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_006.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_006.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_006.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_007.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_007.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_007.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_008.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_008.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_008.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -3,9 +3,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
Modified: php/php-src/trunk/sapi/cli/tests/php_cli_server_009.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_009.phpt 2011-10-25 10:25:26 UTC (rev 318400)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_009.phpt 2011-10-25 10:54:39 UTC (rev 318401)
@@ -6,9 +6,6 @@
--SKIPIF--
<?php
include "skipif.inc";
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
-}
?>
--FILE--
<?php
@@ -79,7 +76,6 @@
fclose($fp);
?>
--EXPECTF--
-[%s] %s
HTTP/1.1 200 OK
Host: %s
Connection: closed
@@ -87,7 +83,6 @@
Content-type: text/html
string(8) "/foo/bar"
-[%s] %s
HTTP/1.0 200 OK
Host: %s
Connection: closed
@@ -95,5 +90,4 @@
Content-type: text/html
string(9) "/foo/bar/"
-[%s] %s
HTTP/1.0 404 Not Found
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php