Xcode Cloud macOS tests won't run on new Mac App template

  • Created a fresh Xcode project using the macOS App template.
  • Set up a Xcode Cloud Workflow with a "Test - macOS" action. Using the latest environment available, currently Xcode 14.1 (14B47b) and macOS Ventura 13 RC 2 (22A380).
  • App builds and tests run fine locally in Xcode 14.1 (14B47b).

But on Xcode Cloud, this is resulting in a code signing error when the test-without-building step is reached.

Foo (7828) 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 “FooTests” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests, 0x0109): tried: '/Volumes/workspace/TestProducts/Debug/FooTests' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/FooTests' (no such file), '/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests' (code signature in <AEE218C5-FDB4-3327-B270-99D8A86530EB> '/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests' (no such file), '/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests' (code signature in <AEE218C5-FDB4-3327-B270-99D8A86530EB> '/Volumes/workspace/TestProducts/Debug/Foo.app/Contents/PlugIns/FooTests.xctest/Contents/MacOS/FooTests' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?))))

I was able to narrow the command line flags Xcode Cloud is using to reproduce it locally. Running xcodebuild test -scheme Foo CODE_SIGN_IDENTITY=- locally results in a similar error.

Post not yet marked as solved Up vote post of joshpeek Down vote post of joshpeek
1.1k views
  • Same here. I tried a dozen times, and gave up last night. I now run the iOS iPadOS tests, but leave the macOS tests out. The file does exist in the artifacts, the tests run properly locally, but they fail to run outside my world.

Add a Comment

Replies

I discussed this with one of my colleagues and it seems that this is a known limitation in Xcode Cloud right now (r. 57169016)-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

My workaround is disabling hardened runtime in Xcode Cloud using a ci_scripts/ci_pre_xcodebuild.sh script:

#!/bin/sh

set -ex

if [ "$CI_PRODUCT_PLATFORM" = 'macOS' ] && [ "$CI_XCODEBUILD_ACTION" = 'build-for-testing' ]; then
	sed -i'~' 's/ENABLE_HARDENED_RUNTIME = YES;/ENABLE_HARDENED_RUNTIME = NO;/g' \
		"$CI_WORKSPACE/$CI_XCODE_PROJECT/project.pbxproj"
fi

Hope others find this useful until the issue is fixed.