Refactor wasm-abi
to use cmd
This commit is contained in:
parent
68b6bb27c1
commit
0c1df370ca
@ -1,9 +1,8 @@
|
|||||||
//@ only-wasm32-wasip1
|
//@ only-wasm32-wasip1
|
||||||
//@ needs-wasmtime
|
//@ needs-wasmtime
|
||||||
|
|
||||||
use run_make_support::rustc;
|
use run_make_support::{cmd, rustc};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rustc().input("foo.rs").target("wasm32-wasip1").run();
|
rustc().input("foo.rs").target("wasm32-wasip1").run();
|
||||||
@ -19,14 +18,12 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run(file: &Path, method: &str, expected_output: &str) {
|
fn run(file: &Path, method: &str, expected_output: &str) {
|
||||||
let output = Command::new("wasmtime")
|
cmd("wasmtime")
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("--preload=host=host.wat")
|
.arg("--preload=host=host.wat")
|
||||||
.arg("--invoke")
|
.arg("--invoke")
|
||||||
.arg(method)
|
.arg(method)
|
||||||
.arg(file)
|
.arg(file)
|
||||||
.output()
|
.run()
|
||||||
.unwrap();
|
.assert_stdout_equals(expected_output);
|
||||||
assert!(output.status.success());
|
|
||||||
assert_eq!(expected_output, String::from_utf8_lossy(&output.stdout));
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user