summaryrefslogtreecommitdiff
path: root/crates/cli/src/wast_runner.rs
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-08-29 14:34:58 +0200
committerHenry <mail@henrygressmann.de>2026-08-29 14:34:58 +0200
commitbb17468c990ba2ef819e5d3349539bb7a4aaedbd (patch)
tree2ac9acd6c213340c394ce3126c6025d54121db4e /crates/cli/src/wast_runner.rs
parente73c92160041ed0db5bda81e5c55b0e4c6293a87 (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/src/wast_runner.rs')
-rw-r--r--crates/cli/src/wast_runner.rs23
1 files changed, 19 insertions, 4 deletions
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");