summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-20 13:51:31 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-20 13:51:31 +0100
commitd5c55f81ec0d2290a2f4309d6b2aad2cd4cf7da9 (patch)
tree26f964e214db501a0539da4539d7354e71a79665 /ext/standard/tests
parentb0737fa35e3a8dec495a8faf39887f1a587307d8 (diff)
downloadphp-git-d5c55f81ec0d2290a2f4309d6b2aad2cd4cf7da9.tar.gz
Try to make proc_open_bug69900.phpt more robust
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/streams/proc_open_bug69900.phpt23
1 files changed, 9 insertions, 14 deletions
diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt
index 65505d09fe..61775f72b2 100644
--- a/ext/standard/tests/streams/proc_open_bug69900.phpt
+++ b/ext/standard/tests/streams/proc_open_bug69900.phpt
@@ -25,6 +25,7 @@ $pipes = array();
$process = proc_open(PHP_BINARY.' -n -f ' . $fl, $descriptorspec, $pipes, NULL, NULL, array("blocking_pipes" => true));
+$moreThanLimit = 0;
for($i = 0; $i < 10; $i++){
fwrite($pipes[0], "hello$i\r\n");
fflush($pipes[0]);
@@ -37,9 +38,7 @@ for($i = 0; $i < 10; $i++){
$dt_ms = ($t1 - $t0)*1000;
if ($dt_ms > $max_ms) {
- echo "fgets() took more than $max_ms ms ($dt_ms ms)\n";
- } else {
- echo "fgets() took less than $max_ms ms\n";
+ $moreThanLimit++;
}
}
@@ -48,6 +47,12 @@ fclose($pipes[1]);
proc_close($process);
+/* It is expected that the first call takes more than the limit.
+ * Allow one more to account for a possible process switch. */
+if ($moreThanLimit > 2) {
+ echo "fgets() took more than $max_ms ms $moreThanLimit times\n";
+}
+
?>
===DONE===
--CLEAN--
@@ -55,25 +60,15 @@ proc_close($process);
$fl = __DIR__ . DIRECTORY_SEPARATOR . "test69900.php";
@unlink($fl);
?>
---EXPECTF--
+--EXPECT--
hello0
-fgets() took %s
hello1
-fgets() took less than %d ms
hello2
-fgets() took less than %d ms
hello3
-fgets() took less than %d ms
hello4
-fgets() took less than %d ms
hello5
-fgets() took less than %d ms
hello6
-fgets() took less than %d ms
hello7
-fgets() took less than %d ms
hello8
-fgets() took less than %d ms
hello9
-fgets() took less than %d ms
===DONE===