From bb17468c990ba2ef819e5d3349539bb7a4aaedbd Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 29 Aug 2026 14:34:58 +0200 Subject: chore: improve optimizer and simplify function execution - add stack-constant and fused local-update rewrites - split host and Wasm function storage and execution paths - add the default full feature - recursively discover WAST test files Signed-off-by: Henry --- crates/cli/Cargo.toml | 5 +---- crates/cli/src/wast_runner.rs | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'crates/cli') diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 069a4e2..861d349 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -32,15 +32,12 @@ pretty_env_logger.workspace = true serde = { workspace = true, optional = true } serde_json = { workspace = true, optional = true } tinywasm = { workspace = true, features = [ - "archive", "canonicalize-nans", "debug", + "full", "guest-debug", "log", - "parallel-parser", - "parser", "std", - "validate", ] } wasm-testsuite = { workspace = true, optional = true } wast = { workspace = true, optional = true } diff --git a/crates/cli/src/wast_runner.rs b/crates/cli/src/wast_runner.rs index 0cd5c34..02add87 100644 --- a/crates/cli/src/wast_runner.rs +++ b/crates/cli/src/wast_runner.rs @@ -669,17 +669,20 @@ struct TestCase { fn expand_paths(paths: &[PathBuf]) -> Result> { let mut files = Vec::new(); - for path in paths { + let mut pending = paths.to_vec(); + while let Some(path) = pending.pop() { if path.is_dir() { - for entry in std::fs::read_dir(path)? { + for entry in std::fs::read_dir(&path)? { let entry = entry?; let path = entry.path(); - if path.extension().is_some_and(|ext| ext == "wast") { + if entry.file_type()?.is_dir() { + pending.push(path); + } else if path.extension().is_some_and(|ext| ext == "wast") { files.push(path); } } } else { - files.push(path.clone()); + files.push(path); } } files.sort(); @@ -973,6 +976,18 @@ mod tests { runner.run_paths(&[path]).unwrap(); } + #[test] + fn recursively_runs_wast_files_and_ignores_other_files() { + let dir = tempfile::tempdir().unwrap(); + let nested = dir.path().join("nested"); + std::fs::create_dir(&nested).unwrap(); + std::fs::write(dir.path().join("README.md"), "not a wast file").unwrap(); + std::fs::write(nested.join("simple.wast"), "(module)").unwrap(); + + let mut runner = WastRunner::new(); + runner.run_paths(&[dir.path().to_path_buf()]).unwrap(); + } + #[test] fn runs_module_definition_and_instance_directives() { let dir = tempfile::tempdir().unwrap(); -- cgit v1.3.1