diff options
author | Zoe Slattery <zoe@php.net> | 2007-06-14 15:40:06 +0000 |
---|---|---|
committer | Zoe Slattery <zoe@php.net> | 2007-06-14 15:40:06 +0000 |
commit | c73237b7b9d5a54256a64f2ca09577cb82e80554 (patch) | |
tree | f896e7c136899222804e8afb3eb2dba26ad13524 | |
parent | 3b27cd22b62a126a13d1904ac744d677529f04d7 (diff) | |
download | php-git-c73237b7b9d5a54256a64f2ca09577cb82e80554.tar.gz |
Tests are not valid if run by root - adding check to skip is user is root.
-rw-r--r-- | ext/standard/tests/file/is_executable_basic.phpt | 11 | ||||
-rw-r--r-- | ext/standard/tests/file/is_executable_variation.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/file/is_readable_basic.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/file/is_readable_variation.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/file/is_writable_basic.phpt | 13 | ||||
-rw-r--r-- | ext/standard/tests/file/is_writable_variation.phpt | 10 | ||||
-rw-r--r-- | ext/standard/tests/file/mkdir_rmdir_variation.phpt | 10 |
7 files changed, 74 insertions, 0 deletions
diff --git a/ext/standard/tests/file/is_executable_basic.phpt b/ext/standard/tests/file/is_executable_basic.phpt index 091aca7d78..895f16e1e0 100644 --- a/ext/standard/tests/file/is_executable_basic.phpt +++ b/ext/standard/tests/file/is_executable_basic.phpt @@ -5,6 +5,17 @@ Test is_executable() function: basic functionality if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for LINUX'); } + +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/is_executable_variation.phpt b/ext/standard/tests/file/is_executable_variation.phpt index c346150e0c..9e4a32cfeb 100644 --- a/ext/standard/tests/file/is_executable_variation.phpt +++ b/ext/standard/tests/file/is_executable_variation.phpt @@ -5,6 +5,16 @@ Test is_executable() function: usage variations if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for LINUX'); } +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/is_readable_basic.phpt b/ext/standard/tests/file/is_readable_basic.phpt index f5910e6a6b..f656f3d16d 100644 --- a/ext/standard/tests/file/is_readable_basic.phpt +++ b/ext/standard/tests/file/is_readable_basic.phpt @@ -5,6 +5,16 @@ Test is_readable() function: basic functionality if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for LINUX'); } +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/is_readable_variation.phpt b/ext/standard/tests/file/is_readable_variation.phpt index 68c3bcb8ae..ee4a51d09a 100644 --- a/ext/standard/tests/file/is_readable_variation.phpt +++ b/ext/standard/tests/file/is_readable_variation.phpt @@ -5,6 +5,16 @@ Test is_readable() function: usage variations if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for LINUX'); } +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/is_writable_basic.phpt b/ext/standard/tests/file/is_writable_basic.phpt index 0576e738b5..27d14dd070 100644 --- a/ext/standard/tests/file/is_writable_basic.phpt +++ b/ext/standard/tests/file/is_writable_basic.phpt @@ -1,5 +1,18 @@ --TEST-- Test is_writable() and its alias is_writeable() function: basic functionality +--SKIPIF-- +<?php +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); +?> --FILE-- <?php /* Prototype: bool is_writable ( string $filename ); diff --git a/ext/standard/tests/file/is_writable_variation.phpt b/ext/standard/tests/file/is_writable_variation.phpt index b19df2daf3..e46aaa30b8 100644 --- a/ext/standard/tests/file/is_writable_variation.phpt +++ b/ext/standard/tests/file/is_writable_variation.phpt @@ -4,7 +4,17 @@ Test is_writable() and its alias is_writeable() function: usage variations <?php if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only on LINUX'); +} +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); } + +unlink($filename); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/mkdir_rmdir_variation.phpt b/ext/standard/tests/file/mkdir_rmdir_variation.phpt index 9d1f1e2f44..89faf9c414 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation.phpt @@ -5,6 +5,16 @@ Test mkdir() and rmdir() functions: usage variations if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only on LINUX'); } +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- <?php |