Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More gracefully handle crashes in pytest.
When the pytest executable is executing, there is some possibility that it can crash (due to a bug in C extensions, for instance). In the current code, this circumstance causes the main colcon property to return a non-zero exit number. But that doesn't seem correct; colcon didn't fail, one of the tests did. The test should be marked as failing, but colcon itself should return a success code. Additionally, we notice that if a e.g. ctest test crashes, colcon returns 0. The reason this happens only with pytest is because pytest doesn't have a mechanism to suppress these kinds of errors. Thus if the python interpreter in the pytest process crashes, pytest returns the segmentation fault number (-11 on Linux, 0xc0000005 on Windows). Handle this by explicitly capturing this fault number, and setting the test to failed. Unfortunately there are no convenient constants in Python that I could find for these numbers, so they are hardcoded here. This does change the user-visible functioning of colcon, but I believe it does so for the better, and it is a bit of a corner case. Signed-off-by: Chris Lalancette <[email protected]>
- Loading branch information