svn: /php/php-src/ branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt
branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt trunk/ext/standard/tests/general_functions/proc_open02.phpt
| From: | Rasmus Lerdorf | Date: | Wed, 07 Sep 2011 18:09:34 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt trunk/ext/standard/tests/general_functions/proc_open02.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-66367@lists.php.net to get a copy of this message | ||
rasmus Wed, 07 Sep 2011 18:09:34 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316379
Log:
This test was added to verify that bug 39322 was fixed, which the test
does test for and this works. However, it consistently failed because
it relied on a SIGHUP not terminating a sh -c /usr/bin/nohup sleep 50
process which doesn't work because the SIGHUP goes to the sh process
not the nohup'ed sleep process. So, I have sped up the test and removed
the nohup and instead of trying to SIGHUP I am just doing the equivalent
of a kill 0 on it to verify that the resource sticks around.
Bug: https://bugs.php.net/39322 (Closed) proc_terminate():
loosing process resource
Changed paths:
U php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt
U php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt
U php/php-src/trunk/ext/standard/tests/general_functions/proc_open02.phpt
Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07
18:08:44 UTC (rev 316378)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07
18:09:34 UTC (rev 316379)
@@ -3,7 +3,6 @@
--SKIPIF--
<?php
if (!is_executable('/bin/sleep')) echo 'skip no sleep';
-if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup';
if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
?>
--FILE--
@@ -11,19 +10,19 @@
$ds = array(array('pipe', 'r'));
$cat = proc_open(
- '/usr/bin/nohup /bin/sleep 50',
+ '/bin/sleep 2',
$ds,
$pipes
);
-sleep(1); // let the OS run the nohup process before sending the signal
+usleep(20000); // let the OS run the sleep process before sending the signal
-var_dump(proc_terminate($cat, 1)); // send a SIGHUP
-sleep(1);
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
var_dump(proc_get_status($cat));
var_dump(proc_terminate($cat)); // now really quit it
-sleep(1);
+usleep(20000);
var_dump(proc_get_status($cat));
proc_close($cat);
@@ -35,7 +34,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>
@@ -54,7 +53,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>
Modified: php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07
18:08:44 UTC (rev 316378)
+++ php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07
18:09:34 UTC (rev 316379)
@@ -3,7 +3,6 @@
--SKIPIF--
<?php
if (!is_executable('/bin/sleep')) echo 'skip no sleep';
-if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup';
if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
?>
--FILE--
@@ -11,19 +10,19 @@
$ds = array(array('pipe', 'r'));
$cat = proc_open(
- '/usr/bin/nohup /bin/sleep 50',
+ '/bin/sleep 2',
$ds,
$pipes
);
-sleep(1); // let the OS run the nohup process before sending the signal
+usleep(20000); // let the OS run the sleep process before sending the signal
-var_dump(proc_terminate($cat, 1)); // send a SIGHUP
-sleep(1);
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
var_dump(proc_get_status($cat));
var_dump(proc_terminate($cat)); // now really quit it
-sleep(1);
+usleep(20000);
var_dump(proc_get_status($cat));
proc_close($cat);
@@ -35,7 +34,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>
@@ -54,7 +53,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>
Modified: php/php-src/trunk/ext/standard/tests/general_functions/proc_open02.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07 18:08:44 UTC
(rev 316378)
+++ php/php-src/trunk/ext/standard/tests/general_functions/proc_open02.phpt 2011-09-07 18:09:34 UTC
(rev 316379)
@@ -3,7 +3,6 @@
--SKIPIF--
<?php
if (!is_executable('/bin/sleep')) echo 'skip no sleep';
-if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup';
if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
?>
--FILE--
@@ -11,19 +10,19 @@
$ds = array(array('pipe', 'r'));
$cat = proc_open(
- '/usr/bin/nohup /bin/sleep 50',
+ '/bin/sleep 2',
$ds,
$pipes
);
-sleep(1); // let the OS run the nohup process before sending the signal
+usleep(20000); // let the OS run the sleep process before sending the signal
-var_dump(proc_terminate($cat, 1)); // send a SIGHUP
-sleep(1);
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
var_dump(proc_get_status($cat));
var_dump(proc_terminate($cat)); // now really quit it
-sleep(1);
+usleep(20000);
var_dump(proc_get_status($cat));
proc_close($cat);
@@ -35,7 +34,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>
@@ -54,7 +53,7 @@
bool(true)
array(8) {
["command"]=>
- string(28) "/usr/bin/nohup /bin/sleep 50"
+ string(12) "/bin/sleep 2"
["pid"]=>
int(%d)
["running"]=>