mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
Fixed example testing
This commit is contained in:
parent
21cef317b1
commit
8a669cfda5
@ -18,6 +18,7 @@ include = [
|
|||||||
"/README.md",
|
"/README.md",
|
||||||
"rustfmt.toml"
|
"rustfmt.toml"
|
||||||
]
|
]
|
||||||
|
autoexamples = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atty = "0.2"
|
atty = "0.2"
|
||||||
@ -123,9 +124,10 @@ managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
|
|||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "plugin"
|
name = "plugin"
|
||||||
required-features = ["wasi"]
|
required-features = ["wasi", "backend-cranelift"]
|
||||||
crate-type = ["bin"]
|
crate-type = ["bin"]
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "callback"
|
name = "callback"
|
||||||
crate-type = ["bin"]
|
crate-type = ["bin"]
|
||||||
|
required-features = ["backend-cranelift"]
|
||||||
|
6
Makefile
6
Makefile
@ -216,9 +216,9 @@ integration-tests: release-clif examples
|
|||||||
./tests/integration_tests/cowsay/test.sh
|
./tests/integration_tests/cowsay/test.sh
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
cargo run --example plugin
|
cargo build --release $(backend_features) --examples
|
||||||
cargo run --example callback
|
test -f target/release/examples/callbackx && ./target/release/examples/callback || echo "skipping callback test"
|
||||||
|
test -f target/release/examples/pluginx && ./target/release/examples/plugin || echo "skipping plugin test"
|
||||||
|
|
||||||
# Utils
|
# Utils
|
||||||
lint:
|
lint:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// This example demonstrates the use of callbacks: calling functions (Host and Wasm)
|
/// This example demonstrates the use of callbacks: calling functions (Host and Wasm)
|
||||||
/// passed to us from the Wasm via hostcall
|
/// passed to us from the Wasm via hostcall
|
||||||
use wasmer_runtime::{compile_with, compiler_for_backend, func, imports, Backend, Ctx, Func};
|
use wasmer::{compiler::compile, func, imports, vm::Ctx, Func};
|
||||||
use wasmer_runtime_core::{structures::TypedIndex, types::TableIndex};
|
use wasmer_runtime_core::{structures::TypedIndex, types::TableIndex};
|
||||||
|
|
||||||
static WASM: &'static str = "examples/callback-guest/callback-guest.wasm";
|
static WASM: &'static str = "examples/callback-guest/callback-guest.wasm";
|
||||||
@ -34,8 +34,7 @@ fn main() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let compiler = compiler_for_backend(Backend::default()).unwrap();
|
let module = compile(&wasm_bytes[..]).unwrap();
|
||||||
let module = compile_with(&wasm_bytes[..], compiler.as_ref()).unwrap();
|
|
||||||
let instance = module
|
let instance = module
|
||||||
.instantiate(&imports)
|
.instantiate(&imports)
|
||||||
.expect("failed to instantiate wasm module");
|
.expect("failed to instantiate wasm module");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use wasmer_runtime::{compile, func, imports, Ctx, Func};
|
use wasmer::compiler::compile;
|
||||||
|
use wasmer::{func, imports, vm::Ctx, Func};
|
||||||
use wasmer_wasi::{
|
use wasmer_wasi::{
|
||||||
generate_import_object_for_version,
|
generate_import_object_for_version,
|
||||||
state::{self, WasiFile, WasiFsError},
|
state::{self, WasiFile, WasiFsError},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user