diff options
author | Matteo Beccati <mbeccati@php.net> | 2020-04-01 18:28:34 +0200 |
---|---|---|
committer | Matteo Beccati <mbeccati@php.net> | 2020-04-02 16:16:42 +0200 |
commit | 87375fa2bea3e9f0aafaa31055059891d6852cab (patch) | |
tree | 1fbe04f668d9dd0809fba284126f5801037a024d | |
parent | af337ae47e7b66d8c8edcd0abb1d05f530998f42 (diff) | |
download | php-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.phpt | 1 | ||||
-rw-r--r-- | sapi/fpm/tests/proc-user-ignored.phpt | 1 | ||||
-rw-r--r-- | sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt | 1 | ||||
-rw-r--r-- | sapi/fpm/tests/tester.inc | 10 |
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() |