MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / find_tests

Function find_tests

tests/wasi.rs:114–150  ·  view source on GitHub ↗
(path: &Path, trials: &mut Vec<Trial>)

Source from the content-addressed store, hash-verified

112}
113
114fn 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
152fn run_test(path: &Path, componentize: bool) -> Result<()> {
153 let wasmtime = Path::new(env!("CARGO_BIN_EXE_wasmtime"));

Callers 2

mainFunction · 0.70
mainFunction · 0.70

Calls 10

OkFunction · 0.85
is_dirMethod · 0.80
to_strMethod · 0.80
anyMethod · 0.80
run_testFunction · 0.70
testFunction · 0.50
pathMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected