Skip to content

Commit d2208a2

Browse files
tests: Raise test stack for stream error depth limit under MSan (#23985)
1 parent 37d0ef5 commit d2208a2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎ext/standard/tests/streams/stream_errors_operation_depth_limit.phpt‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,30 @@
22
Stream errors: operations refused by the depth limit keep the stack consistent
33
--INI--
44
zend.max_allowed_stack_size=-1
5+
--SKIPIF--
6+
<?php
7+
if (getenv('SKIP_MSAN')) {
8+
if (!function_exists('posix_setrlimit') || !defined('POSIX_RLIMIT_STACK')) {
9+
die('skip MSan needs a larger C stack');
10+
}
11+
[, $hard] = posix_getrlimit(POSIX_RLIMIT_STACK);
12+
if (($hard !== 'unlimited' && $hard < 32 * 1024 * 1024)
13+
|| !posix_setrlimit(POSIX_RLIMIT_STACK, 32 * 1024 * 1024, $hard === 'unlimited' ? -1 : $hard)) {
14+
die('skip MSan needs a larger C stack');
15+
}
16+
}
17+
?>
518
--FILE--
619
<?php
20+
// MSan needs more stack to reach the stream error operation limit.
21+
if (getenv('SKIP_MSAN') && function_exists('posix_setrlimit') && defined('POSIX_RLIMIT_STACK')) {
22+
[$soft, $hard] = posix_getrlimit(POSIX_RLIMIT_STACK);
23+
if ($soft !== 'unlimited' && $soft < 32 * 1024 * 1024
24+
&& ($hard === 'unlimited' || $hard >= 32 * 1024 * 1024)) {
25+
posix_setrlimit(POSIX_RLIMIT_STACK, 32 * 1024 * 1024, $hard === 'unlimited' ? -1 : $hard);
26+
}
27+
}
28+
729
class RecursiveStream
830
{
931
public $context;

0 commit comments

Comments
 (0)