From 0d94a51ec8df2c70dba4027ecb2886bb0f07f9e6 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 27 Mar 2026 02:35:25 -0400 Subject: [PATCH] fix(cli): skip platform-specific test assertions when tools are unavailable (#5386) The test_harnesses::run_harness test panics on machines without Android NDK/SDK installed and on non-macOS platforms for iOS assertions. Skip these assertions gracefully instead of failing the entire test suite. - Android assertions: skip when get_android_tools() returns None - iOS assertions: skip when not running on macOS --- packages/cli/src/test_harnesses.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/cli/src/test_harnesses.rs b/packages/cli/src/test_harnesses.rs index e1606102c..c5317883e 100644 --- a/packages/cli/src/test_harnesses.rs +++ b/packages/cli/src/test_harnesses.rs @@ -100,16 +100,27 @@ async fn test_harnesses() { assert_eq!(t.client.bundle, BundleFormat::host()); }) .asrt(r#"dx build --ios"#, |targets| async move { + if cfg!(not(target_os = "macos")) { + // iOS builds require Xcode toolchain, only available on macOS + return; + } let t = targets.unwrap(); assert_eq!(t.client.bundle, BundleFormat::Ios); assert_eq!(t.client.triple, TestHarnessBuilder::host_ios_triple_sim()); }) .asrt(r#"dx build --ios --device"#, |targets| async move { + if cfg!(not(target_os = "macos")) { + return; + } let targets = targets.unwrap(); assert_eq!(targets.client.bundle, BundleFormat::Ios); assert_eq!(targets.client.triple, "aarch64-apple-ios".parse().unwrap()); }) .asrt(r#"dx build --android --device"#, |targets| async move { + if crate::get_android_tools().is_none() { + // Skip when Android NDK/SDK is not installed + return; + } let t = targets.unwrap(); assert_eq!(t.client.bundle, BundleFormat::Android); assert_eq!(t.client.triple, "aarch64-linux-android".parse().unwrap()); @@ -131,6 +142,10 @@ async fn test_harnesses() { assert_eq!(server.triple, Triple::host()); }) .asrt(r#"dx build --ios"#, |targets| async move { + if cfg!(not(target_os = "macos")) { + // iOS builds require Xcode toolchain, only available on macOS + return; + } let t = targets.unwrap(); assert_eq!(t.client.bundle, BundleFormat::Ios); assert_eq!(t.client.triple, TestHarnessBuilder::host_ios_triple_sim()); @@ -231,6 +246,10 @@ async fn test_harnesses() { .asrt( r#"dx build --ios"#, |targets| async move { + if cfg!(not(target_os = "macos")) { + // iOS builds require Xcode toolchain, only available on macOS + return; + } let t = targets.unwrap(); assert!(t.server.is_none()); assert_eq!(t.client.bundle, BundleFormat::Ios);