Add tests/oom_dump.phpt for the memory_limit auto-dump#6
Merged
Conversation
The phpt suite exercised rdump_dump() and the return value of rdump_set_oom_dump(), but nothing actually triggered the memory_limit path, so the OOM auto-dump hook itself was untested. Add a test that spawns a child which exhausts memory_limit with rdump.oom_dump set, then asserts from the parent that the extension auto-wrote a well-formed RDUMP file plus its .done marker. List the new file in package.xml so pecl packaging picks it up. https://claude.ai/code/session_0173cJdvKHwRMbKuMLMRxuqD
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.
What
Adds a phpt test that exercises the
memory_limitOOM auto-dump hook end to end, and lists it inpackage.xml.Why
The existing phpt suite covers
rdump_dump()and the return value ofrdump_set_oom_dump(), but nothing actually triggers thememory_limitpath — so the headline OOM auto-dump feature (thezend_error_cbhook firing on exhaustion) had no test of its own. CI'sbuild-and-test.shdoes smoke-test it, but there was no phpt that pins the behaviour.What it does
tests/oom_dump.phptspawns a child process that exhausts a 16 MBmemory_limitwithrdump.oom_dumpset, then asserts from the parent that the extension:Allowed memory sizeerror,rdump_dump()call in the child),.donecompletion marker (rdump.oom_dump_marker=1).A
memory_limitfatal terminates the process, so it can only be observed from a separate process — hence the child/parent split. TheSKIPIFguards on Linux, the builtmodules/rdump.so, andshell_execavailability.package.xmlgains the matching<file name="oom_dump.phpt" role="test"/>entry sopeclpackaging picks it up.Verification
Passes on PHP 8.4.19 (NTS and ZTS) and 7.4.33; full suite stays green (7/7).
https://claude.ai/code/session_0173cJdvKHwRMbKuMLMRxuqD
Generated by Claude Code