Add a few CLI tests for WASI. (#1281)

While here, move rs2wasm-add-func.wat into the same directory as the
other .wat tests to keep things tidy.
This commit is contained in:
Dan Gohman
2020-03-18 15:41:58 -07:00
committed by GitHub
parent f63c3c814e
commit 1c55eb1a8b
5 changed files with 69 additions and 2 deletions

View File

@@ -103,6 +103,23 @@ fn run_wasmtime_unreachable_wat() -> Result<()> {
assert_eq!(code, 128 + libc::SIGABRT);
#[cfg(windows)]
assert_eq!(code, 3);
Ok(())
}
// Run a simple WASI hello world, snapshot0 edition.
#[test]
fn hello_wasi_snapshot0() -> Result<()> {
let wasm = build_wasm("tests/wasm/hello_wasi_snapshot0.wat")?;
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
assert_eq!(stdout, "Hello, world!\n");
Ok(())
}
// Run a simple WASI hello world, snapshot1 edition.
#[test]
fn hello_wasi_snapshot1() -> Result<()> {
let wasm = build_wasm("tests/wasm/hello_wasi_snapshot1.wat")?;
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
assert_eq!(stdout, "Hello, world!\n");
Ok(())
}