Skip to content

Commit 7d4f779

Browse files
committed
Skip bz2 GH-20807 test when less than 13 GiB of memory is available
The decompressed output of this test peaks at more than 12 GiB of RSS. On smaller machines, such as the 7 GB GitHub-hosted runners used for private repositories, this exhausts the whole VM and the OOM killer takes the test runner down with it, so the job dies with a runner shutdown signal instead of a test failure. Gate the test on MemAvailable from /proc/meminfo like the other resource-heavy tests gate on memory, so it keeps running on the 16 GB public runners and skips itself elsewhere.
1 parent 2cd1675 commit 7d4f779

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎ext/bz2/tests/gh20807.phpt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ if (PHP_OS === 'FreeBSD') die('skip Worker does not handle OOM gracefully');
1212
if (PHP_OS_FAMILY === 'Darwin') die('skip Too slow');
1313
if (PHP_INT_SIZE !== 8) die('skip Only for 64-bit systems');
1414
if (getenv('SKIP_ASAN')) die('skip ASAN makes this test too slow');
15+
// The decompressed output needs more than 12 GiB of memory at its peak, which
16+
// takes down smaller machines (e.g. 7 GB CI runners) with the OOM killer.
17+
$memInfo = @file_get_contents('/proc/meminfo');
18+
if ($memInfo && preg_match('/MemAvailable:\s+(\d+) kB/', $memInfo, $m) && $m[1] < 13 * 1024 * 1024) {
19+
die('skip Insufficient available memory (less than 13 GiB)');
20+
}
1521
?>
1622
--FILE--
1723
<?php

0 commit comments

Comments
 (0)