| 112 | } |
| 113 | |
| 114 | fn find_tests(path: &Path, trials: &mut Vec<Trial>) -> Result<()> { |
| 115 | for entry in path.read_dir()? { |
| 116 | let entry = entry?; |
| 117 | let path = entry.path(); |
| 118 | if entry.file_type()?.is_dir() { |
| 119 | find_tests(&path, trials)?; |
| 120 | continue; |
| 121 | } |
| 122 | if path.extension().and_then(|s| s.to_str()) != Some("wasm") { |
| 123 | continue; |
| 124 | } |
| 125 | |
| 126 | // Test the core wasm itself. |
| 127 | trials.push(Trial::test( |
| 128 | format!("wasmtime-wasi - {}", path.display()), |
| 129 | { |
| 130 | let path = path.clone(); |
| 131 | move || run_test(&path, false).map_err(|e| format!("{e:?}").into()) |
| 132 | }, |
| 133 | )); |
| 134 | |
| 135 | // Also test the component version using the wasip1 adapter. Note that |
| 136 | // this is skipped for `wasi-threads` since that's not supported in |
| 137 | // components and it's also skipped for assemblyscript because that |
| 138 | // doesn't support the wasip1 adapter. |
| 139 | if !path.iter().any(|p| p == "wasm32-wasip3") |
| 140 | && !path.iter().any(|p| p == "wasi-threads") |
| 141 | && !path.iter().any(|p| p == "assemblyscript") |
| 142 | { |
| 143 | trials.push(Trial::test( |
| 144 | format!("wasip1 adapter - {}", path.display()), |
| 145 | move || run_test(&path, true).map_err(|e| format!("{e:?}").into()), |
| 146 | )); |
| 147 | } |
| 148 | } |
| 149 | Ok(()) |
| 150 | } |
| 151 | |
| 152 | fn run_test(path: &Path, componentize: bool) -> Result<()> { |
| 153 | let wasmtime = Path::new(env!("CARGO_BIN_EXE_wasmtime")); |