]> granicus.if.org Git - php/commitdiff
Skip fpm tests not designed to be run as root
authorMatteo Beccati <mbeccati@php.net>
Wed, 1 Apr 2020 16:28:34 +0000 (18:28 +0200)
committerMatteo Beccati <mbeccati@php.net>
Thu, 2 Apr 2020 14:16:42 +0000 (16:16 +0200)
When running as root with TEST_FPM_RUN_AS_ROOT=1

sapi/fpm/tests/bug68391-conf-include-order.phpt
sapi/fpm/tests/proc-user-ignored.phpt
sapi/fpm/tests/socket-uds-numeric-ugid-nonroot.phpt
sapi/fpm/tests/tester.inc

index 012a978f298e4ec9194ad02f787c7c44f44780b0..a357cf8bd33b59c0ee6a16021f3cb4794bb12652 100644 (file)
@@ -3,6 +3,7 @@ FPM: bug68391 - Configuration inclusion in alphabetical order
 --SKIPIF--
 <?php
 include "skipif.inc";
+FPM\Tester::skipIfRoot();
 ?>
 --FILE--
 <?php
index e1902af11bd8ceac5c8c63f012f8b1bc97cf5385..d99c4c264aa2c17cca98d95fbee543893da21244 100644 (file)
@@ -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
index a4d352123cc0b331a858f257620a5ca60cc39994..885fd4d075076bf3d8301f4badaaa7bba6cccef6 100644 (file)
@@ -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--
index d63e8a72505850609df904c5a44b50c4a03f00da..da5719b0648b293d3eab45264d7af0463b19695b 100644 (file)
@@ -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.
      */