diff --git a/package.xml b/package.xml index 5e194da..1c7f31b 100644 --- a/package.xml +++ b/package.xml @@ -46,6 +46,7 @@ Initial release. + diff --git a/tests/oom_dump.phpt b/tests/oom_dump.phpt new file mode 100644 index 0000000..d3aa266 --- /dev/null +++ b/tests/oom_dump.phpt @@ -0,0 +1,57 @@ +--TEST-- +rdump.oom_dump writes a well-formed RDUMP dump when memory_limit is exhausted +--SKIPIF-- + +--FILE-- +&1"; +$output = (string) shell_exec($cmd); + +// The child died on the memory_limit error... +var_dump(strpos($output, "Allowed memory size") !== false); + +// ...and the OOM hook wrote the dump without any rdump_dump() call. +var_dump(is_file($dump)); + +// The dump is a well-formed RDUMP file. +var_dump(file_get_contents($dump, false, null, 0, 8) === "RDUMP\0\0\0"); + +// The completion marker was written (rdump.oom_dump_marker=1). +var_dump(is_file($dump . ".done")); + +@unlink($dump); +@unlink($dump . ".done"); +@unlink($child); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true)