Repository navigation
Fix test_fs_writev_gather and test_fs_readv_eagain under WasmFS - #28319
Merged
Merged
Conversation
These two tests were added in emscripten-core#27284 and emscripten-core#27286 and assume that `writev` gathers all its iovecs into a single write on the underlying device, which is how the JS filesystem behaves. WasmFS instead writes each iovec separately (returning a short write if a later one fails), so both tests fail there: wasmfs.test_fs_writev_gather: Aborted(expected a single 8-byte gather write) Aborted(Assertion failed: nwritten == 8, at: test/fs/test_writev_gather.c,42,main) wasmfs.test_fs_readv_eagain: Aborted(Assertion failed: nwrite == 8, at: test/fs/test_readv_eagain.c,72,main) - test_fs_writev_gather only tests the gathering behaviour, so disable it under WasmFS. - In test_fs_readv_eagain, expect the write of the first iovec to succeed and the second one to would-block under WasmFS, which results in a partial write of 4 bytes rather than EAGAIN. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request enables and adapts the test_fs_readv_eagain test for WasmFS, and disables test_fs_writev_gather under WasmFS due to differences in how writev is handled. The reviewer noted that the preprocessor macro WASMFS is incorrect and should be replaced with __EMSCRIPTEN_WASMFS__ to ensure the WasmFS-specific assertion is correctly evaluated.
WasmFS not gathering iovecs is a limitation of its backend interface (backends only see single-buffer reads/writes) rather than intended behaviour. Link to the tracking issue emscripten-core#16269. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Collaborator
|
@guybedford WDYT? |
Collaborator
|
Ideally the fix for this would be resolving #16269 I think? Find to land as a stopgap though, as long as we aren't codifying this pattern. |
juj
enabled auto-merge (squash)
November 18, 2026 23:37
sbc100
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These two tests were added in #27284 and #27286 and assume that
writevgathers all its iovecs into a single write on the underlying device, which is how the JS filesystem behaves. WasmFS instead writes each iovec separately (returning a short write if a later one fails), so both tests fail there:wasmfs.test_fs_writev_gather:
Aborted(expected a single 8-byte gather write)
Aborted(Assertion failed: nwritten == 8, at: test/fs/test_writev_gather.c,42,main)
wasmfs.test_fs_readv_eagain:
Aborted(Assertion failed: nwrite == 8, at: test/fs/test_readv_eagain.c,72,main)