diff --git a/crates/metal2vulkan-air/src/container/tests.rs b/crates/metal2vulkan-air/src/container/tests.rs index b0593f261..6ec7d609a 100644 --- a/crates/metal2vulkan-air/src/container/tests.rs +++ b/crates/metal2vulkan-air/src/container/tests.rs @@ -1101,16 +1101,28 @@ fn committed_air_fixtures_parse_and_link() { return; } let out = std::env::temp_dir().join(format!("m2v-container-{}.metallib", std::process::id())); - let status = std::process::Command::new("xcrun") + let linked = std::process::Command::new("xcrun") .args(["-sdk", "macosx", "metallib"]) .args(&airs) .arg("-o") .arg(&out) - .status() + .output() .unwrap(); let bytes = std::fs::read(&out); let _ = std::fs::remove_file(&out); - assert!(status.success()); + let stderr = String::from_utf8_lossy(&linked.stderr); + // The fixtures are compiled by the SDK `scripts/regen-air-fixtures` ran on; an older SDK's + // linker refuses their newer AIR version ("air version set to 2.9.0 ..., but expecting 2.8"). + // That linker cannot link them at all, so the half that compares with Apple's link is skipped + // there; the parse half above has run. + if !linked.status.success() + && stderr.contains("air version set to") + && stderr.contains("but expecting") + { + eprintln!("SKIPPED metallib half: this SDK's metallib links an older AIR version than the fixtures': {}", stderr.trim()); + return; + } + assert!(linked.status.success(), "xcrun metallib: {stderr}"); let bytes = bytes.unwrap(); let lib = metallib(&bytes); assert_eq!(lib.functions.len(), entries);