A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Skip stack-switching wast tests when fuzzing with asan (#14223)
Alex Crichton3d6ff2526b96
diff --git a/crates/fuzzing/build.rs b/crates/fuzzing/build.rsindex ecad2fa00a..fb56827de9 100644--- a/crates/fuzzing/build.rs+++ b/crates/fuzzing/build.rs@@ -41,4 +41,21 @@ fn main() {code.push_str("];\n");std::fs::write(out_dir.join("wasttests.rs"), code).unwrap();++ // NB: duplicating a workaround in the wasmtime-fiber build script.+ custom_cfg("asan", cfg_is("sanitize", "address"));+}++fn cfg_is(key: &str, val: &str) -> bool {+ std::env::var(&format!("CARGO_CFG_{}", key.to_uppercase()))+ .ok()+ .as_deref()+ == Some(val)+}++fn custom_cfg(key: &str, enabled: bool) {+ println!("cargo:rustc-check-cfg=cfg({key})");+ if enabled {+ println!("cargo:rustc-cfg={key}");+ }}diff --git a/crates/fuzzing/src/oracles.rs b/crates/fuzzing/src/oracles.rsindex 007fa51046..199b53c00b 100644--- a/crates/fuzzing/src/oracles.rs+++ b/crates/fuzzing/src/oracles.rs@@ -620,6 +620,12 @@ pub fn wast_test(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<()> {let test = &test.test;+ // FIXME(#14222) stack-switching and asan aren't integrated yet, so skip+ // stack-switching tests when asan is enabled.+ if cfg!(asan) && test.config.stack_switching == Some(true) {+ return Err(arbitrary::Error::IncorrectFormat);+ }+if test.config.component_model_async() || u.arbitrary()? {fuzz_config.enable_async(u)?;}