MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / p2_api_read_only

Function p2_api_read_only

crates/wasi/tests/all/p2/api.rs:91–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89
90#[test_log::test(tokio::test(flavor = "multi_thread"))]
91async fn p2_api_read_only() -> Result<()> {
92 let dir = tempfile::tempdir()?;
93
94 std::fs::File::create(dir.path().join("bar.txt"))?.write_all(b"And stood awhile in thought")?;
95 std::fs::create_dir(dir.path().join("sub"))?;
96
97 let table = ResourceTable::new();
98 let wasi = WasiCtxBuilder::new()
99 .preopened_dir(dir.path(), "/", DirPerms::READ, FilePerms::READ)?
100 .build();
101
102 let (mut store, command) =
103 instantiate(P2_API_READ_ONLY_COMPONENT, CommandCtx { table, wasi }).await?;
104
105 command
106 .wasi_cli_run()
107 .call_run(&mut store)
108 .await?
109 .map_err(|()| wasmtime::format_err!("command returned with failing exit status"))
110}
111
112#[expect(
113 dead_code,

Callers

nothing calls this directly

Calls 9

write_allMethod · 0.80
call_runMethod · 0.80
instantiateFunction · 0.70
createFunction · 0.50
newFunction · 0.50
joinMethod · 0.45
pathMethod · 0.45
buildMethod · 0.45
preopened_dirMethod · 0.45

Tested by

no test coverage detected