diff options
| author | Pat Tullmann <pat.github@tullmann.org> | 2025-06-22 20:48:35 -0700 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-23 15:20:24 +0200 |
| commit | 710632b45cd7a7081af82af418eb3e405f7aa35e (patch) | |
| tree | 00eb10fdf4662357e7ee57773932e36cb74d68d3 /lib | |
| parent | 640a130651ee39f8d8f5afc9498574c10af18ba9 (diff) | |
| download | zig-710632b45cd7a7081af82af418eb3e405f7aa35e.tar.gz zig-710632b45cd7a7081af82af418eb3e405f7aa35e.zip | |
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
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/fs/test.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig index 6593e7024d..99b6dd3920 100644 --- a/lib/std/fs/test.zig +++ b/lib/std/fs/test.zig @@ -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))); } |
