summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2020-04-01 18:28:34 +0200
committerMatteo Beccati <mbeccati@php.net>2020-04-02 16:16:42 +0200
commit87375fa2bea3e9f0aafaa31055059891d6852cab (patch)
tree1fbe04f668d9dd0809fba284126f5801037a024d
parentaf337ae47e7b66d8c8edcd0abb1d05f530998f42 (diff)
downloadphp-git-87375fa2bea3e9f0aafaa31055059891d6852cab.tar.gz
Skip fpm tests not designed to be run as root
When running as root with TEST_FPM_RUN_AS_ROOT=1
-rw-r--r--sapi/fpm/tests/bug68391-conf-include-order.phpt1
-rw-r--r--sapi/fpm/tests/proc-user-ignored.phpt1
-rw-r--r--sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt1
-rw-r--r--sapi/fpm/tests/tester.inc10
4 files changed, 13 insertions, 0 deletions
diff --git a/sapi/fpm/tests/bug68391-conf-include-order.phpt b/sapi/fpm/tests/bug68391-conf-include-order.phpt
index 012a978f29..a357cf8bd3 100644
--- a/sapi/fpm/tests/bug68391-conf-include-order.phpt
+++ b/sapi/fpm/tests/bug68391-conf-include-order.phpt
@@ -3,6 +3,7 @@ FPM: bug68391 - Configuration inclusion in alphabetical order
--SKIPIF--
<?php
include "skipif.inc";
+FPM\Tester::skipIfRoot();
?>
--FILE--
<?php
diff --git a/sapi/fpm/tests/proc-user-ignored.phpt b/sapi/fpm/tests/proc-user-ignored.phpt
index e1902af11b..d99c4c264a 100644
--- a/sapi/fpm/tests/proc-user-ignored.phpt
+++ b/sapi/fpm/tests/proc-user-ignored.phpt
@@ -3,6 +3,7 @@ FPM: Process user setting ignored when FPM is not running as root
--SKIPIF--
<?php
include "skipif.inc";
+FPM\Tester::skipIfRoot();
?>
--FILE--
<?php
diff --git a/sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt b/sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt
index a4d352123c..885fd4d075 100644
--- a/sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt
+++ b/sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt
@@ -3,6 +3,7 @@ FPM: UNIX socket owner and group settings can be numeric
--SKIPIF--
<?php
include "skipif.inc";
+FPM\Tester::skipIfRoot();
FPM\Tester::skipIfPosixNotLoaded();
?>
--FILE--
diff --git a/sapi/fpm/tests/tester.inc b/sapi/fpm/tests/tester.inc
index d63e8a7250..da5719b064 100644
--- a/sapi/fpm/tests/tester.inc
+++ b/sapi/fpm/tests/tester.inc
@@ -279,6 +279,16 @@ class Tester
}
/**
+ * Skip if running as root.
+ */
+ static public function skipIfRoot()
+ {
+ if (getmyuid() == 0) {
+ die('skip running as root');
+ }
+ }
+
+ /**
* Skip if posix extension not loaded.
*/
static public function skipIfPosixNotLoaded()