Add tests for signal death detection via proc_get_status#163
Closed
alies-dev wants to merge 2 commits intocomposer:mainfrom
Closed
Add tests for signal death detection via proc_get_status#163alies-dev wants to merge 2 commits intocomposer:mainfrom
alies-dev wants to merge 2 commits intocomposer:mainfrom
Conversation
Add SignalExitCodeTest that demonstrates: - proc_close returns raw signal numbers (e.g. 15 for SIGTERM, 11 for SIGSEGV), indistinguishable from normal exit codes - proc_get_status polling correctly identifies signal deaths via the signaled/termsig fields, enabling the conventional 128+signal exit code computation - Normal exit codes are preserved with both methods These tests validate the mechanism used in the doRestart() fix and will fail if that fix is reverted. See php/php-src#21292
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
SignalExitCodeTestas requested in #162 (comment) by @keradus — tests that prove theproc_get_statuspolling fix is necessary and would fail if reverted.What the tests prove
testProcCloseReturnsRawSignalNumber—proc_closereturns raw signal number (15 for SIGTERM), indistinguishable fromexit(15)testProcGetStatusDetectsSignalDeath—proc_get_statuscorrectly identifies signal death viasignaled/termsigfields, enabling128 + signalcomputationtestProcGetStatusDetectsSegfault— Same for SIGSEGV (signal 11 → exit code 139), the most common crash scenariotestProcCloseReturnsRawSignalNumberForSegfault—proc_closealone returns 11, same asexit(11)testNormalExitCodeIsPreserved— Normal exit codes work correctly with both methodsTests are skipped on Windows (signals work differently) and when the
posixextension is unavailable.Relationship to #162
This PR provides the test coverage for the fix in #162. It is based on
main(not on thedetect-crash-signalsbranch) to clearly show the tests validate the mechanism —proc_get_statusvsproc_close— independent of the fix itself. The tests can be merged intodetect-crash-signalsor landed alongside it.See php/php-src#21292