Content-Length: 465291 | pFad | https://github.com/emscripten-core/emscripten/pull/23470

53 [FS] Make fstat work on file descriptors with no name in memfs by hoodmane · Pull Request #23470 · emscripten-core/emscripten · GitHub
Skip to content

[FS] Make fstat work on file descriptors with no name in memfs#23470

Merged
hoodmane merged 8 commits intoemscripten-core:mainfrom
hoodmane:anonymous-file-descriptors-memfs
Jan 23, 2025
Merged

[FS] Make fstat work on file descriptors with no name in memfs#23470
hoodmane merged 8 commits intoemscripten-core:mainfrom
hoodmane:anonymous-file-descriptors-memfs

Conversation

@hoodmane
Copy link
Copy Markdown
Collaborator

This makes fstat work on anonymous memfs file descriptors. It is split off from #23058.

This makes fstat work on anonymous memfs file descriptors. It is
split off from emscripten-core#23058.
@hoodmane
Copy link
Copy Markdown
Collaborator Author

So code size went down by a little. But now ./tools/maint/rebaseline_tests.py doesn't update anything when I run it locally but check-expectations is mad. hmm...

@hoodmane
Copy link
Copy Markdown
Collaborator Author

Well it's always possible to directly copy the ci output. Maybe check_expectations could print something like the following when it fails so I could paste it into the terminal and apply the updates that CI wanted:

echo 129211 > test/other/codesize/test_codesize_cxx_ctors1.size
echo 128623 > test/other/codesize/test_codesize_cxx_ctors2.size
echo 170879 > test/other/codesize/test_codesize_cxx_except.size
echo 144708 > test/other/codesize/test_codesize_cxx_except_wasm.size
echo 142162 > test/other/codesize/test_codesize_cxx_except_wasm_legacy.size
echo 232724 > test/other/codesize/test_codesize_cxx_mangle.size
echo 131774 > test/other/codesize/test_codesize_cxx_noexcept.size
echo 169181 > test/other/codesize/test_codesize_cxx_wasmfs.size
echo 15101 > test/other/codesize/test_codesize_hello_O0.size
echo 19394 > test/other/codesize/test_codesize_minimal_pthreads.size
echo 15101 > test/other/test_unoptimized_code_size.wasm.size
echo 12182 > test/other/test_unoptimized_code_size_no_asserts.wasm.size
echo 15101 > test/other/test_unoptimized_code_size_strict.wasm.size

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Jan 22, 2025

Well it's always possible to directly copy the ci output. Maybe check_expectations could print something like the following when it fails so I could paste it into the terminal and apply the updates that CI wanted:

echo 129211 > test/other/codesize/test_codesize_cxx_ctors1.size
echo 128623 > test/other/codesize/test_codesize_cxx_ctors2.size
echo 170879 > test/other/codesize/test_codesize_cxx_except.size
echo 144708 > test/other/codesize/test_codesize_cxx_except_wasm.size
echo 142162 > test/other/codesize/test_codesize_cxx_except_wasm_legacy.size
echo 232724 > test/other/codesize/test_codesize_cxx_mangle.size
echo 131774 > test/other/codesize/test_codesize_cxx_noexcept.size
echo 169181 > test/other/codesize/test_codesize_cxx_wasmfs.size
echo 15101 > test/other/codesize/test_codesize_hello_O0.size
echo 19394 > test/other/codesize/test_codesize_minimal_pthreads.size
echo 15101 > test/other/test_unoptimized_code_size.wasm.size
echo 12182 > test/other/test_unoptimized_code_size_no_asserts.wasm.size
echo 15101 > test/other/test_unoptimized_code_size_strict.wasm.size

I'm hoping to have the CI automatically add make those change perhaps?

In order to get the same results as the CI you need to make sure you do emsdk install tot and then emcc --clear-cache before rebaselineing.

