summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-07-02 13:17:57 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-07-02 15:36:07 +0200
commit1973ca21bd81032704608be20862d4f40c5b47c7 (patch)
tree984baf1f54b4a4143cd2aa52a85ba17be33afadd
parent2ecb4680ad60cd381bb360f93014ce739ed1a9f8 (diff)
downloadphp-git-1973ca21bd81032704608be20862d4f40c5b47c7.tar.gz
Enable most lstat_stat_* tests on Windows
Most of these have been skipped on Windows for no good reason (`lstat` is available there as of PHP 4). Several others would only fail, because the `blksize` and `blocks` elements are always `-1` on Windows, which can easily be fixed by using `%i` format specifiers instead of `%d`.
-rw-r--r--ext/standard/tests/file/lstat_stat_error.phpt6
-rw-r--r--ext/standard/tests/file/lstat_stat_variation1.phpt6
-rw-r--r--ext/standard/tests/file/lstat_stat_variation10.phpt3
-rw-r--r--ext/standard/tests/file/lstat_stat_variation11.phpt3
-rw-r--r--ext/standard/tests/file/lstat_stat_variation12.phpt5
-rw-r--r--ext/standard/tests/file/lstat_stat_variation13.phpt3
-rw-r--r--ext/standard/tests/file/lstat_stat_variation14.phpt6
-rw-r--r--ext/standard/tests/file/lstat_stat_variation15.phpt5
-rw-r--r--ext/standard/tests/file/lstat_stat_variation18.phpt22
-rw-r--r--ext/standard/tests/file/lstat_stat_variation19.phpt38
-rw-r--r--ext/standard/tests/file/lstat_stat_variation2.phpt6
-rw-r--r--ext/standard/tests/file/lstat_stat_variation20.phpt38
-rw-r--r--ext/standard/tests/file/lstat_stat_variation22.phpt1
-rw-r--r--ext/standard/tests/file/lstat_stat_variation3.phpt5
-rw-r--r--ext/standard/tests/file/lstat_stat_variation4.phpt3
-rw-r--r--ext/standard/tests/file/lstat_stat_variation6.phpt17
-rw-r--r--ext/standard/tests/file/lstat_stat_variation7.phpt9
17 files changed, 61 insertions, 115 deletions
diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt
index 543e296ec2..fe0c8a978b 100644
--- a/ext/standard/tests/file/lstat_stat_error.phpt
+++ b/ext/standard/tests/file/lstat_stat_error.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: error conditions
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
diff --git a/ext/standard/tests/file/lstat_stat_variation1.phpt b/ext/standard/tests/file/lstat_stat_variation1.phpt
index e7aa778ade..c6054f8f94 100644
--- a/ext/standard/tests/file/lstat_stat_variation1.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation1.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - effects of rename() on file
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt
index e1f4ed0376..ca4a170e12 100644
--- a/ext/standard/tests/file/lstat_stat_variation10.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation10.phpt
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - effects of is_dir()
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt
index 9a394ae7e9..8fbfd99ef7 100644
--- a/ext/standard/tests/file/lstat_stat_variation11.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation11.phpt
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - effect of is_file()
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/lstat_stat_variation12.phpt b/ext/standard/tests/file/lstat_stat_variation12.phpt
index eada799cdf..08e870a6de 100644
--- a/ext/standard/tests/file/lstat_stat_variation12.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation12.phpt
@@ -3,8 +3,9 @@ Test lstat() and stat() functions: usage variations - effects of is_link()
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
+if (PHP_OS_FAMILY === 'Windows') {
+ include_once __DIR__ . '/windows_links/common.inc';
+ skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
}
?>
--FILE--
diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt
index 22694240f5..2ff25c2f9c 100644
--- a/ext/standard/tests/file/lstat_stat_variation13.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation13.phpt
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - file opened using w and r
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/lstat_stat_variation14.phpt b/ext/standard/tests/file/lstat_stat_variation14.phpt
index f340d57f37..67d64b79a1 100644
--- a/ext/standard/tests/file/lstat_stat_variation14.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation14.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - hardlink
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
diff --git a/ext/standard/tests/file/lstat_stat_variation15.phpt b/ext/standard/tests/file/lstat_stat_variation15.phpt
index 467c0ef551..106b9fd8ad 100644
--- a/ext/standard/tests/file/lstat_stat_variation15.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation15.phpt
@@ -3,8 +3,9 @@ Test lstat() and stat() functions: usage variations - effects changing permissio
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
+if (PHP_OS_FAMILY === 'Windows') {
+ include_once __DIR__ . '/windows_links/common.inc';
+ skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
}
?>
--FILE--
diff --git a/ext/standard/tests/file/lstat_stat_variation18.phpt b/ext/standard/tests/file/lstat_stat_variation18.phpt
index 7b83d15547..56fe90d16f 100644
--- a/ext/standard/tests/file/lstat_stat_variation18.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation18.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - dir/file name stored in object
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
@@ -85,9 +79,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -111,9 +105,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
-- Testing stat() on directory name stored inside an object --
@@ -141,9 +135,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -167,9 +161,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation19.phpt b/ext/standard/tests/file/lstat_stat_variation19.phpt
index 8a2126737f..122b4062bb 100644
--- a/ext/standard/tests/file/lstat_stat_variation19.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation19.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - dir/file names in array
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
@@ -86,9 +80,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -112,9 +106,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
array(26) {
[0]=>
@@ -140,9 +134,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -166,9 +160,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
-- Testing stat() on dir name stored inside an array --
@@ -196,9 +190,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -222,9 +216,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
array(26) {
[0]=>
@@ -250,9 +244,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -276,9 +270,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation2.phpt b/ext/standard/tests/file/lstat_stat_variation2.phpt
index 61a9e196cc..8bf7dc1959 100644
--- a/ext/standard/tests/file/lstat_stat_variation2.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation2.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - effects of rename() on dir
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
diff --git a/ext/standard/tests/file/lstat_stat_variation20.phpt b/ext/standard/tests/file/lstat_stat_variation20.phpt
index 8567c4e7c2..c6c2e3e6ae 100644
--- a/ext/standard/tests/file/lstat_stat_variation20.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation20.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - link names stored in array/object
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
@@ -88,9 +82,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -114,9 +108,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
-- Testing stat() on link name stored inside an array --
@@ -144,9 +138,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -170,9 +164,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
array(26) {
[0]=>
@@ -198,9 +192,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -224,9 +218,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
array(26) {
[0]=>
@@ -252,9 +246,9 @@ array(26) {
[10]=>
int(%d)
[11]=>
- int(%d)
+ int(%i)
[12]=>
- int(%d)
+ int(%i)
["dev"]=>
int(%d)
["ino"]=>
@@ -278,9 +272,9 @@ array(26) {
["ctime"]=>
int(%d)
["blksize"]=>
- int(%d)
+ int(%i)
["blocks"]=>
- int(%d)
+ int(%i)
}
--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt
index 3558397131..9d8f3d3f01 100644
--- a/ext/standard/tests/file/lstat_stat_variation22.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation22.phpt
@@ -7,6 +7,7 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip ... not for Windows');
}
+?>
--CONFLICTS--
obscure_filename
--FILE--
diff --git a/ext/standard/tests/file/lstat_stat_variation3.phpt b/ext/standard/tests/file/lstat_stat_variation3.phpt
index 962f1df5b2..7f11619f7e 100644
--- a/ext/standard/tests/file/lstat_stat_variation3.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation3.phpt
@@ -2,8 +2,9 @@
Test lstat() and stat() functions: usage variations - effects of rename() on link
--SKIPIF--
<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
+if (PHP_OS_FAMILY === 'Windows') {
+ include_once __DIR__ . '/windows_links/common.inc';
+ skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
}
?>
--FILE--
diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt
index fe8b61e5ca..2d41fba19d 100644
--- a/ext/standard/tests/file/lstat_stat_variation4.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation4.phpt
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - effects of touch() on file
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/lstat_stat_variation6.phpt b/ext/standard/tests/file/lstat_stat_variation6.phpt
index b4dc684eb1..986dd8d3b4 100644
--- a/ext/standard/tests/file/lstat_stat_variation6.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation6.phpt
@@ -3,17 +3,18 @@ Test lstat() and stat() functions: usage variations - effects of touch() on link
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (!(stristr(PHP_OS, 'linux'))) {
- die('skip.. test valid for linux only');
-}
+if (PHP_OS_FAMILY === 'Windows') {
+ include_once __DIR__ . '/windows_links/common.inc';
+ skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
+} else {
// checking for atime update whether it is enabled or disabled
-exec("mount", $mount_output);
-foreach( $mount_output as $out ) {
- if( stristr($out, "noatime") )
- die('skip.. atime update is disabled, hence skip the test');
+ exec("mount", $mount_output);
+ foreach( $mount_output as $out ) {
+ if( stristr($out, "noatime") )
+ die('skip.. atime update is disabled, hence skip the test');
+ }
}
-
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/lstat_stat_variation7.phpt b/ext/standard/tests/file/lstat_stat_variation7.phpt
index 1ec0999f6c..f3aaec2275 100644
--- a/ext/standard/tests/file/lstat_stat_variation7.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation7.phpt
@@ -1,11 +1,5 @@
--TEST--
Test lstat() and stat() functions: usage variations - writing data into file
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
@@ -29,7 +23,8 @@ echo "*** Testing stat() on file after data is written in it ***\n";
$fh = fopen($file_name,"w");
$old_stat = stat($file_name);
clearstatcache();
-fwrite($fh, str_repeat("Hello World", $old_stat['blksize']));
+$blksize = PHP_OS_FAMILY === 'Windows' ? 4096 : $old_stat['blksize'];
+fwrite($fh, str_repeat("Hello World", $blksize));
$new_stat = stat($file_name);
// compare self stats