Skip to content

Fix test_fs_writev_gather and test_fs_readv_eagain under WasmFS - #28319

Merged
juj merged 3 commits into
emscripten-core:mainfrom
juj:fix_wasmfs_writev_readv
Nov 19, 2026
Merged

juj merged 3 commits into
emscripten-core:mainfrom
juj:fix_wasmfs_writev_readv

Conversation

@juj

@juj juj commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

These two tests were added in #27284 and #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.

juj and others added 2 commits November 19, 2026 01:14
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]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/fs/test_readv_eagain.c Resolved
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]>
@sbc100
sbc100 requested a review from guybedford November 18, 2026 23:26
@sbc100

sbc100 commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

@guybedford WDYT?

@guybedford

Copy link
Copy Markdown
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
juj enabled auto-merge (squash) November 18, 2026 23:37
@juj
juj merged commit c15c54c into emscripten-core:main Nov 19, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants