Mac Catalyst unit test fail to run

I'm just starting out with Xcode Cloud and trying to get a simple example running. I've got a basic 'Hello World' project with a couple of unit tests that I'm building for iPhone, iPad and Mac Catalyst. Running unit tests locally works fine on both iOS and Mac. My Xcode Cloud workflow has an action for iOS unit tests and Mac unit tests. The iOS tests run fine but the test bundle for Mac fails to load with this message:

HelloWorldOCL (5739) encountered an error (Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle at /Volumes/workspace/resultbundle.xcresult. (Underlying Error: The bundle “HelloWorldOCLTests” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/Volumes/workspace/TestProducts/Debug-maccatalyst/HelloWorldOCL.app/Contents/PlugIns/HelloWorldOCLTests.xctest/Contents/MacOS/HelloWorldOCLTests, 0x0109): tried: '/Volumes/workspace/TestProducts/Debug-maccatalyst/HelloWorldOCLTests' (no such file), '/System/iOSSupport/Volumes/workspace/TestProducts/Debug-maccatalyst/HelloWorldOCL.app/Contents/PlugIns/HelloWorldOCLTests.xctest/Contents/MacOS/HelloWorldOCLTests' (no such file), '/Volumes/workspace/TestProducts/Debug-maccatalyst/HelloWorldOCL.app/Contents/PlugIns/HelloWorldOCLTests.xctest/Contents/MacOS/HelloWorldOCLTests' (code signature in <9E48F794-E3BB-38B4-BFE5-3C5932331003> '/Volumes/workspace/TestProducts/Debug-maccatalyst/HelloWorldOCL.app/Contents/PlugIns/HelloWorldOCLTests.xctest/Contents/MacOS/HelloWorldOCLTests' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/usr/lib/HelloWorldOCLTests' (no such file)))

The project setup is pretty basic. Code signing is set to automatic with the team specified. It all works locally, so I'm not quite sure how to proceed. Any suggestions welcome. Thanks!

This is a known issue in Xcode Cloud. The current workaround is to set the "Enabled Hardened Runtime" build setting to "NO" for test targets.

Let us know if that fixes your issue!

This is the same issue I'm seeing on a SwiftUI App-Kit based app as well.

The test target was already disabling Enable Hardened Runtime though, but the app target had it enabled. And of course, Xcode issues warnings if you have it disabled for the app target.

Is this correct that we effectively have to build with Hardened Runtime disabled for the app to work around this bug and live with the Xcode project warning for now?

You can disable Hardened Runtime in the Debug Configuration only for the main app target. That way the tests will run (workaround around the known issue), and you'll still have hardened runtime turned on when doing an archive for release.

Mac Catalyst unit test fail to run
 
 
Q