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

Function check_wat

tests/all/native_debug/simulate.rs:9–25  ·  view source on GitHub ↗
(wat: &str)

Source from the content-addressed store, hash-verified

7
8#[allow(dead_code, reason = "used by conditionally-defined tests below")]
9fn check_wat(wat: &str) -> Result<()> {
10 let wasm = parse_str(wat)?;
11 let obj_file = NamedTempFile::new()?;
12 let obj_path = obj_file.path().to_str().unwrap();
13 compile_cranelift(&wasm, None, None, obj_path)?;
14 let dump = get_dwarfdump(obj_path, DwarfDumpSection::DebugInfo)?;
15 let mut builder = CheckerBuilder::new();
16 builder
17 .text(wat)
18 .map_err(|e| format_err!("unable to build checker: {e:?}"))?;
19 let checker = builder.finish();
20 let check = checker
21 .explain(&dump, NO_VARIABLES)
22 .map_err(|e| format_err!("{e:?}"))?;
23 assert!(check.0, "didn't pass check {}", check.1);
24 Ok(())
25}
26
27#[test]
28#[ignore]

Calls 9

compile_craneliftFunction · 0.85
get_dwarfdumpFunction · 0.85
OkFunction · 0.85
to_strMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
textMethod · 0.45
finishMethod · 0.45