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

Function validate_deterministic

tests/all/module.rs:565–585  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

563#[test]
564#[cfg_attr(miri, ignore)]
565fn validate_deterministic() {
566 let mut faulty_wat = "(module ".to_string();
567 for i in 0..100 {
568 faulty_wat.push_str(&format!(
569 "(func (export \"foo_{i}\") (result i64) (i64.add (i32.const 0) (i64.const 1)))"
570 ));
571 }
572 faulty_wat.push_str(")");
573 let binary = wat::parse_str(faulty_wat).unwrap();
574
575 let engine_parallel = Engine::new(&Config::new().parallel_compilation(true)).unwrap();
576 let result_parallel = Module::validate(&engine_parallel, &binary)
577 .unwrap_err()
578 .to_string();
579
580 let engine_sequential = Engine::new(&Config::new().parallel_compilation(false)).unwrap();
581 let result_sequential = Module::validate(&engine_sequential, &binary)
582 .unwrap_err()
583 .to_string();
584 assert_eq!(result_parallel, result_sequential);
585}
586
587#[test]
588#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 6

newFunction · 0.50
validateFunction · 0.50
to_stringMethod · 0.45
push_strMethod · 0.45
unwrapMethod · 0.45
parallel_compilationMethod · 0.45

Tested by

no test coverage detected