Comment thread test/test_core.py Outdated
Comment thread src/lib/libfs.js Outdated
Comment thread src/lib/libfs.js Outdated
Comment thread src/lib/libfs.js Outdated
@hoodmane
Copy link
Copy Markdown
Collaborator Author

In order to get the same results as the CI you need to make sure you do emsdk install tot and then emcc --clear-cache before rebaselineing.

I think I have been doing that, but it seems to work only some of the time...

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Jan 22, 2025

In order to get the same results as the CI you need to make sure you do emsdk install tot and then emcc --clear-cache before rebaselineing.

I think I have been doing that, but it seems to work only some of the time...

Oh, there is also the case when main can actually be out of date and needs updating.

This happens when llvm of binaryen changes effect code sizes. In that case I normally push a specific update commit, which I can look into doing now.

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Jan 22, 2025

Indeed if you looks at the failing CI test its called Check test expectation on target branch .. which means that expectations on main are failing, unrelated to your change.

I updated main in 12ca58d

Comment thread src/lib/libfs.js
@hoodmane
Copy link
Copy Markdown
Collaborator Author

Okay I rearranged the code in attempt to address your comments. Does it look better?

Comment thread src/lib/libfs.js
ftruncate(fd, len) {
var stream = FS.getStreamChecked(fd);
if ((stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_RDONLY}}}) {
if (len < 0 || (stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_RDONLY}}}) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this a separate fix?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah

@hoodmane hoodmane enabled auto-merge (squash) January 23, 2025 10:53
This is an automatic change generated by tools/maint/rebaseline_tests.py.

The following (18) test expectation files were updated by
running the tests with `--rebaseline`:

```
other/codesize/test_codesize_cxx_ctors1.gzsize: 8343 => 8359 [+16 bytes / +0.19%]
other/codesize/test_codesize_cxx_ctors1.jssize: 20273 => 20296 [+23 bytes / +0.11%]
other/codesize/test_codesize_cxx_ctors2.gzsize: 8327 => 8341 [+14 bytes / +0.17%]
other/codesize/test_codesize_cxx_ctors2.jssize: 20241 => 20264 [+23 bytes / +0.11%]
other/codesize/test_codesize_cxx_except.gzsize: 9343 => 9358 [+15 bytes / +0.16%]
other/codesize/test_codesize_cxx_except.jssize: 24041 => 24064 [+23 bytes / +0.10%]
other/codesize/test_codesize_cxx_except_wasm.gzsize: 8294 => 8303 [+9 bytes / +0.11%]
other/codesize/test_codesize_cxx_except_wasm.jssize: 20166 => 20189 [+23 bytes / +0.11%]
other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize: 8294 => 8303 [+9 bytes / +0.11%]
other/codesize/test_codesize_cxx_except_wasm_legacy.jssize: 20166 => 20189 [+23 bytes / +0.11%]
other/codesize/test_codesize_cxx_lto.gzsize: 8357 => 8372 [+15 bytes / +0.18%]
other/codesize/test_codesize_cxx_lto.jssize: 20348 => 20371 [+23 bytes / +0.11%]
other/codesize/test_codesize_cxx_mangle.gzsize: 9349 => 9364 [+15 bytes / +0.16%]
other/codesize/test_codesize_cxx_mangle.jssize: 24041 => 24064 [+23 bytes / +0.10%]
other/codesize/test_codesize_cxx_noexcept.gzsize: 8343 => 8359 [+16 bytes / +0.19%]
other/codesize/test_codesize_cxx_noexcept.jssize: 20273 => 20296 [+23 bytes / +0.11%]
other/codesize/test_codesize_files_js_fs.gzsize: 7647 => 7669 [+22 bytes / +0.29%]
other/codesize/test_codesize_files_js_fs.jssize: 18820 => 18843 [+23 bytes / +0.12%]

Average change: +0.14% (+0.10% - +0.29%)
```
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









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/emscripten-core/emscripten/pull/23470

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy