()
| 89 | |
| 90 | #[test_log::test(tokio::test(flavor = "multi_thread"))] |
| 91 | async 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, |
nothing calls this directly
no test coverage detected