diff options
author | Xinchen Hui <laruence@php.net> | 2011-10-25 10:54:39 +0000 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2011-10-25 10:54:39 +0000 |
commit | 688ba01bc476f248a1ad31fba01eb97b51253c15 (patch) | |
tree | b54b89ffe1d782c50be1b9b5f2eb18b81181030d | |
parent | 6671223afa66b59e458084c3595e298d9e1ae863 (diff) | |
download | php-git-688ba01bc476f248a1ad31fba01eb97b51253c15.tar.gz |
Fix test, now can run on windows
-rw-r--r-- | sapi/cli/tests/php_cli_server.inc | 36 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_001.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_002.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_003.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_004.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_005.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_006.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_007.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_008.phpt | 3 | ||||
-rw-r--r-- | sapi/cli/tests/php_cli_server_009.phpt | 6 |
10 files changed, 23 insertions, 43 deletions
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 3f0e026053..26abe5492a 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -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 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) 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); } ?> + diff --git a/sapi/cli/tests/php_cli_server_001.phpt b/sapi/cli/tests/php_cli_server_001.phpt index 27c81bb6ba..3f1083e7ac 100644 --- a/sapi/cli/tests/php_cli_server_001.phpt +++ b/sapi/cli/tests/php_cli_server_001.phpt @@ -5,9 +5,6 @@ allow_url_fopen=1 --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_002.phpt b/sapi/cli/tests/php_cli_server_002.phpt index e1120d61bf..ee5b9c58da 100644 --- a/sapi/cli/tests/php_cli_server_002.phpt +++ b/sapi/cli/tests/php_cli_server_002.phpt @@ -5,9 +5,6 @@ allow_url_fopen=1 --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_003.phpt b/sapi/cli/tests/php_cli_server_003.phpt index 8e7f11fed7..428ee80802 100644 --- a/sapi/cli/tests/php_cli_server_003.phpt +++ b/sapi/cli/tests/php_cli_server_003.phpt @@ -5,9 +5,6 @@ allow_url_fopen=1 --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt index 804e0bfbda..313159b7e0 100644 --- a/sapi/cli/tests/php_cli_server_004.phpt +++ b/sapi/cli/tests/php_cli_server_004.phpt @@ -5,9 +5,6 @@ allow_url_fopen=1 --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index b94b5b8a37..c8665dec18 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -3,9 +3,6 @@ Post a file --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt index d23b6d3ca6..7ff1c99b7a 100644 --- a/sapi/cli/tests/php_cli_server_006.phpt +++ b/sapi/cli/tests/php_cli_server_006.phpt @@ -3,9 +3,6 @@ Bug #55755 (SegFault when outputting header WWW-Authenticate) --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt index a584d07b37..c3d86324ed 100644 --- a/sapi/cli/tests/php_cli_server_007.phpt +++ b/sapi/cli/tests/php_cli_server_007.phpt @@ -3,9 +3,6 @@ Bug #55758 (Digest Authenticate missed in 5.4) --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt index 390bf019a2..c0b7516e00 100644 --- a/sapi/cli/tests/php_cli_server_008.phpt +++ b/sapi/cli/tests/php_cli_server_008.phpt @@ -3,9 +3,6 @@ SERVER_PROTOCOL header availability --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index 311e53155d..5f2e41c3fd 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -6,9 +6,6 @@ now could serve correctly with request_uri "index.php" and PATH_INFO "/foo/bar/" --SKIPIF-- <?php include "skipif.inc"; -if (substr(PHP_OS, 0, 3) == 'WIN') { - die ("skip not for Windows"); -} ?> --FILE-- <?php @@ -79,7 +76,6 @@ HEADER fclose($fp); ?> --EXPECTF-- -[%s] %s HTTP/1.1 200 OK Host: %s Connection: closed @@ -87,7 +83,6 @@ X-Powered-By: PHP/%s-dev Content-type: text/html string(8) "/foo/bar" -[%s] %s HTTP/1.0 200 OK Host: %s Connection: closed @@ -95,5 +90,4 @@ X-Powered-By: PHP/%s-dev Content-type: text/html string(9) "/foo/bar/" -[%s] %s HTTP/1.0 404 Not Found |