Skip to content

fs.test.test.setEndPos fails with expected error.FileTooBig, found void #24242

Closed
@ilumys

Description

@ilumys

Zig Version

0.15.0-dev.864+75d0ec9c0

Steps to Reproduce and Observed Behavior

Builing on Linux 6.12.34-1-lts x86_64 with:

cmake -DCMAKE_BUILD_TYPE=Release -GNinja -DZIG_NO_LIB=ON ..
ninja install

Build test-std:

stage3/bin/zig build test-std -Dskip-release -Dskip-non-native

test-std
└─ run test std-native-znver4-Debug-single 2834/2893 passed, 1 failed, 58 skipped
error: 'fs.test.test.setEndPos' failed: expected error.FileTooBig, found void
???:?:?: 0x36b66c5 in ??? (exe)
???:?:?: 0x36b839a in ??? (exe)
error: while executing test 'zig.system.darwin.macos.test.detect', the following test command failed:
/home/user/zig/.zig-cache/o/2dc0be630d170164e823c519c19d7c9a/test --cache-dir=/home/user/zig/.zig-cache --seed=0x49602933 --listen=-
test-std
└─ run test std-native-znver4-Debug 2863/2893 passed, 1 failed, 29 skipped
error: 'fs.test.test.setEndPos' failed: expected error.FileTooBig, found void
???:?:?: 0x370bf95 in ??? (exe)
???:?:?: 0x370dc6a in ??? (exe)
error: while executing test 'zig.system.darwin.macos.test.detect', the following test command failed:
/home/user/zig/.zig-cache/o/adf4cfe907fcc0c231d25620d9f75f60/test --cache-dir=/home/user/zig/.zig-cache --seed=0x49602933 --listen=-
test-std
└─ run test std-native-znver4-Debug-libc 2863/2893 passed, 1 failed, 29 skipped
error: 'fs.test.test.setEndPos' failed: expected error.FileTooBig, found void
???:?:?: 0x36f680b in ??? ()
???:?:?: 0x36f84de in ??? ()
error: while executing test 'zig.system.darwin.macos.test.detect', the following test command failed:
/home/user/zig/.zig-cache/o/440506bfc9ad1be8c53e2eee7a98b165/test --cache-dir=/home/user/zig/.zig-cache --seed=0x49602933 --listen=-
Build Summary: 3/7 steps succeeded; 3 failed; 8560/8679 tests passed; 116 skipped; 3 failed
test-std transitive failure
├─ run test std-native-znver4-Debug 2863/2893 passed, 1 failed, 29 skipped
├─ run test std-native-znver4-Debug-libc 2863/2893 passed, 1 failed, 29 skipped
└─ run test std-native-znver4-Debug-single 2834/2893 passed, 1 failed, 58 skipped
error: the following build command failed with exit code 1:
/home/user/zig/.zig-cache/o/230b090561fe2e87824f37da3732e158/build /home/user/zig/build/stage3/bin/zig /home/user/zig/lib /home/user/zig /home/user/zig/.zig-cache /home/user/.cache/zig --seed 0x49602933 -Zc5eaf0352eb9fb8d test-std -Dskip-release -Dskip-non-native

This is the same when checking out commit 2210c4c where the test was added, though as 0.15.x fails this was tested using 0.14.1. Similarly tested on a debug build.

Expected Behavior

Tests should pass.


Troubleshooting and attempted resolution:

Looking at change history this test was introduced to fix #22960, with the specific test being

try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63))); // Maximum signed value

As it is casting u64 to i64, it was proposed to check for size values exceeding u63 max. Tests presently check against u63 and u64 max.

Changing to check where the value exceeds u63 as below has resolved this in my testing:

try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63) + 1));

Remaining concern is only that CI tests are returning success on a larger test suite where my usage (local and on remote machines) returns this failure. As well, if the + 1 is adequate.

(or, less likely but not having looked into it, the setEndPos() impl must be amended)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions