Skip to content

src/{syscall, os}: add Fstat, with tests #2457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 20, 2022

Conversation

dkegel-fastly
Copy link
Contributor

@dkegel-fastly dkegel-fastly commented Dec 31, 2021

This is the Fstat part of #2371, plus tests and a windows implementation.

@dkegel-fastly
Copy link
Contributor Author

dkegel-fastly commented Jan 3, 2022

On wasi, I think this requires #2469 before it'll pass.
On i386 and arm, it seems to need syscall.seek to be implemented, not sure why.
( cf. #1906 ).

@dkegel-fastly dkegel-fastly force-pushed the dkegel-add-fstat branch 2 times, most recently from 910feb5 to 3037c0c Compare January 4, 2022 16:15
@dkegel-fastly dkegel-fastly modified the milestones: v0.22.0, v0.23.0 Jan 17, 2022
@dkegel-fastly dkegel-fastly force-pushed the dkegel-add-fstat branch 2 times, most recently from 5208ec2 to ba8ebc8 Compare January 18, 2022 02:02
@dkegel-fastly dkegel-fastly modified the milestones: v0.23.0, v0.22.0 Jan 18, 2022
@dkegel-fastly
Copy link
Contributor Author

dkegel-fastly commented Jan 18, 2022

This now works around #1906 by leaving Fstat a stub on i386-linux and arm-linux.

The workaround is a single commit that should be reverted once tinygo supports go assembly.

@deadprogram deadprogram requested a review from dgryski January 18, 2022 16:14
@dkegel-fastly
Copy link
Contributor Author

May need a tweak to let wasi tests pass still. I will push a new version tonight.

Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

LGTM. Can we add archive/zip to the passing tests yet?

@dkegel-fastly
Copy link
Contributor Author

Oh, yeah, when I rebase tonight I will try adding that.

@dkegel-fastly
Copy link
Contributor Author

archive/zip is not passing on wasi yet, so I added it to the passing-on-native-tests list.

I don't quite understad why it isn't passing on wasi... probably means this pull request isn't fully baked yet.

@dkegel-fastly
Copy link
Contributor Author

Also not passing on windows. Back to the kitchen!

@dgryski
Copy link
Member

dgryski commented Jan 19, 2022

Started looking into why it's not passing on wasi and fell down the rabbit hole of io/fs interfaces and implementations.

@dkegel-fastly
Copy link
Contributor Author

I broke my gaze away from that, too.

@dkegel-fastly
Copy link
Contributor Author

aha, archive/zip failure on windows is expected, it needs ReadAt. Excluding that test on windows.

dgryski and others added 4 commits January 19, 2022 09:52
This is File.Stat from tinygo-org#2371,
plus the windows bits,
plus a smoke test more or less from upstream,
all pulled together and rebased by dkegel-fastly.
Except on windows, where it fails because it needs ReadAt, which we don't implement on windows yet.
@dgryski
Copy link
Member

dgryski commented Jan 19, 2022

The TestFSModTime test (which is the failing test on wasi) passes when run independently. This points to a garbage collection issue or similar. However, running with gcAsserts = true fails:

This is worth opening its own bug for.

~/go/src/go.googlesource.com/go/src/archive/zip $ tinygo test -target=wasi archive/zip
panic: runtime error: gc: metadata array is too small
Error: failed to run main module `/var/folders/5b/_hr1d1fd3qn4t9vtfx5p61wm0000gp/T/tinygo272422465/main`

Caused by:
    0: failed to invoke command default
    1: wasm trap: wasm `unreachable` instruction executed
       wasm backtrace:
           0: 0x9bc6 - <unknown>!runtime.runtimePanic
           1: 0x23d43 - <unknown>!runtime.calculateHeapAddresses
           2: 0x2d431 - <unknown>!_start
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable to may show more debugging information

FAIL	archive/zip	2.088s

@dkegel-fastly
Copy link
Contributor Author

Let's land this now, link to the new bug, and deal with that later.

@dgryski
Copy link
Member

dgryski commented Jan 19, 2022

Filed #2554

@dkegel-fastly
Copy link
Contributor Author

Ship it!

@deadprogram
Copy link
Member

OK that was a bit complicated to follow at first, but I understand the reasoning behind how this PR is setup. Merging, counting on you both @dkegel-fastly and @dgryski to help get it sorted out once the "real" solution is available.

@deadprogram deadprogram merged commit 7914a72 into tinygo-org:dev Jan 20, 2022
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