Skip to content

Add tests/oom_dump.phpt for the memory_limit auto-dump#6

Merged
sj-i merged 1 commit into
mainfrom
claude/test-oom-dump
May 30, 2026
Merged

Add tests/oom_dump.phpt for the memory_limit auto-dump#6
sj-i merged 1 commit into
mainfrom
claude/test-oom-dump

Conversation

@sj-i
Copy link
Copy Markdown
Member

@sj-i sj-i commented May 30, 2026

What

Adds a phpt test that exercises the memory_limit OOM auto-dump hook end to end, and lists it in package.xml.

Why

The existing phpt suite covers rdump_dump() and the return value of rdump_set_oom_dump(), but nothing actually triggers the memory_limit path — so the headline OOM auto-dump feature (the zend_error_cb hook firing on exhaustion) had no test of its own. CI's build-and-test.sh does smoke-test it, but there was no phpt that pins the behaviour.

What it does

tests/oom_dump.phpt spawns a child process that exhausts a 16 MB memory_limit with rdump.oom_dump set, then asserts from the parent that the extension:

  • died on the Allowed memory size error,
  • auto-wrote the dump (no rdump_dump() call in the child),
  • wrote a well-formed RDUMP file (magic check), and
  • wrote the .done completion marker (rdump.oom_dump_marker=1).

A memory_limit fatal terminates the process, so it can only be observed from a separate process — hence the child/parent split. The SKIPIF guards on Linux, the built modules/rdump.so, and shell_exec availability.

package.xml gains the matching <file name="oom_dump.phpt" role="test"/> entry so pecl packaging 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

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
@sj-i sj-i merged commit 2b0d48e into main May 30, 2026
104 checks passed
@sj-i sj-i deleted the claude/test-oom-dump branch May 30, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants