Browse Source

Update in-tree wit-bindgen to 0.11.0 (#6947)

This only affects tests and the adapter itself, but not in any breaking
way. The tests for wasi-http are reorganized to be commands which is
also required to not have any exports currently since wit-bindgen for
Rust guests doesn't support generating bindings in one crate and
exporting in another.
pull/6972/head
Alex Crichton 1 year ago
committed by GitHub
parent
commit
e4fbf97676
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 171
      Cargo.lock
  2. 9
      Cargo.toml
  3. 2
      crates/test-programs/build.rs
  4. 12
      crates/test-programs/reactor-tests/src/lib.rs
  5. 6
      crates/test-programs/tests/wasi-http-modules.rs
  6. 20
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_get.rs
  7. 19
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_dnsname.rs
  8. 19
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_port.rs
  9. 19
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_version.rs
  10. 20
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_post.rs
  11. 16
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_post_large.rs
  12. 20
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_put.rs
  13. 19
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_unknown_method.rs
  14. 19
      crates/test-programs/wasi-http-tests/src/bin/outbound_request_unsupported_scheme.rs
  15. 4
      crates/test-programs/wasi-http-tests/src/lib.rs
  16. 2
      crates/wasi-http/wit/command-extended.wit
  17. 2
      crates/wasi-preview1-component-adapter/src/lib.rs
  18. 2
      crates/wasi/wit/command-extended.wit
  19. 6
      supply-chain/audits.toml
  20. 42
      supply-chain/imports.lock

171
Cargo.lock

@ -100,9 +100,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.71" version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "arbitrary" name = "arbitrary"
@ -659,7 +659,7 @@ dependencies = [
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"toml", "toml",
"wasmparser 0.112.0", "wasmparser",
"wat", "wat",
] ]
@ -838,7 +838,7 @@ dependencies = [
"serde_derive", "serde_derive",
"smallvec", "smallvec",
"target-lexicon", "target-lexicon",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-types", "wasmtime-types",
"wat", "wat",
] ]
@ -2680,7 +2680,7 @@ dependencies = [
"wasmtime", "wasmtime",
"wasmtime-wasi", "wasmtime-wasi",
"wasmtime-wasi-http", "wasmtime-wasi-http",
"wit-component 0.14.0", "wit-component",
] ]
[[package]] [[package]]
@ -2956,7 +2956,7 @@ name = "verify-component-adapter"
version = "14.0.0" version = "14.0.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wasmparser 0.112.0", "wasmparser",
"wat", "wat",
] ]
@ -3058,7 +3058,7 @@ dependencies = [
"byte-array-literals", "byte-array-literals",
"object", "object",
"wasi", "wasi",
"wasm-encoder 0.32.0", "wasm-encoder",
"wit-bindgen", "wit-bindgen",
] ]
@ -3150,15 +3150,6 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "wasm-encoder"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2f8e9778e04cbf44f58acc301372577375a666b966c50b03ef46144f80436a8"
dependencies = [
"leb128",
]
[[package]] [[package]]
name = "wasm-encoder" name = "wasm-encoder"
version = "0.32.0" version = "0.32.0"
@ -3168,21 +3159,6 @@ dependencies = [
"leb128", "leb128",
] ]
[[package]]
name = "wasm-metadata"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51db59397fc650b5f2fc778e4a5c4456cd856bed7fc1ec15f8d3e28229dc463"
dependencies = [
"anyhow",
"indexmap 2.0.0",
"serde",
"serde_json",
"spdx",
"wasm-encoder 0.30.0",
"wasmparser 0.108.0",
]
[[package]] [[package]]
name = "wasm-metadata" name = "wasm-metadata"
version = "0.10.3" version = "0.10.3"
@ -3194,8 +3170,8 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"spdx", "spdx",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
] ]
[[package]] [[package]]
@ -3208,8 +3184,8 @@ dependencies = [
"log", "log",
"rand", "rand",
"thiserror", "thiserror",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
] ]
[[package]] [[package]]
@ -3222,8 +3198,8 @@ dependencies = [
"flagset", "flagset",
"indexmap 2.0.0", "indexmap 2.0.0",
"leb128", "leb128",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
] ]
[[package]] [[package]]
@ -3264,16 +3240,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "wasmparser"
version = "0.108.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76c956109dcb41436a39391139d9b6e2d0a5e0b158e1293ef352ec977e5e36c5"
dependencies = [
"indexmap 2.0.0",
"semver",
]
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.112.0" version = "0.112.0"
@ -3300,7 +3266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ddf5892036cd4b780d505eff1194a0cbc10ed896097656fdcea3744b5e7c2f" checksum = "34ddf5892036cd4b780d505eff1194a0cbc10ed896097656fdcea3744b5e7c2f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wasmparser 0.112.0", "wasmparser",
] ]
[[package]] [[package]]
@ -3328,8 +3294,8 @@ dependencies = [
"target-lexicon", "target-lexicon",
"tempfile", "tempfile",
"wasi-cap-std-sync", "wasi-cap-std-sync",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-cache", "wasmtime-cache",
"wasmtime-component-macro", "wasmtime-component-macro",
"wasmtime-component-util", "wasmtime-component-util",
@ -3444,8 +3410,8 @@ dependencies = [
"test-programs", "test-programs",
"tokio", "tokio",
"walkdir", "walkdir",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
"wasmtime", "wasmtime",
"wasmtime-cache", "wasmtime-cache",
"wasmtime-cli-flags", "wasmtime-cli-flags",
@ -3489,7 +3455,7 @@ dependencies = [
"wasmtime", "wasmtime",
"wasmtime-component-util", "wasmtime-component-util",
"wasmtime-wit-bindgen", "wasmtime-wit-bindgen",
"wit-parser 0.11.0", "wit-parser",
] ]
[[package]] [[package]]
@ -3513,7 +3479,7 @@ dependencies = [
"object", "object",
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-cranelift-shared", "wasmtime-cranelift-shared",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-versioned-export-macros", "wasmtime-versioned-export-macros",
@ -3550,8 +3516,8 @@ dependencies = [
"serde_derive", "serde_derive",
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmparser 0.112.0", "wasmparser",
"wasmprinter", "wasmprinter",
"wasmtime-component-util", "wasmtime-component-util",
"wasmtime-types", "wasmtime-types",
@ -3566,7 +3532,7 @@ dependencies = [
"component-fuzz-util", "component-fuzz-util",
"env_logger 0.10.0", "env_logger 0.10.0",
"libfuzzer-sys", "libfuzzer-sys",
"wasmparser 0.112.0", "wasmparser",
"wasmprinter", "wasmprinter",
"wasmtime-environ", "wasmtime-environ",
"wat", "wat",
@ -3622,7 +3588,7 @@ dependencies = [
"rand", "rand",
"smallvec", "smallvec",
"target-lexicon", "target-lexicon",
"wasmparser 0.112.0", "wasmparser",
"wasmtime", "wasmtime",
"wasmtime-fuzzing", "wasmtime-fuzzing",
] ]
@ -3642,12 +3608,12 @@ dependencies = [
"target-lexicon", "target-lexicon",
"tempfile", "tempfile",
"v8", "v8",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasm-mutate", "wasm-mutate",
"wasm-smith", "wasm-smith",
"wasm-spec-interpreter", "wasm-spec-interpreter",
"wasmi", "wasmi",
"wasmparser 0.112.0", "wasmparser",
"wasmprinter", "wasmprinter",
"wasmtime", "wasmtime",
"wasmtime-wast", "wasmtime-wast",
@ -3717,7 +3683,7 @@ dependencies = [
"rand", "rand",
"rustix 0.38.8", "rustix 0.38.8",
"sptr", "sptr",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasmtime-asm-macros", "wasmtime-asm-macros",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-fiber", "wasmtime-fiber",
@ -3735,7 +3701,7 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"thiserror", "thiserror",
"wasmparser 0.112.0", "wasmparser",
] ]
[[package]] [[package]]
@ -3846,7 +3812,7 @@ dependencies = [
"gimli", "gimli",
"object", "object",
"target-lexicon", "target-lexicon",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-cranelift-shared", "wasmtime-cranelift-shared",
"wasmtime-environ", "wasmtime-environ",
"winch-codegen", "winch-codegen",
@ -3859,7 +3825,7 @@ dependencies = [
"anyhow", "anyhow",
"heck", "heck",
"indexmap 2.0.0", "indexmap 2.0.0",
"wit-parser 0.11.0", "wit-parser",
] ]
[[package]] [[package]]
@ -3884,7 +3850,7 @@ dependencies = [
"leb128", "leb128",
"memchr", "memchr",
"unicode-width", "unicode-width",
"wasm-encoder 0.32.0", "wasm-encoder",
] ]
[[package]] [[package]]
@ -4018,7 +3984,7 @@ dependencies = [
"regalloc2", "regalloc2",
"smallvec", "smallvec",
"target-lexicon", "target-lexicon",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-environ", "wasmtime-environ",
] ]
@ -4063,7 +4029,7 @@ dependencies = [
"similar", "similar",
"target-lexicon", "target-lexicon",
"toml", "toml",
"wasmparser 0.112.0", "wasmparser",
"wasmtime-environ", "wasmtime-environ",
"wat", "wat",
"winch-codegen", "winch-codegen",
@ -4149,9 +4115,9 @@ dependencies = [
[[package]] [[package]]
name = "wit-bindgen" name = "wit-bindgen"
version = "0.9.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5c3d15a04ce994fad2c5442a754b404ab1fee23c903a04a560f84f94fdf63c0" checksum = "f8a3e8e965dc50e6eb4410d9a11720719fadc6a1713803ea5f3be390b81c8279"
dependencies = [ dependencies = [
"bitflags 2.3.3", "bitflags 2.3.3",
"wit-bindgen-rust-macro", "wit-bindgen-rust-macro",
@ -4159,33 +4125,34 @@ dependencies = [
[[package]] [[package]]
name = "wit-bindgen-core" name = "wit-bindgen-core"
version = "0.9.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9658ec54d4a3c9e2f079bc65a131093337595b595fbf82f805008469838cdea" checksum = "77255512565dfbd0b61de466e854918041d1da53c7bc049d6188c6e02643dc1e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wit-component 0.12.0", "wit-component",
"wit-parser 0.9.2", "wit-parser",
] ]
[[package]] [[package]]
name = "wit-bindgen-rust" name = "wit-bindgen-rust"
version = "0.9.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21ae6a6198ba9765771b977e2af985a0d5ac71b59f999da5c4ee1c7bbd8ca8dc" checksum = "399c60e6ea8598d1380e792f13d557007834f0fb799fea6503408cbc5debb4ae"
dependencies = [ dependencies = [
"anyhow",
"heck", "heck",
"wasm-metadata 0.9.0", "wasm-metadata",
"wit-bindgen-core", "wit-bindgen-core",
"wit-bindgen-rust-lib", "wit-bindgen-rust-lib",
"wit-component 0.12.0", "wit-component",
] ]
[[package]] [[package]]
name = "wit-bindgen-rust-lib" name = "wit-bindgen-rust-lib"
version = "0.9.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c31de8c6c77cac1fd4927c7584d1314cd5e838cfb40b53333d6dffc7a132dda" checksum = "cd9fb7a43c7dc28b0b727d6ae01bf369981229b7539e768fba2b7a4df13feeeb"
dependencies = [ dependencies = [
"heck", "heck",
"wit-bindgen-core", "wit-bindgen-core",
@ -4193,9 +4160,9 @@ dependencies = [
[[package]] [[package]]
name = "wit-bindgen-rust-macro" name = "wit-bindgen-rust-macro"
version = "0.9.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2abe5c7c4c08468d01590aa96c8a684dd94fb9241a248af88eef7edac61e43" checksum = "44cea5ed784da06da0e55836a6c160e7502dbe28771c2368a595e8606243bf22"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"proc-macro2", "proc-macro2",
@ -4203,23 +4170,7 @@ dependencies = [
"wit-bindgen-core", "wit-bindgen-core",
"wit-bindgen-rust", "wit-bindgen-rust",
"wit-bindgen-rust-lib", "wit-bindgen-rust-lib",
"wit-component 0.12.0", "wit-component",
]
[[package]]
name = "wit-component"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "253bd426c532f1cae8c633c517c63719920535f3a7fada3589de40c5b734e393"
dependencies = [
"anyhow",
"bitflags 1.3.2",
"indexmap 2.0.0",
"log",
"wasm-encoder 0.30.0",
"wasm-metadata 0.9.0",
"wasmparser 0.108.0",
"wit-parser 0.9.2",
] ]
[[package]] [[package]]
@ -4234,26 +4185,10 @@ dependencies = [
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"wasm-encoder 0.32.0", "wasm-encoder",
"wasm-metadata 0.10.3", "wasm-metadata",
"wasmparser 0.112.0", "wasmparser",
"wit-parser 0.11.0", "wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "541efa2046e544de53a9da1e2f6299e63079840360c9e106f1f8275a97771318"
dependencies = [
"anyhow",
"id-arena",
"indexmap 2.0.0",
"log",
"pulldown-cmark",
"semver",
"unicode-xid",
"url",
] ]
[[package]] [[package]]

9
Cargo.toml

@ -207,7 +207,7 @@ io-extras = "0.18.0"
rustix = "0.38.8" rustix = "0.38.8"
is-terminal = "0.4.0" is-terminal = "0.4.0"
# wit-bindgen: # wit-bindgen:
wit-bindgen = { version = "0.9.0", default-features = false } wit-bindgen = { version = "0.11.0", default-features = false }
# wasm-tools family: # wasm-tools family:
wasmparser = "0.112.0" wasmparser = "0.112.0"
@ -328,3 +328,10 @@ debug-assertions = false
# Omit integer overflow checks, which include failure messages which require # Omit integer overflow checks, which include failure messages which require
# string initializers. # string initializers.
overflow-checks = false overflow-checks = false
# Same as `wasi-preview1-component-adapter` above
[profile.dev.package.wit-bindgen]
incremental = false
debug-assertions = false
overflow-checks = false
opt-level = 's'

2
crates/test-programs/build.rs

@ -61,7 +61,7 @@ fn build_and_generate_tests() {
if BUILD_WASI_HTTP_TESTS { if BUILD_WASI_HTTP_TESTS {
modules_rs(&meta, "wasi-http-tests", "bin", &out_dir); modules_rs(&meta, "wasi-http-tests", "bin", &out_dir);
components_rs(&meta, "wasi-http-tests", "bin", &reactor_adapter, &out_dir); components_rs(&meta, "wasi-http-tests", "bin", &command_adapter, &out_dir);
} }
components_rs(&meta, "command-tests", "bin", &command_adapter, &out_dir); components_rs(&meta, "command-tests", "bin", &command_adapter, &out_dir);

12
crates/test-programs/reactor-tests/src/lib.rs

@ -1,12 +1,16 @@
wit_bindgen::generate!("test-reactor" in "../../wasi/wit"); wit_bindgen::generate!({
world: "test-reactor",
export_test_reactor!(T); path: "../../wasi/wit",
exports: {
world: T,
}
});
struct T; struct T;
static mut STATE: Vec<String> = Vec::new(); static mut STATE: Vec<String> = Vec::new();
impl TestReactor for T { impl Guest for T {
fn add_strings(ss: Vec<String>) -> u32 { fn add_strings(ss: Vec<String>) -> u32 {
for s in ss { for s in ss {
match s.split_once("$") { match s.split_once("$") {

6
crates/test-programs/tests/wasi-http-modules.rs

@ -69,7 +69,7 @@ async fn instantiate_module(module: Module, ctx: Ctx) -> Result<(Store<Ctx>, Fun
let mut store = Store::new(&ENGINE, ctx); let mut store = Store::new(&ENGINE, ctx);
let instance = linker.instantiate_async(&mut store, &module).await?; let instance = linker.instantiate_async(&mut store, &module).await?;
let command = instance.get_func(&mut store, "wasi:cli/run#run").unwrap(); let command = instance.get_func(&mut store, "_start").unwrap();
Ok((store, command)) Ok((store, command))
} }
@ -103,9 +103,7 @@ async fn run(name: &str) -> anyhow::Result<()> {
}, },
) )
.await?; .await?;
command command.call_async(&mut store, &[], &mut []).await
.call_async(&mut store, &[], &mut [wasmtime::Val::null()])
.await
}; };
r.map_err(move |trap: anyhow::Error| { r.map_err(move |trap: anyhow::Error| {
let stdout = stdout.try_into_inner().expect("single ref to stdout"); let stdout = stdout.try_into_inner().expect("single ref to stdout");

20
crates/test-programs/wasi-http-tests/src/bin/outbound_request_get.rs

@ -1,11 +1,11 @@
use anyhow::{Context, Result}; use anyhow::Context;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Get, Method::Get,
Scheme::Http, Scheme::Http,
@ -28,14 +28,4 @@ async fn run() -> Result<(), ()> {
"http://localhost:3000/get?some=arg&goes=here" "http://localhost:3000/get?some=arg&goes=here"
); );
assert_eq!(res.body, b""); assert_eq!(res.body, b"");
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

19
crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_dnsname.rs

@ -1,11 +1,10 @@
use anyhow::Result;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Get, Method::Get,
Scheme::Http, Scheme::Http,
@ -18,14 +17,4 @@ async fn run() -> Result<(), ()> {
let error = res.unwrap_err(); let error = res.unwrap_err();
assert_eq!(error.to_string(), "Error::InvalidUrl(\"invalid dnsname\")"); assert_eq!(error.to_string(), "Error::InvalidUrl(\"invalid dnsname\")");
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

19
crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_port.rs

@ -1,11 +1,10 @@
use anyhow::Result;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Get, Method::Get,
Scheme::Http, Scheme::Http,
@ -21,14 +20,4 @@ async fn run() -> Result<(), ()> {
error.to_string(), error.to_string(),
"Error::InvalidUrl(\"invalid port value\")" "Error::InvalidUrl(\"invalid port value\")"
); );
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

19
crates/test-programs/wasi-http-tests/src/bin/outbound_request_invalid_version.rs

@ -1,11 +1,10 @@
use anyhow::Result;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Connect, Method::Connect,
Scheme::Http, Scheme::Http,
@ -27,14 +26,4 @@ async fn run() -> Result<(), ()> {
or `"Error::ProtocolError(\"operation was canceled\")"`)"# or `"Error::ProtocolError(\"operation was canceled\")"`)"#
) )
} }
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

20
crates/test-programs/wasi-http-tests/src/bin/outbound_request_post.rs

@ -1,11 +1,11 @@
use anyhow::{Context, Result}; use anyhow::Context;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Post, Method::Post,
Scheme::Http, Scheme::Http,
@ -23,14 +23,4 @@ async fn run() -> Result<(), ()> {
let method = res.header("x-wasmtime-test-method").unwrap(); let method = res.header("x-wasmtime-test-method").unwrap();
assert_eq!(std::str::from_utf8(method).unwrap(), "POST"); assert_eq!(std::str::from_utf8(method).unwrap(), "POST");
assert_eq!(res.body, b"{\"foo\": \"bar\"}"); assert_eq!(res.body, b"{\"foo\": \"bar\"}");
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

16
crates/test-programs/wasi-http-tests/src/bin/outbound_request_post_large.rs

@ -4,9 +4,11 @@ use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; struct Component;
fn main() {} fn main() {
wasi_http_tests::in_tokio(async { run().await })
}
async fn run() -> Result<(), ()> { async fn run() {
const LEN: usize = 4000; const LEN: usize = 4000;
let mut buffer = [0; LEN]; let mut buffer = [0; LEN];
io::repeat(0b001).read_exact(&mut buffer).unwrap(); io::repeat(0b001).read_exact(&mut buffer).unwrap();
@ -27,14 +29,4 @@ async fn run() -> Result<(), ()> {
let method = res.header("x-wasmtime-test-method").unwrap(); let method = res.header("x-wasmtime-test-method").unwrap();
assert_eq!(std::str::from_utf8(method).unwrap(), "POST"); assert_eq!(std::str::from_utf8(method).unwrap(), "POST");
assert_eq!(res.body.len(), LEN); assert_eq!(res.body.len(), LEN);
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

20
crates/test-programs/wasi-http-tests/src/bin/outbound_request_put.rs

@ -1,11 +1,11 @@
use anyhow::{Context, Result}; use anyhow::Context;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Put, Method::Put,
Scheme::Http, Scheme::Http,
@ -23,14 +23,4 @@ async fn run() -> Result<(), ()> {
let method = res.header("x-wasmtime-test-method").unwrap(); let method = res.header("x-wasmtime-test-method").unwrap();
assert_eq!(std::str::from_utf8(method).unwrap(), "PUT"); assert_eq!(std::str::from_utf8(method).unwrap(), "PUT");
assert_eq!(res.body, b""); assert_eq!(res.body, b"");
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

19
crates/test-programs/wasi-http-tests/src/bin/outbound_request_unknown_method.rs

@ -1,11 +1,10 @@
use anyhow::Result;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Other("OTHER".to_owned()), Method::Other("OTHER".to_owned()),
Scheme::Http, Scheme::Http,
@ -21,14 +20,4 @@ async fn run() -> Result<(), ()> {
error.to_string(), error.to_string(),
"Error::InvalidUrl(\"unknown method OTHER\")" "Error::InvalidUrl(\"unknown method OTHER\")"
); );
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

19
crates/test-programs/wasi-http-tests/src/bin/outbound_request_unsupported_scheme.rs

@ -1,11 +1,10 @@
use anyhow::Result;
use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme}; use wasi_http_tests::bindings::wasi::http::types::{Method, Scheme};
struct Component; fn main() {
wasi_http_tests::in_tokio(async { run().await })
fn main() {} }
async fn run() -> Result<(), ()> { async fn run() {
let res = wasi_http_tests::request( let res = wasi_http_tests::request(
Method::Get, Method::Get,
Scheme::Other("WS".to_owned()), Scheme::Other("WS".to_owned()),
@ -21,14 +20,4 @@ async fn run() -> Result<(), ()> {
error.to_string(), error.to_string(),
"Error::InvalidUrl(\"unsupported scheme WS\")" "Error::InvalidUrl(\"unsupported scheme WS\")"
); );
Ok(())
} }
impl wasi_http_tests::bindings::exports::wasi::cli::run::Run for Component {
fn run() -> Result<(), ()> {
wasi_http_tests::in_tokio(async { run().await })
}
}
wasi_http_tests::export_command_extended!(Component);

4
crates/test-programs/wasi-http-tests/src/lib.rs

@ -2,8 +2,8 @@ pub mod bindings {
wit_bindgen::generate!({ wit_bindgen::generate!({
path: "../../wasi-http/wit", path: "../../wasi-http/wit",
world: "wasmtime:wasi/command-extended", world: "wasmtime:wasi/command-extended",
macro_call_prefix: "::wasi_http_tests::bindings::", // macro_call_prefix: "::wasi_http_tests::bindings::",
macro_export, // macro_export,
}); });
} }

2
crates/wasi-http/wit/command-extended.wit

@ -29,8 +29,6 @@ world command-extended {
import wasi:cli/terminal-stdout import wasi:cli/terminal-stdout
import wasi:cli/terminal-stderr import wasi:cli/terminal-stderr
export wasi:cli/run
// We should replace all others with `include self.command` // We should replace all others with `include self.command`
// as soon as the unioning of worlds is available: // as soon as the unioning of worlds is available:
// https://github.com/WebAssembly/component-model/issues/169 // https://github.com/WebAssembly/component-model/issues/169

2
crates/wasi-preview1-component-adapter/src/lib.rs

@ -25,7 +25,7 @@ compile_error!("only one of the `command` and `reactor` features may be selected
mod macros; mod macros;
mod descriptors; mod descriptors;
use crate::descriptors::{Descriptor, Descriptors, IsATTY, StreamType, Streams}; use crate::descriptors::{Descriptor, Descriptors, StreamType, Streams};
pub mod bindings { pub mod bindings {
#[cfg(feature = "command")] #[cfg(feature = "command")]

2
crates/wasi/wit/command-extended.wit

@ -29,8 +29,6 @@ world command-extended {
import wasi:cli/terminal-stdout import wasi:cli/terminal-stdout
import wasi:cli/terminal-stderr import wasi:cli/terminal-stderr
export wasi:cli/run
// We should replace all others with `include self.command` // We should replace all others with `include self.command`
// as soon as the unioning of worlds is available: // as soon as the unioning of worlds is available:
// https://github.com/WebAssembly/component-model/issues/169 // https://github.com/WebAssembly/component-model/issues/169

6
supply-chain/audits.toml

@ -2906,6 +2906,12 @@ user-id = 6743 # Ed Page (epage)
start = "2023-03-08" start = "2023-03-08"
end = "2024-07-14" end = "2024-07-14"
[[trusted.anyhow]]
criteria = "safe-to-deploy"
user-id = 3618 # David Tolnay (dtolnay)
start = "2019-10-05"
end = "2024-09-01"
[[trusted.async-trait]] [[trusted.async-trait]]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
user-id = 3618 # David Tolnay (dtolnay) user-id = 3618 # David Tolnay (dtolnay)

42
supply-chain/imports.lock

@ -431,6 +431,13 @@ user-id = 6743
user-login = "epage" user-login = "epage"
user-name = "Ed Page" user-name = "Ed Page"
[[publisher.anyhow]]
version = "1.0.75"
when = "2023-08-17"
user-id = 3618
user-login = "dtolnay"
user-name = "David Tolnay"
[[publisher.arbitrary]] [[publisher.arbitrary]]
version = "1.3.0" version = "1.3.0"
when = "2023-03-13" when = "2023-03-13"
@ -1769,6 +1776,13 @@ user-id = 1
user-login = "alexcrichton" user-login = "alexcrichton"
user-name = "Alex Crichton" user-name = "Alex Crichton"
[[publisher.wit-bindgen]]
version = "0.11.0"
when = "2023-08-28"
user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wit-bindgen-core]] [[publisher.wit-bindgen-core]]
version = "0.9.0" version = "0.9.0"
when = "2023-07-15" when = "2023-07-15"
@ -1776,6 +1790,13 @@ user-id = 1
user-login = "alexcrichton" user-login = "alexcrichton"
user-name = "Alex Crichton" user-name = "Alex Crichton"
[[publisher.wit-bindgen-core]]
version = "0.11.0"
when = "2023-08-28"
user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust]] [[publisher.wit-bindgen-rust]]
version = "0.9.0" version = "0.9.0"
when = "2023-07-15" when = "2023-07-15"
@ -1783,6 +1804,13 @@ user-id = 1
user-login = "alexcrichton" user-login = "alexcrichton"
user-name = "Alex Crichton" user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust]]
version = "0.11.0"
when = "2023-08-28"
user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust-lib]] [[publisher.wit-bindgen-rust-lib]]
version = "0.9.0" version = "0.9.0"
when = "2023-07-15" when = "2023-07-15"
@ -1790,6 +1818,13 @@ user-id = 1
user-login = "alexcrichton" user-login = "alexcrichton"
user-name = "Alex Crichton" user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust-lib]]
version = "0.11.0"
when = "2023-08-28"
user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust-macro]] [[publisher.wit-bindgen-rust-macro]]
version = "0.9.0" version = "0.9.0"
when = "2023-07-15" when = "2023-07-15"
@ -1797,6 +1832,13 @@ user-id = 1
user-login = "alexcrichton" user-login = "alexcrichton"
user-name = "Alex Crichton" user-name = "Alex Crichton"
[[publisher.wit-bindgen-rust-macro]]
version = "0.11.0"
when = "2023-08-28"
user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wit-component]] [[publisher.wit-component]]
version = "0.12.0" version = "0.12.0"
when = "2023-07-11" when = "2023-07-11"

Loading…
Cancel
Save