Skip to content

Commit 87375fa

Browse files
committed
Skip fpm tests not designed to be run as root
When running as root with TEST_FPM_RUN_AS_ROOT=1
1 parent af337ae commit 87375fa

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

sapi/fpm/tests/bug68391-conf-include-order.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FPM: bug68391 - Configuration inclusion in alphabetical order
33
--SKIPIF--
44
<?php
55
include "skipif.inc";
6+
FPM\Tester::skipIfRoot();
67
?>
78
--FILE--
89
<?php

sapi/fpm/tests/proc-user-ignored.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FPM: Process user setting ignored when FPM is not running as root
33
--SKIPIF--
44
<?php
55
include "skipif.inc";
6+
FPM\Tester::skipIfRoot();
67
?>
78
--FILE--
89
<?php

sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FPM: UNIX socket owner and group settings can be numeric
33
--SKIPIF--
44
<?php
55
include "skipif.inc";
6+
FPM\Tester::skipIfRoot();
67
FPM\Tester::skipIfPosixNotLoaded();
78
?>
89
--FILE--

sapi/fpm/tests/tester.inc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,16 @@ class Tester
278278
}
279279
}
280280

281+
/**
282+
* Skip if running as root.
283+
*/
284+
static public function skipIfRoot()
285+
{
286+
if (getmyuid() == 0) {
287+
die('skip running as root');
288+
}
289+
}
290+
281291
/**
282292
* Skip if posix extension not loaded.
283293
*/

0 commit comments

Comments
 (0)