mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
lib/std/fs/test.zig: Some filesystems support 8 EiB files
Btrfs at least supports 16 EiB files (limited in practice to 8EiB by the Linux VFS code which uses signed 64-bit offsets). So fix the fs.zig test case to expect either a FileTooBig or success from truncating a file to 8EiB. And test that beyond that size the offset is interpreted as a negative number. Fixes #24242
This commit is contained in:
parent
640a130651
commit
710632b45c
1 changed files with 6 additions and 3 deletions
|
|
@ -1435,14 +1435,17 @@ test "setEndPos" {
|
|||
try testing.expectEqual(0, try f.preadAll(&buffer, 0));
|
||||
|
||||
// Invalid file length should error gracefully. Actual limit is host
|
||||
// and file-system dependent, but 1PB should fail most everywhere.
|
||||
// Except MacOS APFS limit is 8 exabytes.
|
||||
// and file-system dependent, but 1PB should fail on filesystems like
|
||||
// EXT4 and NTFS. But XFS or Btrfs support up to 8EiB files.
|
||||
f.setEndPos(0x4_0000_0000_0000) catch |err| if (err != error.FileTooBig) {
|
||||
return err;
|
||||
};
|
||||
|
||||
try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63))); // Maximum signed value
|
||||
f.setEndPos(std.math.maxInt(u63)) catch |err| if (err != error.FileTooBig) {
|
||||
return err;
|
||||
};
|
||||
|
||||
try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63) + 1));
|
||||
try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u64)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue