minor #30882 [Lock][TestSuite]Ensure the parent process is always killed (greg0ire)

This PR was merged into the 4.2 branch.

Discussion
----------

[Lock][TestSuite]Ensure the parent process is always killed

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes, but for the test suite
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | n/a

If you try to run the test suite but do not have a redis instance
running, the parent process that was supposed to be killed will never be
as the test is marked as skipped and the store never returned.
This results in the test suite hanging forever at the end.
In this patch, the exception is thrown again, and then caught in the trait, and
the parent gets killed as it should.

Commits
-------

94d41825fd Ensure the parent process is always killed
This commit is contained in:
Fabien Potencier 2019-04-06 12:12:39 +02:00
commit 0268b1def7

View File

@ -74,8 +74,8 @@ trait BlockingStoreTestTrait
// Block SIGHUP signal
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
$store = $this->getStore();
try {
$store = $this->getStore();
$store->save($key);
// send the ready signal to the parent
posix_kill($parentPID, SIGHUP);
@ -87,7 +87,8 @@ trait BlockingStoreTestTrait
usleep($clockDelay);
$store->delete($key);
exit(0);
} catch (\Exception $e) {
} catch (\Throwable $e) {
posix_kill($parentPID, SIGHUP);
exit(1);
}
}