Skip to content

Commit fa9cbdf

Browse files
committed
Skip failing pcntl tests in Docker with insufficient caps
1 parent ab2dc66 commit fa9cbdf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ext/pcntl/tests/pcntl_setns_basic.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ posix
77
<?php
88
if (!function_exists("pcntl_setns")) die("skip pcntl_setns is not available");
99
if (getenv('SKIP_ASAN')) die('skip Timeouts under ASAN');
10+
if (@pcntl_setns(getmypid(), 0) === false && pcntl_get_last_error() == PCNTL_EPERM) {
11+
die("skip Insufficient privileges to use pcntl_setns()");
12+
}
1013
?>
1114
--FILE--
1215
<?php

ext/pcntl/tests/pcntl_setns_newpid.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ posix
66
--SKIPIF--
77
<?php
88
if (!function_exists("pcntl_setns")) die("skip pcntl_setns is not available");
9-
if (posix_getuid() !== 0) die('skip Test needs root user');
109
if (getenv('SKIP_ASAN')) die('skip Timeouts under ASAN');
10+
if (@pcntl_setns(getmypid(), 0) === false && pcntl_get_last_error() == PCNTL_EPERM) {
11+
die("skip Insufficient privileges to use pcntl_setns()");
12+
}
1113
?>
1214
--FILE--
1315
<?php

0 commit comments

Comments
 (0)