diff options
| author | Henry <mail@henrygressmann.de> | 2026-08-29 14:34:58 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-08-29 14:34:58 +0200 |
| commit | bb17468c990ba2ef819e5d3349539bb7a4aaedbd (patch) | |
| tree | 2ac9acd6c213340c394ce3126c6025d54121db4e /crates/cli | |
| parent | e73c92160041ed0db5bda81e5c55b0e4c6293a87 (diff) | |
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 <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli')
| -rw-r--r-- | crates/cli/Cargo.toml | 5 | ||||
| -rw-r--r-- | crates/cli/src/wast_runner.rs | 23 |
2 files changed, 20 insertions, 8 deletions
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<Vec<PathBuf>> { 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(); @@ -974,6 +977,18 @@ mod tests { } #[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(); let path = dir.path().join("instance.wast"); |
