Skip to content

WasmFS: Allow the root to exist already - #19396

Merged
kripken merged 1 commit into
mainfrom
wasmfs.existing.root
May 19, 2023
Merged

WasmFS: Allow the root to exist already#19396
kripken merged 1 commit into
mainfrom
wasmfs.existing.root

Conversation

@kripken

@kripken kripken commented May 19, 2023

Copy link
Copy Markdown
Member

It's ok for the root to exist in some cases, e.g. if the preload hook created it
or if we use NODERAWFS which makes the root the normal underlying
filesystem.

This is necessary for NODERAWFS support in WasmFS, and will be tested in
that PR (to be opened shortly).

@kripken
kripken requested a review from tlively May 19, 2023 16:32
@kripken
kripken merged commit 7cff8f1 into main May 19, 2023
@kripken
kripken deleted the wasmfs.existing.root branch May 19, 2023 17:48
kripken added a commit that referenced this pull request May 22, 2023
This PR makes the NODERAWFS flag make the root directory be
created using the Node backend. That may not be 100% of what we
need for NODERAWFS but it gets a significant amount of tests
passing.

To do that, add a hook that backends can use to override creation of
the root directory. Then NODERAWFS support basically is just to link
in a tiny library that overrides that hook.

This adds a new test, test_noderawfs_wasmfs which verifies we write
files out to the normal filesystem. Also, enable test_freetype, which
now passes; previously it failed during a configure step (specifically,
configure tried to write the size of an integer to a file... before this
PR, the file was empty and it defined integer size as the empty string).
So test_freetype both verifies NODERAWFS writes, and also it uses
files internally (to read font files etc.) which seems useful to enable.

Also, this is tested in test_fs_writeFile_rawfs. That test does
FS.writeFile with NODERAWFS enabled. It passed before, because
enabling NODERAWFS did nothing... for WasmFS the test really just
worked on the MemoryFile backend, since it doesn't create a Node
backend. With this PR, the test properly uses Node files, and passes
(thanks to #19397 and #19396).

Note: other.test_unistd_fstatfs_wasmfs was removed from CI because
it was unnecessary - all other tests run anyhow. We only need to add
select wasmfs tests because that mode does not run in full already.
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.

2 participants