Skip to content

Commit

Permalink
Bump wasmtime in testing to 24.0.0 (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton authored Aug 21, 2024
1 parent 6367050 commit dd41e41
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 217 deletions.
318 changes: 142 additions & 176 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ moonbit = ['dep:wit-bindgen-moonbit']

[dev-dependencies]
heck = { workspace = true }
wasmtime = { version = "22.0.0", features = ['component-model'] }
wasmtime-wasi = { version = "22.0.0" }
wasmtime = { version = "24.0.0", features = ['component-model'] }
wasmtime-wasi = { version = "24.0.0" }
test-artifacts = { path = 'crates/test-rust-wasm/artifacts' }
wit-parser = { workspace = true }
wasmparser = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions tests/runtime/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<T: Send> WasiView for Wasi<T> {
fn run_test<T, U>(
name: &str,
add_to_linker: fn(&mut Linker<Wasi<T>>) -> Result<()>,
instantiate: fn(&mut Store<Wasi<T>>, &Component, &Linker<Wasi<T>>) -> Result<(U, Instance)>,
instantiate: fn(&mut Store<Wasi<T>>, &Component, &Linker<Wasi<T>>) -> Result<U>,
test: fn(U, &mut Store<Wasi<T>>) -> Result<()>,
) -> Result<()>
where
Expand All @@ -72,7 +72,7 @@ fn run_test_from_dir<T, U>(
dir_name: &str,
name: &str,
add_to_linker: fn(&mut Linker<Wasi<T>>) -> Result<()>,
instantiate: fn(&mut Store<Wasi<T>>, &Component, &Linker<Wasi<T>>) -> Result<(U, Instance)>,
instantiate: fn(&mut Store<Wasi<T>>, &Component, &Linker<Wasi<T>>) -> Result<U>,
test: fn(U, &mut Store<Wasi<T>>) -> Result<()>,
) -> Result<()>
where
Expand Down Expand Up @@ -103,7 +103,7 @@ where

wasmtime_wasi::add_to_linker_sync(&mut linker)?;

let (exports, _) = instantiate(&mut store, &component, &linker)?;
let exports = instantiate(&mut store, &component, &linker)?;

println!("testing {wasm:?}");
test(exports, &mut store)?;
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resource_aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ fn run() -> Result<()> {
crate::run_test(
"resource_aggregates",
|linker| ResourceAggregates::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceAggregates::instantiate(store, component, linker)?;
Ok((u, e))
},
|store, component, linker| ResourceAggregates::instantiate(store, component, linker),
run_test,
)
}
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resource_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ fn run() -> anyhow::Result<()> {
crate::run_test(
"resource_alias",
|_| Ok(()),
|store, component, linker| {
let (u, e) = ResourceAlias::instantiate(store, component, linker)?;
Ok((u, e))
},
|store, component, linker| ResourceAlias::instantiate(store, component, linker),
run_test,
)
}
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resource_alias_redux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ fn run() -> anyhow::Result<()> {
crate::run_test(
"resource_alias_redux",
|linker| ResourceAliasRedux::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceAliasRedux::instantiate(store, component, linker)?;
Ok((u, e))
},
|store, component, linker| ResourceAliasRedux::instantiate(store, component, linker),
run_test,
)
}
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_borrow_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ fn run() -> anyhow::Result<()> {
"resource_borrow_export",
|_| Ok(()),
|store, component, linker| {
let (u, e) = ResourceBorrowExport::instantiate(store, component, linker)?;
Ok((u.interface0, e))
Ok(ResourceBorrowExport::instantiate(store, component, linker)?.interface0)
},
run_test,
)
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resource_borrow_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ fn run() -> anyhow::Result<()> {
crate::run_test(
"resource_borrow_import",
|linker| ResourceBorrowImport::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceBorrowImport::instantiate(store, component, linker)?;
Ok((u, e))
},
|store, component, linker| ResourceBorrowImport::instantiate(store, component, linker),
run_test,
)
}
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_borrow_in_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ fn run() -> anyhow::Result<()> {
"resource_borrow_in_record",
|linker| ResourceBorrowInRecord::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceBorrowInRecord::instantiate(store, component, linker)?;
Ok((u.interface0, e))
Ok(ResourceBorrowInRecord::instantiate(store, component, linker)?.interface0)
},
run_test,
)
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_borrow_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ fn run() -> anyhow::Result<()> {
"resource_borrow_simple",
|linker| ResourceBorrowSimple::add_to_linker(linker, |x| &mut x.0),
|store, component: &wasmtime::component::Component, linker| {
let (u, e) = ResourceBorrowSimple::instantiate(store, component, linker)?;
Ok((u, e))
ResourceBorrowSimple::instantiate(store, component, linker)
},
run_test,
)
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resource_floats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ fn run() -> anyhow::Result<()> {
crate::run_test(
"resource_floats",
|linker| ResourceFloats::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceFloats::instantiate(store, component, linker)?;
Ok((u, e))
},
|store, component, linker| ResourceFloats::instantiate(store, component, linker),
run_test,
)
}
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_import_and_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ fn run() -> anyhow::Result<()> {
"resource_import_and_export",
|linker| ResourceImportAndExport::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceImportAndExport::instantiate(store, component, linker)?;
Ok((u.interface1, e))
Ok(ResourceImportAndExport::instantiate(store, component, linker)?.interface1)
},
run_test,
)
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_into_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ fn run() -> anyhow::Result<()> {
"resource_into_inner",
|_| Ok(()),
|store, component, linker| {
let (u, e) = ResourceIntoInner::instantiate(store, component, linker)?;
Ok((u.interface0, e))
Ok(ResourceIntoInner::instantiate(store, component, linker)?.interface0)
},
run_test,
)
Expand Down
3 changes: 1 addition & 2 deletions tests/runtime/resource_with_lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ fn run() -> anyhow::Result<()> {
"resource_with_lists",
|linker| ResourceWithLists::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = ResourceWithLists::instantiate(store, component, linker)?;
Ok((u.interface0, e))
Ok(ResourceWithLists::instantiate(store, component, linker)?.interface0)
},
run_test,
)
Expand Down
5 changes: 1 addition & 4 deletions tests/runtime/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ fn run() -> Result<()> {
crate::run_test(
"resources",
|linker| Resources::add_to_linker(linker, |x| &mut x.0),
|store, component, linker| {
let (u, e) = Resources::instantiate(store, component, linker)?;
Ok((u.interface0, e))
},
|store, component, linker| Ok(Resources::instantiate(store, component, linker)?.interface0),
run_test,
)
}
Expand Down

0 comments on commit dd41e41

Please sign in to comment.