Skip to content

Commit 1973ca2

Browse files
committed
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`.
1 parent 2ecb468 commit 1973ca2

17 files changed

+61
-115
lines changed

ext/standard/tests/file/lstat_stat_error.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: error conditions
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. lstat() not available on Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );

ext/standard/tests/file/lstat_stat_variation1.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - effects of rename() on file
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. Not valid for Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );

ext/standard/tests/file/lstat_stat_variation10.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - effects of is_dir()
33
--SKIPIF--
44
<?php
55
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6-
if (substr(PHP_OS, 0, 3) == 'WIN') {
7-
die('skip.. Not valid for Windows');
8-
}
96
?>
107
--FILE--
118
<?php

ext/standard/tests/file/lstat_stat_variation11.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - effect of is_file()
33
--SKIPIF--
44
<?php
55
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6-
if (substr(PHP_OS, 0, 3) == 'WIN') {
7-
die('skip.. Not valid for Windows');
8-
}
96
?>
107
--FILE--
118
<?php

ext/standard/tests/file/lstat_stat_variation12.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ Test lstat() and stat() functions: usage variations - effects of is_link()
33
--SKIPIF--
44
<?php
55
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6-
if (substr(PHP_OS, 0, 3) == 'WIN') {
7-
die('skip.. lstat() not available on Windows');
6+
if (PHP_OS_FAMILY === 'Windows') {
7+
include_once __DIR__ . '/windows_links/common.inc';
8+
skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
89
}
910
?>
1011
--FILE--

ext/standard/tests/file/lstat_stat_variation13.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ Test lstat() and stat() functions: usage variations - file opened using w and r
33
--SKIPIF--
44
<?php
55
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6-
if (substr(PHP_OS, 0, 3) == 'WIN') {
7-
die('skip.. Not valid for Windows');
8-
}
96
?>
107
--FILE--
118
<?php

ext/standard/tests/file/lstat_stat_variation14.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - hardlink
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. lstat() not available on Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );

ext/standard/tests/file/lstat_stat_variation15.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ Test lstat() and stat() functions: usage variations - effects changing permissio
33
--SKIPIF--
44
<?php
55
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6-
if (substr(PHP_OS, 0, 3) == 'WIN') {
7-
die('skip.. lstat() not available on Windows');
6+
if (PHP_OS_FAMILY === 'Windows') {
7+
include_once __DIR__ . '/windows_links/common.inc';
8+
skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
89
}
910
?>
1011
--FILE--

ext/standard/tests/file/lstat_stat_variation18.phpt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - dir/file name stored in object
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. Not valid for Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );
@@ -85,9 +79,9 @@ array(26) {
8579
[10]=>
8680
int(%d)
8781
[11]=>
88-
int(%d)
82+
int(%i)
8983
[12]=>
90-
int(%d)
84+
int(%i)
9185
["dev"]=>
9286
int(%d)
9387
["ino"]=>
@@ -111,9 +105,9 @@ array(26) {
111105
["ctime"]=>
112106
int(%d)
113107
["blksize"]=>
114-
int(%d)
108+
int(%i)
115109
["blocks"]=>
116-
int(%d)
110+
int(%i)
117111
}
118112

119113
-- Testing stat() on directory name stored inside an object --
@@ -141,9 +135,9 @@ array(26) {
141135
[10]=>
142136
int(%d)
143137
[11]=>
144-
int(%d)
138+
int(%i)
145139
[12]=>
146-
int(%d)
140+
int(%i)
147141
["dev"]=>
148142
int(%d)
149143
["ino"]=>
@@ -167,9 +161,9 @@ array(26) {
167161
["ctime"]=>
168162
int(%d)
169163
["blksize"]=>
170-
int(%d)
164+
int(%i)
171165
["blocks"]=>
172-
int(%d)
166+
int(%i)
173167
}
174168

175169
--- Done ---

ext/standard/tests/file/lstat_stat_variation19.phpt

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - dir/file names in array
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. Not valid for Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );
@@ -86,9 +80,9 @@ array(26) {
8680
[10]=>
8781
int(%d)
8882
[11]=>
89-
int(%d)
83+
int(%i)
9084
[12]=>
91-
int(%d)
85+
int(%i)
9286
["dev"]=>
9387
int(%d)
9488
["ino"]=>
@@ -112,9 +106,9 @@ array(26) {
112106
["ctime"]=>
113107
int(%d)
114108
["blksize"]=>
115-
int(%d)
109+
int(%i)
116110
["blocks"]=>
117-
int(%d)
111+
int(%i)
118112
}
119113
array(26) {
120114
[0]=>
@@ -140,9 +134,9 @@ array(26) {
140134
[10]=>
141135
int(%d)
142136
[11]=>
143-
int(%d)
137+
int(%i)
144138
[12]=>
145-
int(%d)
139+
int(%i)
146140
["dev"]=>
147141
int(%d)
148142
["ino"]=>
@@ -166,9 +160,9 @@ array(26) {
166160
["ctime"]=>
167161
int(%d)
168162
["blksize"]=>
169-
int(%d)
163+
int(%i)
170164
["blocks"]=>
171-
int(%d)
165+
int(%i)
172166
}
173167

174168
-- Testing stat() on dir name stored inside an array --
@@ -196,9 +190,9 @@ array(26) {
196190
[10]=>
197191
int(%d)
198192
[11]=>
199-
int(%d)
193+
int(%i)
200194
[12]=>
201-
int(%d)
195+
int(%i)
202196
["dev"]=>
203197
int(%d)
204198
["ino"]=>
@@ -222,9 +216,9 @@ array(26) {
222216
["ctime"]=>
223217
int(%d)
224218
["blksize"]=>
225-
int(%d)
219+
int(%i)
226220
["blocks"]=>
227-
int(%d)
221+
int(%i)
228222
}
229223
array(26) {
230224
[0]=>
@@ -250,9 +244,9 @@ array(26) {
250244
[10]=>
251245
int(%d)
252246
[11]=>
253-
int(%d)
247+
int(%i)
254248
[12]=>
255-
int(%d)
249+
int(%i)
256250
["dev"]=>
257251
int(%d)
258252
["ino"]=>
@@ -276,9 +270,9 @@ array(26) {
276270
["ctime"]=>
277271
int(%d)
278272
["blksize"]=>
279-
int(%d)
273+
int(%i)
280274
["blocks"]=>
281-
int(%d)
275+
int(%i)
282276
}
283277

284278
--- Done ---

ext/standard/tests/file/lstat_stat_variation2.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - effects of rename() on dir
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. Not valid for Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );

ext/standard/tests/file/lstat_stat_variation20.phpt

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
Test lstat() and stat() functions: usage variations - link names stored in array/object
3-
--SKIPIF--
4-
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. lstat() not available on Windows');
7-
}
8-
?>
93
--FILE--
104
<?php
115
/* Prototype: array lstat ( string $filename );
@@ -88,9 +82,9 @@ array(26) {
8882
[10]=>
8983
int(%d)
9084
[11]=>
91-
int(%d)
85+
int(%i)
9286
[12]=>
93-
int(%d)
87+
int(%i)
9488
["dev"]=>
9589
int(%d)
9690
["ino"]=>
@@ -114,9 +108,9 @@ array(26) {
114108
["ctime"]=>
115109
int(%d)
116110
["blksize"]=>
117-
int(%d)
111+
int(%i)
118112
["blocks"]=>
119-
int(%d)
113+
int(%i)
120114
}
121115

122116
-- Testing stat() on link name stored inside an array --
@@ -144,9 +138,9 @@ array(26) {
144138
[10]=>
145139
int(%d)
146140
[11]=>
147-
int(%d)
141+
int(%i)
148142
[12]=>
149-
int(%d)
143+
int(%i)
150144
["dev"]=>
151145
int(%d)
152146
["ino"]=>
@@ -170,9 +164,9 @@ array(26) {
170164
["ctime"]=>
171165
int(%d)
172166
["blksize"]=>
173-
int(%d)
167+
int(%i)
174168
["blocks"]=>
175-
int(%d)
169+
int(%i)
176170
}
177171
array(26) {
178172
[0]=>
@@ -198,9 +192,9 @@ array(26) {
198192
[10]=>
199193
int(%d)
200194
[11]=>
201-
int(%d)
195+
int(%i)
202196
[12]=>
203-
int(%d)
197+
int(%i)
204198
["dev"]=>
205199
int(%d)
206200
["ino"]=>
@@ -224,9 +218,9 @@ array(26) {
224218
["ctime"]=>
225219
int(%d)
226220
["blksize"]=>
227-
int(%d)
221+
int(%i)
228222
["blocks"]=>
229-
int(%d)
223+
int(%i)
230224
}
231225
array(26) {
232226
[0]=>
@@ -252,9 +246,9 @@ array(26) {
252246
[10]=>
253247
int(%d)
254248
[11]=>
255-
int(%d)
249+
int(%i)
256250
[12]=>
257-
int(%d)
251+
int(%i)
258252
["dev"]=>
259253
int(%d)
260254
["ino"]=>
@@ -278,9 +272,9 @@ array(26) {
278272
["ctime"]=>
279273
int(%d)
280274
["blksize"]=>
281-
int(%d)
275+
int(%i)
282276
["blocks"]=>
283-
int(%d)
277+
int(%i)
284278
}
285279

286280
--- Done ---

ext/standard/tests/file/lstat_stat_variation22.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
77
if (substr(PHP_OS, 0, 3) == 'WIN') {
88
die('skip ... not for Windows');
99
}
10+
?>
1011
--CONFLICTS--
1112
obscure_filename
1213
--FILE--

ext/standard/tests/file/lstat_stat_variation3.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Test lstat() and stat() functions: usage variations - effects of rename() on link
33
--SKIPIF--
44
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip.. Not valid for Windows');
5+
if (PHP_OS_FAMILY === 'Windows') {
6+
include_once __DIR__ . '/windows_links/common.inc';
7+
skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
78
}
89
?>
910
--FILE--

0 commit comments

Comments
 (0)