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

Method new

tests/disas.rs:172–190  ·  view source on GitHub ↗

Parse the contents of `path` looking for directive-based comments starting with `;;!` near the top of the file.

(path: &Path)

Source from the content-addressed store, hash-verified

170 /// Parse the contents of `path` looking for directive-based comments
171 /// starting with `;;!` near the top of the file.
172 fn new(path: &Path) -> Result<Test> {
173 let contents =
174 std::fs::read_to_string(path).with_context(|| format!("failed to read {path:?}"))?;
175 let config: TestConfig = wasmtime_test_util::wast::parse_test_config(&contents, ";;!")
176 .context("failed to parse test configuration as TOML")?;
177 let mut flags = vec!["wasmtime"];
178 if let Some(config) = &config.flags {
179 flags.extend(config.to_vec());
180 }
181 let mut opts = wasmtime_cli_flags::CommonOptions::try_parse_from(&flags)?;
182 opts.codegen.cranelift_debug_verifier = Some(true);
183
184 Ok(Test {
185 path: path.to_path_buf(),
186 config,
187 opts,
188 contents,
189 })
190 }
191
192 /// Generates CLIF for all the wasm functions in this test.
193 fn compile(&mut self) -> Result<CompileOutput> {

Callers

nothing calls this directly

Calls 7

read_to_stringFunction · 0.85
parse_test_configFunction · 0.85
OkFunction · 0.85
with_contextMethod · 0.80
contextMethod · 0.45
extendMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected