This repository was archived by the owner on Oct 13, 2023. It is now read-only.
Conversation
Collaborator
Author
|
Closes #141 |
dicej
approved these changes
Apr 14, 2023
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the latest wasmtime, which needed the following to make the
tracing: truefeature in wasmtime-wit-bindgen actually emit something useful: bytecodealliance/wasmtime#6209Install the tracing_subscriber in host's main.rs, so that RUST_LOG=host=trace works from the cli. (It already worked in tests, via test_log.)
And finally, implement
--mapdiras a command line flag, stolen out of the wasmtime cli. I had to rejigger how preopens are constructed slightly to make this work out.Sample output:
Details
[phickey@pch-tower:src/preview2-prototyping]% RUST_LOG=host=trace cargo run -p host -- read_empty_filename.component.wasm --mapdir /::tmp Finished dev [unoptimized + debuginfo] target(s) in 0.14s Running `target/debug/host read_empty_filename.component.wasm --mapdir '/::tmp'` 2023-04-14T15:22:21.371311Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="preopens" function="get-stdio"}: host::command::wasi::preopens: call 2023-04-14T15:22:21.371359Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="preopens" function="get-stdio"}: host::command::wasi::preopens: return result=Ok(StdioPreopens { stdin: 0, stdout: 1, stderr: 2 }) 2023-04-14T15:22:21.371451Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="preopens" function="get-directories"}: host::command::wasi::preopens: call 2023-04-14T15:22:21.371485Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="preopens" function="get-directories"}: host::command::wasi::preopens: return result=Ok([(3, "/")]) 2023-04-14T15:22:21.371620Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="open-at"}: host::command::wasi::filesystem: call this=3 path_flags=(SYMLINK_FOLLOW) path="." open_flags=() flags=(READ) modes=(READABLE|WRITEABLE) 2023-04-14T15:22:21.371687Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="open-at"}: host::command::wasi::filesystem: return result=Ok(4) 2023-04-14T15:22:21.371766Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="stat"}: host::command::wasi::filesystem: call this=4 2023-04-14T15:22:21.371806Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="stat"}: host::command::wasi::filesystem: return result=Ok(DescriptorStat { device: 64769, inode: 17304241, type: DescriptorType::Directory, link-count: 2, size: 4096, data-access-timestamp: Datetime { seconds: 1681484998, nanoseconds: 564963481 }, data-modification-timestamp: Datetime { seconds: 1681348594, nanoseconds: 577238733 }, status-change-timestamp: Datetime { seconds: 1681348594, nanoseconds: 577238733 } }) 2023-04-14T15:22:21.371896Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="read-via-stream"}: host::command::wasi::filesystem: call this=4 offset=0 2023-04-14T15:22:21.371926Z TRACE wit-bindgen export{module="default" function="main"}:wit-bindgen import{module="filesystem" function="read-via-stream"}: host::command::wasi::filesystem: return result=Ok(5)