Skip to content

Commit c359661

Browse files
committed
test fixes
1 parent 1207ba2 commit c359661

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use {
1414
component::{Component, InstancePre, Linker, ResourceTable},
1515
Config, Engine, Store,
1616
},
17-
wasmtime_wasi::{WasiCtx, WasiCtxBuilder},
17+
wasmtime_wasi::p2::{WasiCtx, WasiCtxBuilder},
1818
};
1919

2020
mod echoes;

src/test/echoes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use {
44
once_cell::sync::Lazy,
55
proptest::strategy::{Just, Strategy},
66
wasmtime::{
7-
component::{InstancePre, Linker},
7+
component::{HasSelf, InstancePre, Linker},
88
Store,
99
},
1010
};
@@ -189,8 +189,8 @@ impl super::Host for Host {
189189
type World = EchoesTest;
190190

191191
fn add_to_linker(linker: &mut Linker<Ctx>) -> Result<()> {
192-
wasmtime_wasi::add_to_linker_async(&mut *linker)?;
193-
componentize_py::test::echoes::add_to_linker(linker, |ctx| ctx)?;
192+
wasmtime_wasi::p2::add_to_linker_async(&mut *linker)?;
193+
componentize_py::test::echoes::add_to_linker::<_, HasSelf<_>>(linker, |ctx| ctx)?;
194194
Ok(())
195195
}
196196

src/test/tests.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ use {
66
once_cell::sync::Lazy,
77
std::str,
88
wasmtime::{
9-
component::{InstancePre, Linker, Resource, ResourceAny},
9+
component::{HasSelf, InstancePre, Linker, Resource, ResourceAny},
1010
Store,
1111
},
12-
wasmtime_wasi::{DirPerms, FilePerms, IoView, WasiCtxBuilder},
12+
wasmtime_wasi::{
13+
p2::{IoView, WasiCtxBuilder},
14+
DirPerms, FilePerms,
15+
},
1316
};
1417

1518
wasmtime::component::bindgen!({
@@ -93,9 +96,9 @@ impl super::Host for Host {
9396
type World = Tests;
9497

9598
fn add_to_linker(linker: &mut Linker<Ctx>) -> Result<()> {
96-
wasmtime_wasi::add_to_linker_async(linker)?;
97-
Tests::add_to_linker(linker, |ctx| ctx)?;
98-
foo_sdk::FooWorld::add_to_linker(linker, |ctx| ctx)?;
99+
wasmtime_wasi::p2::add_to_linker_async(linker)?;
100+
Tests::add_to_linker::<_, HasSelf<_>>(linker, |ctx| ctx)?;
101+
foo_sdk::FooWorld::add_to_linker::<_, HasSelf<_>>(linker, |ctx| ctx)?;
99102
Ok(())
100103
}
101104

test-generator/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ pub fn generate() -> Result<()> {
699699

700700
writeln!(
701701
&mut typed_function_inits,
702-
r#"echo{test_index}: instance.get_typed_func::<({params}), ({result_type},)>(&mut *store, component.export_index(Some(&index), "echo{test_index}").unwrap().1)?,"#
702+
r#"echo{test_index}: instance.get_typed_func::<({params}), ({result_type},)>(&mut *store, component.get_export_index(Some(&index), "echo{test_index}").unwrap())?,"#
703703
)
704704
.unwrap();
705705
}
@@ -802,7 +802,7 @@ use {{
802802
once_cell::sync::Lazy,
803803
proptest::strategy::{{Just, Strategy}},
804804
wasmtime::{{
805-
component::{{Instance, InstancePre, Linker, TypedFunc}},
805+
component::{{Instance, InstancePre, Linker, TypedFunc, HasSelf}},
806806
Store,
807807
}},
808808
}};
@@ -828,8 +828,8 @@ impl super::Host for Host {{
828828
type World = Exports;
829829
830830
fn add_to_linker(linker: &mut Linker<Ctx>) -> Result<()> {{
831-
wasmtime_wasi::add_to_linker_async(&mut *linker)?;
832-
{PREFIX}::add_to_linker(linker, |ctx| ctx)?;
831+
wasmtime_wasi::p2::add_to_linker_async(&mut *linker)?;
832+
{PREFIX}::add_to_linker::<_, HasSelf<_>>(linker, |ctx| ctx)?;
833833
Ok(())
834834
}}
835835
@@ -838,7 +838,7 @@ impl super::Host for Host {{
838838
pre: InstancePre<Ctx>,
839839
) -> Result<Self::World> {{
840840
let component = pre.component();
841-
let (_, index) = component.export_index(None, "componentize-py:test/echoes-generated").unwrap();
841+
let index = component.get_export_index(None, "componentize-py:test/echoes-generated").unwrap();
842842
let instance = pre.instantiate_async(&mut *store).await?;
843843
Ok((Self::World {{
844844
{typed_function_inits}

0 commit comments

Comments
 (0)