Created
May 29, 2015 14:11
-
-
Save weltling/0d8c842665aad516d0fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/standard/tests/general_functions/proc_open_pipes1.phpt b/ext/standard/tests/general_functions/proc_open_pipes1.phpt | |
index bf66422..799f88f 100644 | |
--- a/ext/standard/tests/general_functions/proc_open_pipes1.phpt | |
+++ b/ext/standard/tests/general_functions/proc_open_pipes1.phpt | |
@@ -3,17 +3,27 @@ proc_open() with > 16 pipes | |
--FILE-- | |
<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
for ($i = 3; $i<= 30; $i++) { | |
$spec[$i] = array('pipe', 'w'); | |
} | |
$php = getenv("TEST_PHP_EXECUTABLE"); | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+$callee = create_sleep_script(); | |
+proc_open("$php $callee", $spec, $pipes); | |
var_dump(count($spec)); | |
var_dump($pipes); | |
?> | |
+--CLEAN-- | |
+<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
+unlink_sleep_script(); | |
+ | |
+?> | |
--EXPECTF-- | |
int(28) | |
array(28) { | |
diff --git a/ext/standard/tests/general_functions/proc_open_pipes2.phpt b/ext/standard/tests/general_functions/proc_open_pipes2.phpt | |
index d4f3717..b07a19e 100644 | |
--- a/ext/standard/tests/general_functions/proc_open_pipes2.phpt | |
+++ b/ext/standard/tests/general_functions/proc_open_pipes2.phpt | |
@@ -3,15 +3,25 @@ proc_open() with no pipes | |
--FILE-- | |
<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
$spec = array(); | |
$php = getenv("TEST_PHP_EXECUTABLE"); | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+$callee = create_sleep_script(); | |
+proc_open("$php $callee", $spec, $pipes); | |
var_dump(count($spec)); | |
var_dump($pipes); | |
?> | |
+--CLEAN-- | |
+<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
+unlink_sleep_script(); | |
+ | |
+?> | |
--EXPECTF-- | |
int(0) | |
array(0) { | |
diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt | |
index fc18201..107425b 100644 | |
--- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt | |
+++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt | |
@@ -3,28 +3,38 @@ proc_open() with invalid pipes | |
--FILE-- | |
<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
for ($i = 3; $i<= 5; $i++) { | |
$spec[$i] = array('pipe', 'w'); | |
} | |
$php = getenv("TEST_PHP_EXECUTABLE"); | |
+$callee = create_sleep_script(); | |
$spec[$i] = array('pi'); | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+proc_open("$php $callee", $spec, $pipes); | |
$spec[$i] = 1; | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+proc_open("$php $callee", $spec, $pipes); | |
$spec[$i] = array('pipe', "test"); | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+proc_open("$php $callee", $spec, $pipes); | |
var_dump($pipes); | |
$spec[$i] = array('file', "test", "z"); | |
-proc_open("$php -r 'sleep(1);'", $spec, $pipes); | |
+proc_open("$php $callee", $spec, $pipes); | |
var_dump($pipes); | |
echo "END\n"; | |
?> | |
+--CLEAN-- | |
+<?php | |
+include dirname(__FILE__) . "/proc_open_pipes.inc"; | |
+ | |
+unlink_sleep_script(); | |
+ | |
+?> | |
--EXPECTF-- | |
Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d | |
--- /dev/null Fri May 29 16:07:11 2015 | |
+++ b/ext/standard/tests/general_functions/proc_open_pipes.inc Fri May 29 16:05:05 2015 | |
@@ -0,0 +1,22 @@ | |
+<?php | |
+ | |
+function create_sleep_script() | |
+{ | |
+ $fname = dirname(__FILE__) . DIRECTORY_SEPARATOR . "proc_open_pipes_sleep.php"; | |
+ | |
+ if (!file_exists($fname)) { | |
+ file_put_contents($fname, "<?php\nsleep(1);\n"); | |
+ } | |
+ | |
+ return $fname; | |
+} | |
+ | |
+function unlink_sleep_script() | |
+{ | |
+ $fname = dirname(__FILE__) . DIRECTORY_SEPARATOR . "proc_open_pipes_sleep.php"; | |
+ | |
+ if (file_exists($fname)) { | |
+ unlink($fname); | |
+ } | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment