refactor: move Wasm test files to tests/all/cli_tests
Previously the inputs to `tests/all/cli_tests.rs` were contained in `tests/wasm`. This change moves them to the more obvious `tests/all/cli_tests` directory and updates the paths that point to them.
This commit is contained in:
@@ -55,7 +55,7 @@ fn build_wasm(wat_path: impl AsRef<Path>) -> Result<NamedTempFile> {
|
|||||||
// Very basic use case: compile binary wasm file and run specific function with arguments.
|
// Very basic use case: compile binary wasm file and run specific function with arguments.
|
||||||
#[test]
|
#[test]
|
||||||
fn run_wasmtime_simple() -> Result<()> {
|
fn run_wasmtime_simple() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/simple.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/simple.wat")?;
|
||||||
run_wasmtime(&[
|
run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -70,7 +70,7 @@ fn run_wasmtime_simple() -> Result<()> {
|
|||||||
// Wasmtime shakk when not enough arguments were provided.
|
// Wasmtime shakk when not enough arguments were provided.
|
||||||
#[test]
|
#[test]
|
||||||
fn run_wasmtime_simple_fail_no_args() -> Result<()> {
|
fn run_wasmtime_simple_fail_no_args() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/simple.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/simple.wat")?;
|
||||||
assert!(
|
assert!(
|
||||||
run_wasmtime(&[
|
run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
@@ -88,7 +88,7 @@ fn run_wasmtime_simple_fail_no_args() -> Result<()> {
|
|||||||
// Running simple wat
|
// Running simple wat
|
||||||
#[test]
|
#[test]
|
||||||
fn run_wasmtime_simple_wat() -> Result<()> {
|
fn run_wasmtime_simple_wat() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/simple.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/simple.wat")?;
|
||||||
run_wasmtime(&[
|
run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -123,7 +123,7 @@ fn run_wasmtime_simple_wat() -> Result<()> {
|
|||||||
// Running a wat that traps.
|
// Running a wat that traps.
|
||||||
#[test]
|
#[test]
|
||||||
fn run_wasmtime_unreachable_wat() -> Result<()> {
|
fn run_wasmtime_unreachable_wat() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/unreachable.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/unreachable.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
|
|
||||||
assert_ne!(output.stderr, b"");
|
assert_ne!(output.stderr, b"");
|
||||||
@@ -146,7 +146,7 @@ fn run_wasmtime_unreachable_wat() -> Result<()> {
|
|||||||
// Run a simple WASI hello world, snapshot0 edition.
|
// Run a simple WASI hello world, snapshot0 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn hello_wasi_snapshot0() -> Result<()> {
|
fn hello_wasi_snapshot0() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/hello_wasi_snapshot0.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/hello_wasi_snapshot0.wat")?;
|
||||||
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(stdout, "Hello, world!\n");
|
assert_eq!(stdout, "Hello, world!\n");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -155,7 +155,7 @@ fn hello_wasi_snapshot0() -> Result<()> {
|
|||||||
// Run a simple WASI hello world, snapshot1 edition.
|
// Run a simple WASI hello world, snapshot1 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn hello_wasi_snapshot1() -> Result<()> {
|
fn hello_wasi_snapshot1() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/hello_wasi_snapshot1.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/hello_wasi_snapshot1.wat")?;
|
||||||
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(stdout, "Hello, world!\n");
|
assert_eq!(stdout, "Hello, world!\n");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -163,7 +163,7 @@ fn hello_wasi_snapshot1() -> Result<()> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn timeout_in_start() -> Result<()> {
|
fn timeout_in_start() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/iloop-start.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/iloop-start.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[
|
let output = run_wasmtime_for_output(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -184,7 +184,7 @@ fn timeout_in_start() -> Result<()> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn timeout_in_invoke() -> Result<()> {
|
fn timeout_in_invoke() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/iloop-invoke.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/iloop-invoke.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[
|
let output = run_wasmtime_for_output(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -206,7 +206,7 @@ fn timeout_in_invoke() -> Result<()> {
|
|||||||
// Exit with a valid non-zero exit code, snapshot0 edition.
|
// Exit with a valid non-zero exit code, snapshot0 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit2_wasi_snapshot0() -> Result<()> {
|
fn exit2_wasi_snapshot0() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit2_wasi_snapshot0.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit2_wasi_snapshot0.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(output.status.code().unwrap(), 2);
|
assert_eq!(output.status.code().unwrap(), 2);
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -215,7 +215,7 @@ fn exit2_wasi_snapshot0() -> Result<()> {
|
|||||||
// Exit with a valid non-zero exit code, snapshot1 edition.
|
// Exit with a valid non-zero exit code, snapshot1 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit2_wasi_snapshot1() -> Result<()> {
|
fn exit2_wasi_snapshot1() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit2_wasi_snapshot1.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit2_wasi_snapshot1.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(output.status.code().unwrap(), 2);
|
assert_eq!(output.status.code().unwrap(), 2);
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -224,7 +224,7 @@ fn exit2_wasi_snapshot1() -> Result<()> {
|
|||||||
// Exit with a valid non-zero exit code, snapshot0 edition.
|
// Exit with a valid non-zero exit code, snapshot0 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit125_wasi_snapshot0() -> Result<()> {
|
fn exit125_wasi_snapshot0() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit125_wasi_snapshot0.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit125_wasi_snapshot0.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert_eq!(output.status.code().unwrap(), 1);
|
assert_eq!(output.status.code().unwrap(), 1);
|
||||||
@@ -237,7 +237,7 @@ fn exit125_wasi_snapshot0() -> Result<()> {
|
|||||||
// Exit with a valid non-zero exit code, snapshot1 edition.
|
// Exit with a valid non-zero exit code, snapshot1 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit125_wasi_snapshot1() -> Result<()> {
|
fn exit125_wasi_snapshot1() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit125_wasi_snapshot1.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit125_wasi_snapshot1.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert_eq!(output.status.code().unwrap(), 1);
|
assert_eq!(output.status.code().unwrap(), 1);
|
||||||
@@ -250,7 +250,7 @@ fn exit125_wasi_snapshot1() -> Result<()> {
|
|||||||
// Exit with an invalid non-zero exit code, snapshot0 edition.
|
// Exit with an invalid non-zero exit code, snapshot0 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit126_wasi_snapshot0() -> Result<()> {
|
fn exit126_wasi_snapshot0() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit126_wasi_snapshot0.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit126_wasi_snapshot0.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert_eq!(output.status.code().unwrap(), 3);
|
assert_eq!(output.status.code().unwrap(), 3);
|
||||||
@@ -265,7 +265,7 @@ fn exit126_wasi_snapshot0() -> Result<()> {
|
|||||||
// Exit with an invalid non-zero exit code, snapshot1 edition.
|
// Exit with an invalid non-zero exit code, snapshot1 edition.
|
||||||
#[test]
|
#[test]
|
||||||
fn exit126_wasi_snapshot1() -> Result<()> {
|
fn exit126_wasi_snapshot1() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit126_wasi_snapshot1.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit126_wasi_snapshot1.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert_eq!(output.status.code().unwrap(), 3);
|
assert_eq!(output.status.code().unwrap(), 3);
|
||||||
@@ -280,7 +280,7 @@ fn exit126_wasi_snapshot1() -> Result<()> {
|
|||||||
// Run a minimal command program.
|
// Run a minimal command program.
|
||||||
#[test]
|
#[test]
|
||||||
fn minimal_command() -> Result<()> {
|
fn minimal_command() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/minimal-command.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/minimal-command.wat")?;
|
||||||
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(stdout, "");
|
assert_eq!(stdout, "");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -289,7 +289,7 @@ fn minimal_command() -> Result<()> {
|
|||||||
// Run a minimal reactor program.
|
// Run a minimal reactor program.
|
||||||
#[test]
|
#[test]
|
||||||
fn minimal_reactor() -> Result<()> {
|
fn minimal_reactor() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/minimal-reactor.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/minimal-reactor.wat")?;
|
||||||
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let stdout = run_wasmtime(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(stdout, "");
|
assert_eq!(stdout, "");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -298,7 +298,7 @@ fn minimal_reactor() -> Result<()> {
|
|||||||
// Attempt to call invoke on a command.
|
// Attempt to call invoke on a command.
|
||||||
#[test]
|
#[test]
|
||||||
fn command_invoke() -> Result<()> {
|
fn command_invoke() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/minimal-command.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/minimal-command.wat")?;
|
||||||
run_wasmtime(&[
|
run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -312,7 +312,7 @@ fn command_invoke() -> Result<()> {
|
|||||||
// Attempt to call invoke on a command.
|
// Attempt to call invoke on a command.
|
||||||
#[test]
|
#[test]
|
||||||
fn reactor_invoke() -> Result<()> {
|
fn reactor_invoke() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/minimal-reactor.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/minimal-reactor.wat")?;
|
||||||
run_wasmtime(&[
|
run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
@@ -326,13 +326,13 @@ fn reactor_invoke() -> Result<()> {
|
|||||||
// Run the greeter test, which runs a preloaded reactor and a command.
|
// Run the greeter test, which runs a preloaded reactor and a command.
|
||||||
#[test]
|
#[test]
|
||||||
fn greeter() -> Result<()> {
|
fn greeter() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/greeter_command.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/greeter_command.wat")?;
|
||||||
let stdout = run_wasmtime(&[
|
let stdout = run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
"--disable-cache",
|
"--disable-cache",
|
||||||
"--preload",
|
"--preload",
|
||||||
"reactor=tests/wasm/greeter_reactor.wat",
|
"reactor=tests/all/cli_tests/greeter_reactor.wat",
|
||||||
])?;
|
])?;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
stdout,
|
stdout,
|
||||||
@@ -344,13 +344,13 @@ fn greeter() -> Result<()> {
|
|||||||
// Run the greeter test, but this time preload a command.
|
// Run the greeter test, but this time preload a command.
|
||||||
#[test]
|
#[test]
|
||||||
fn greeter_preload_command() -> Result<()> {
|
fn greeter_preload_command() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/greeter_reactor.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/greeter_reactor.wat")?;
|
||||||
let stdout = run_wasmtime(&[
|
let stdout = run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
"--disable-cache",
|
"--disable-cache",
|
||||||
"--preload",
|
"--preload",
|
||||||
"reactor=tests/wasm/hello_wasi_snapshot1.wat",
|
"reactor=tests/all/cli_tests/hello_wasi_snapshot1.wat",
|
||||||
])?;
|
])?;
|
||||||
assert_eq!(stdout, "Hello _initialize\n");
|
assert_eq!(stdout, "Hello _initialize\n");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -359,13 +359,13 @@ fn greeter_preload_command() -> Result<()> {
|
|||||||
// Run the greeter test, which runs a preloaded reactor and a command.
|
// Run the greeter test, which runs a preloaded reactor and a command.
|
||||||
#[test]
|
#[test]
|
||||||
fn greeter_preload_callable_command() -> Result<()> {
|
fn greeter_preload_callable_command() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/greeter_command.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/greeter_command.wat")?;
|
||||||
let stdout = run_wasmtime(&[
|
let stdout = run_wasmtime(&[
|
||||||
"run",
|
"run",
|
||||||
wasm.path().to_str().unwrap(),
|
wasm.path().to_str().unwrap(),
|
||||||
"--disable-cache",
|
"--disable-cache",
|
||||||
"--preload",
|
"--preload",
|
||||||
"reactor=tests/wasm/greeter_callable_command.wat",
|
"reactor=tests/all/cli_tests/greeter_callable_command.wat",
|
||||||
])?;
|
])?;
|
||||||
assert_eq!(stdout, "Hello _start\nHello callable greet\nHello done\n");
|
assert_eq!(stdout, "Hello _start\nHello callable greet\nHello done\n");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -375,7 +375,7 @@ fn greeter_preload_callable_command() -> Result<()> {
|
|||||||
// See https://github.com/bytecodealliance/wasmtime/issues/1967
|
// See https://github.com/bytecodealliance/wasmtime/issues/1967
|
||||||
#[test]
|
#[test]
|
||||||
fn exit_with_saved_fprs() -> Result<()> {
|
fn exit_with_saved_fprs() -> Result<()> {
|
||||||
let wasm = build_wasm("tests/wasm/exit_with_saved_fprs.wat")?;
|
let wasm = build_wasm("tests/all/cli_tests/exit_with_saved_fprs.wat")?;
|
||||||
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
let output = run_wasmtime_for_output(&[wasm.path().to_str().unwrap(), "--disable-cache"])?;
|
||||||
assert_eq!(output.status.code().unwrap(), 0);
|
assert_eq!(output.status.code().unwrap(), 0);
|
||||||
assert!(output.stdout.is_empty());
|
assert!(output.stdout.is_empty());
|
||||||
|
|||||||
Reference in New Issue
Block a user