From 87375fa2bea3e9f0aafaa31055059891d6852cab Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Wed, 1 Apr 2020 18:28:34 +0200 Subject: [PATCH] Skip fpm tests not designed to be run as root When running as root with TEST_FPM_RUN_AS_ROOT=1 --- sapi/fpm/tests/bug68391-conf-include-order.phpt | 1 + sapi/fpm/tests/proc-user-ignored.phpt | 1 + sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt | 1 + sapi/fpm/tests/tester.inc | 10 ++++++++++ 4 files changed, 13 insertions(+) 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-- --FILE-- --FILE-- --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 @@ -278,6 +278,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. */ -- 2.40.0