Fixed example testing

This commit is contained in:
Syrus 2020-04-15 19:34:25 -07:00
parent 21cef317b1
commit 8a669cfda5
4 changed files with 10 additions and 8 deletions

View File

@ -18,6 +18,7 @@ include = [
"/README.md",
"rustfmt.toml"
]
autoexamples = false
[dependencies]
atty = "0.2"
@ -123,9 +124,10 @@ managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
[[example]]
name = "plugin"
required-features = ["wasi"]
required-features = ["wasi", "backend-cranelift"]
crate-type = ["bin"]
[[example]]
name = "callback"
crate-type = ["bin"]
required-features = ["backend-cranelift"]

View File

@ -216,9 +216,9 @@ integration-tests: release-clif examples
./tests/integration_tests/cowsay/test.sh
examples:
cargo run --example plugin
cargo run --example callback
cargo build --release $(backend_features) --examples
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
lint:

View File

@ -1,6 +1,6 @@
/// This example demonstrates the use of callbacks: calling functions (Host and Wasm)
/// 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};
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_with(&wasm_bytes[..], compiler.as_ref()).unwrap();
let module = compile(&wasm_bytes[..]).unwrap();
let instance = module
.instantiate(&imports)
.expect("failed to instantiate wasm module");

View File

@ -1,5 +1,6 @@
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::{
generate_import_object_for_version,
state::{self, WasiFile, WasiFsError},