[Process] Avoid zombie process in case of unit tests failure
This commit is contained in:
parent
3ef517b356
commit
57d4159133
@ -263,7 +263,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testStop()
|
public function testStop()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "sleep(4);"');
|
||||||
$process->start();
|
$process->start();
|
||||||
$this->assertTrue($process->isRunning());
|
$this->assertTrue($process->isRunning());
|
||||||
$process->stop();
|
$process->stop();
|
||||||
@ -279,7 +279,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testIsNotSuccessful()
|
public function testIsNotSuccessful()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "sleep(4);"');
|
||||||
$process->start();
|
$process->start();
|
||||||
$this->assertTrue($process->isRunning());
|
$this->assertTrue($process->isRunning());
|
||||||
$process->stop();
|
$process->stop();
|
||||||
@ -314,7 +314,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "sleep(4);"');
|
||||||
$process->start();
|
$process->start();
|
||||||
$process->stop();
|
$process->stop();
|
||||||
$this->assertTrue($process->hasBeenSignaled());
|
$this->assertTrue($process->hasBeenSignaled());
|
||||||
@ -329,7 +329,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
// SIGTERM is only defined if pcntl extension is present
|
// SIGTERM is only defined if pcntl extension is present
|
||||||
$termSignal = defined('SIGTERM') ? SIGTERM : 15;
|
$termSignal = defined('SIGTERM') ? SIGTERM : 15;
|
||||||
|
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "sleep(4);"');
|
||||||
$process->start();
|
$process->start();
|
||||||
$process->stop();
|
$process->stop();
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Sleep doesn't work as it will allow the process to handle signals and close
|
// Sleep doesn't work as it will allow the process to handle signals and close
|
||||||
// file handles from the other end.
|
// file handles from the other end.
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "sleep 4"');
|
||||||
$process->start();
|
$process->start();
|
||||||
|
|
||||||
// PHP will deadlock when it tries to cleanup $process
|
// PHP will deadlock when it tries to cleanup $process
|
||||||
|
Reference in New Issue
Block a user