[WasmFS] Skip root directory setup under NODERAWFS#26607
Conversation
| virtual std::shared_ptr<Directory> createDirectory(mode_t mode) = 0; | ||
| virtual std::shared_ptr<Symlink> createSymlink(std::string target) = 0; | ||
|
|
||
| virtual bool shouldMountSpecialFiles() { return true; } |
There was a problem hiding this comment.
I was thinking maybe shouldPopulateRoot, but maybe your name is more explicit?
There was a problem hiding this comment.
This function name was mentioned in comment #24733 (comment). But I'd like shouldPopulateRoot as well.
There was a problem hiding this comment.
Changed to shouldPopulateRoot with commit 98baba6.
| self.set_setting('WASMFS') | ||
| self.do_run_in_out_file_test('wasmfs/wasmfs_chown.c') | ||
|
|
||
| @wasmfs_all_backends |
There was a problem hiding this comment.
Why remove this?
Does wasmfs_getdents.c need to get re-written to handle the rawfs mabye?
There was a problem hiding this comment.
Should we just skip under NODERAWFS rather than removing wasmfs_all_backends completely?
There was a problem hiding this comment.
I re-added the @wasmfs_all_backends decorator and skipped this only under NODERAWFS with commit f3b85c9.
See for details:
emscripten/test/wasmfs/wasmfs_getdents.out
Lines 51 to 59 in 34f6bcf
|
Perhaps this setup logic belongs in the $ tree / -L 3 --dirsfirst
/ (NODERAWFS)
└── memory (MEMFS)
├── dev
│ ├── null -> SpecialFiles::getNull()
│ ├── random -> SpecialFiles::getRandom()
│ ├── stderr -> SpecialFiles::getStderr()
│ ├── stdin -> SpecialFiles::getStdin()
│ ├── stdout -> SpecialFiles::getStdout()
│ └── urandom -> SpecialFiles::getURandom()
└── tmpThis would avoid the need of the |
sbc100
left a comment
There was a problem hiding this comment.
lgmt, with testing question
| @wasmfs_all_backends | ||
| def test_wasmfs_getdents(self): | ||
| if self.get_setting('NODERAWFS'): | ||
| self.skipTest('test expectations assumes /dev is virtualized') |
There was a problem hiding this comment.
Are there no tests that can now be enabled by this change?
Seems a little odd that this change would strictly make more tests fail.
There was a problem hiding this comment.
PR #24733 (from which this change is split out) would allow more tests to be enabled (e.g. it removes the skip for other.test_fs_dev_random which is currently disabled in this PR).
The downside of splitting this change early is that absolute path access under -sNODERAWFS mode in WasmFS is still broken. So, opening /dev/random under -sNODERAWFS -sWASMFS after this PR lands will no longer work, since it's a absolute path that is no longer virtualized. Though, this only affects the -sNODERAWFS -sWASMFS combo, which is likely not widely used (and -sWASMFS is still marked experimental).
|
lgtm. Happy to see this land incrementally. |
Yes.. I agree. MEMFS-as-the-root is really the only time we should be creating these root dirs from scratch, right? @tlively WDYT? |
|
Yes, I think I agree that the special files only make sense with an in-memory root backend. But IMO it's moot because only the in-memory backend makes sense as the root, besides the special case of NODERAWFS, which really maybe should not be using a virtual filesystem layer at all. |
|
I removed the FWIW, the changes to |
Can these be split out then maybe? (to keep this PR focuced). |
|
I'm not too worried about small regression in wasmfs binary size, I don't think we are that the point of micro-optimizing wasmfs for size just yet. |
Sure, reverted with commit f11ec8f and fe159c1. AFAIK, the test failures fixed by commit c065f72 were only related to emscripten/test/setup_nodefs.js Lines 1 to 6 in fb69be2 (but perhaps that can be removed in favor of -sNODERAWFS, I'll have a look)
|
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (2) test expectation files were updated by running the tests with `--rebaseline`: ``` codesize/test_codesize_cxx_wasmfs.json: 179468 => 179510 [+42 bytes / +0.02%] codesize/test_codesize_files_wasmfs.json: 63681 => 63723 [+42 bytes / +0.07%] Average change: +0.04% (+0.02% - +0.07%) ```
fe159c1 to
f988737
Compare
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (2) test expectation files were updated by running the tests with `--rebaseline`: ``` codesize/test_codesize_cxx_wasmfs.json: 179465 => 179507 [+42 bytes / +0.02%] codesize/test_codesize_files_wasmfs.json: 63678 => 63720 [+42 bytes / +0.07%] Average change: +0.04% (+0.02% - +0.07%) ```
Resolves: #24836.
Split out from #24733.