Skip to content

Commit bab9e34

Browse files
committedNov 16, 2022
Change conditional check in disk_free_space() test
As the notion of free space is fuzzy on some filesystems (such as BTRFS) we check that the disk space after adding a file is less or equal than before This closes Bug #80629
1 parent dbf54e1 commit bab9e34

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎ext/standard/tests/file/disk_free_space_basic.phpt

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var_dump( diskfreespace($file_path) );
1717
echo "*** Testing with newly created directory ***\n";
1818
$dir = "/disk_free_space";
1919
mkdir($file_path.$dir);
20-
echo" \n Free Space before writing to a file\n";
20+
echo "\n Free Space before writing to a file\n";
2121
$space1 = disk_free_space($file_path.$dir);
2222
var_dump( $space1 );
2323

@@ -30,7 +30,8 @@ echo "\n Free Space after writing to a file\n";
3030
$space2 = disk_free_space($file_path.$dir);
3131
var_dump( $space2 );
3232

33-
if($space1 > $space2 )
33+
// Some file systems (like BTRFS) have a fuzzy notion of "free space" and will thus claim the same amount of free space
34+
if ($space1 >= $space2)
3435
echo "\n Free Space Value Is Correct\n";
3536
else {
3637
echo "\n Free Space Value Is Incorrect\n";
@@ -53,7 +54,7 @@ rmdir($file_path."/disk_free_space");
5354
float(%f)
5455
float(%f)
5556
*** Testing with newly created directory ***
56-
57+
5758
Free Space before writing to a file
5859
float(%f)
5960

0 commit comments

Comments
 (0)
Please sign in to comment.