From 10c5479b9e30b12df769c8d3b4443d4b2c045d06 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Fri, 28 Jun 2024 20:00:54 +1000 Subject: [PATCH] fix(apple): safer removal of archs for binaries --- .../malinskiy/marathon/apple/xctestrun/TestRootFactory.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/vendor-apple/base/src/main/kotlin/com/malinskiy/marathon/apple/xctestrun/TestRootFactory.kt b/vendor/vendor-apple/base/src/main/kotlin/com/malinskiy/marathon/apple/xctestrun/TestRootFactory.kt index 1dffb9d7a..cd084e516 100644 --- a/vendor/vendor-apple/base/src/main/kotlin/com/malinskiy/marathon/apple/xctestrun/TestRootFactory.kt +++ b/vendor/vendor-apple/base/src/main/kotlin/com/malinskiy/marathon/apple/xctestrun/TestRootFactory.kt @@ -439,10 +439,11 @@ class TestRootFactory( } } else if (device.sdk == Sdk.IPHONESIMULATOR) { val supportedArchs = device.binaryEnvironment.lipo.getArch(testBinary) - if (supportedArchs.contains(Arch.x86_64) && device.arch != Arch.arm64) { + val testRunnerArchs = device.binaryEnvironment.lipo.getArch(testRunnerBinary) + if (supportedArchs.contains(Arch.x86_64) && device.arch != Arch.arm64 && testRunnerArchs.contains(Arch.arm64)) { // Launch as plain x86_64 if test binary has been built for simulator and is targeting x86_64 device.binaryEnvironment.lipo.removeArch(testRunnerBinary, Arch.arm64) - } else if (supportedArchs.contains(Arch.x86_64) && !supportedArchs.contains(Arch.arm64)) { + } else if (supportedArchs.contains(Arch.x86_64) && !supportedArchs.contains(Arch.arm64) && testRunnerArchs.contains(Arch.arm64)) { // Launch as plain x86_64 if test binary supports only x86_64 device.binaryEnvironment.lipo.removeArch(testRunnerBinary, Arch.arm64) }