Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix the iOS CI build #176

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Attempt to fix the iOS CI build #176

wants to merge 7 commits into from

Conversation

mosra
Copy link
Owner

@mosra mosra commented Aug 16, 2023

This does a bunch of things:

  • with CMake 3.14+ it's no longer needed to use a custom toolchain file, simply setting CMAKE_SYSTEM_NAME to iOS does most of the work
  • for XCTest however, CMAKE_OSX_SYSROOT needs to be set to iphonesimulator (doesn't need to be a path, apparently) to make the right libraries found
  • then, since XCode 12 however, the xctest executable that's found by FindXCTest is working only for native macOS executables, which makes all tests break

Attempted solutions:

  • using xcodebuild test, and the futile attempts to speed that damn thing up, like test-without-building instead of test and using -only-test:, but even then each test run takes 30+ seconds
  • starting the simulator explicitly before running tests, which means probably that xcodebuild no longer starts it up and shuts it down for every test case, but still each test run takes 10+ seconds
  • there's actually a different xctest executable, /Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest, unfortunately it doesn't work out-of-the box either and relies on a ton of undocumented env vars set "just right"

All env vars supplied to it from xcodebuild are the following, as can be seen in ArgumentsTest in the CI output, and if all are set it works:

export IOS_SIMULATOR_SYSLOG_SOCKET=/tmp/com.apple.CoreSimulator.SimDevice.A8176C67-F1D0-4517-A6B5-A3495829BB1D/syslogsock
export SIMULATOR_SHARED_RESOURCES_DIRECTORY=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data
export XPC_SIMULATOR_LAUNCHD_NAME=com.apple.CoreSimulator.SimDevice.A8176C67-F1D0-4517-A6B5-A3495829BB1D
export DYLD_SHARED_CACHE_DIR=/Users/distiller/Library/Developer/CoreSimulator/Caches/dyld/20F71/com.apple.CoreSimulator.SimRuntime.iOS-14-5.18E182
export IPHONE_SIMULATOR_ROOT=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
export LS_ENABLE_BUNDLE_LOCALIZATION_CACHING=1
export SIMULATOR_HID_SYSTEM_MANAGER=/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Resources/Platforms/iphoneos/Library/Frameworks/SimulatorHID.framework
export SIMULATOR_MAINSCREEN_HEIGHT=2532
export SIMULATOR_MEMORY_WARNINGS=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/var/run/memory_warning_simulation
export SIMULATOR_AUDIO_DEVICES_PLIST_PATH=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/var/run/com.apple.coresimulator.audio.plist
export SIMULATOR_LOG_ROOT=/Users/distiller/Library/Logs/CoreSimulator/A8176C67-F1D0-4517-A6B5-A3495829BB1D
export SIMULATOR_RUNTIME_BUILD_VERSION=18E182
export DYLD_ROOT_PATH=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
export PATH=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/bin:/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/bin:/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/sbin:/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/sbin:/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/local/bin
export SIMULATOR_HOST_HOME=/Users/distiller
export SIMULATOR_ROOT=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
export IPHONE_SHARED_RESOURCES_DIRECTORY=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data
export IPHONE_TVOUT_EXTENDED_PROPERTIES="/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/Library/Application Support/Simulator/extended_display.plist"
export SIMULATOR_BOOT_TIME=1692094651
export SIMULATOR_CAPABILITIES="/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/DeviceTypes/iPhone 12.simdevicetype/Contents/Resources/capabilities.plist"
export SIMULATOR_FRAMEBUFFER_FRAMEWORK=/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Resources/Platforms/iphoneos/Library/PrivateFrameworks/SimFramebuffer.framework/SimFramebuffer
export SIMULATOR_LEGACY_ASSET_SUFFIX=iphone
export SIMULATOR_MAINSCREEN_PITCH=460.000000
export SIMULATOR_MAINSCREEN_WIDTH=1170
export SIMULATOR_MODEL_IDENTIFIER=iPhone13,2
export SIMULATOR_PRODUCT_CLASS=D53g
export SIMULATOR_RUNTIME_VERSION=14.5
export SIMULATOR_ARCHS=x86_64
export SIMULATOR_AUDIO_SETTINGS_PATH=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/var/run/simulatoraudio/audiosettings.plist
export SIMULATOR_DEVICE_NAME="iPhone 12"
export SIMULATOR_EXTENDED_DISPLAY_PROPERTIES="/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/Library/Application Support/Simulator/extended_display.plist"
export SIMULATOR_MAINSCREEN_SCALE=3.000000
export SIMULATOR_UDID=A8176C67-F1D0-4517-A6B5-A3495829BB1D
export SIMULATOR_VERSION_INFO="CoreSimulator 757.5 - Device: iPhone 12 (A8176C67-F1D0-4517-A6B5-A3495829BB1D) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 12"
export RUN_DESTINATION_DEVICE_NAME="iPhone 12"
export CA_ASSERT_MAIN_THREAD_TRANSACTIONS=0
export DYLD_LIBRARY_PATH=/Users/distiller/project/build-ios/Release/lib
export XCTestBundlePath=/Users/distiller/project/build-ios/Release/lib/UtilityArgumentsTestRunner.xctest
export RUN_DESTINATION_DEVICE_PLATFORM_IDENTIFIER=com.apple.platform.iphonesimulator
export MTC_CRASH_ON_REPORT=1
export RUN_DESTINATION_DEVICE_UDID=A8176C67-F1D0-4517-A6B5-A3495829BB1D
export __XCODE_BUILT_PRODUCTS_DIR_PATHS=/Users/distiller/project/build-ios/Release/lib
export __XPC_DYLD_LIBRARY_PATH=/Users/distiller/project/build-ios/Release/lib
export NSUnbufferedIO=YES
export XCTestSessionIdentifier=1318C309-2A13-40B3-B47B-B99C87CD0BCE
export XCTestConfigurationFilePath=
export OS_ACTIVITY_DT_MODE=YES
export __XPC_DYLD_FRAMEWORK_PATH=/Users/distiller/project/build-ios/Release/lib
export SQLITE_ENABLE_THREAD_ASSERTIONS=1
export CA_DEBUG_TRANSACTIONS=0
export DYLD_FRAMEWORK_PATH=/Users/distiller/project/build-ios/Release/lib
export XPC_SERVICE_NAME=com.apple.xpc.launchd.oneshot.0x10000000.xctest
export TESTMANAGERD_REMOTE_AUTOMATION_SIM_SOCK=/private/tmp/com.apple.launchd.5rU88t2Ehi/com.apple.testmanagerd.remote-automation.unix-domain.socket
export TESTMANAGERD_SIM_SOCK=/private/tmp/com.apple.launchd.pMD5m4njkX/com.apple.testmanagerd.unix-domain.socket
export CUPS_SERVER=/private/tmp/com.apple.launchd.dyYDCHY7Sl/Listeners
export RWI_LISTEN_SOCKET=/private/tmp/com.apple.launchd.l23jlUNq0c/com.apple.webinspectord_sim.socket
export DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks
export CFFIXED_USER_HOME=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data
export DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode-12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
export HOME=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data
export TMPDIR=/Users/distiller/Library/Developer/CoreSimulator/Devices/A8176C67-F1D0-4517-A6B5-A3495829BB1D/data/tmp/
export XPC_FLAGS=0x0

Things to do:

  • Override the xctest executable to be taken for the simulator
    • Upstream that to CMake?
  • Figure out a reasonable subset of the above and supply those in UseCorrade
  • In both cases, whether with xcodebuild test or with xctest, the user still needs to supply an iPhone version, and whether it's a device or simulator. That's done with CORRADE_TESTSUITE_XCTEST_DESTINATION now.
    • Document this
    • Have some reasonable autodetected default? "latest iPhone simulator available"?
  • Deprecate CORRADE_TARGET_IOS_SIMULATOR CMake var as it's impossible to detect in CMake
    • Deprecate the preprocessor var as well, unless it's detectable some other way
  • Clean up the XFAILs in the test (a check for SIMULATOR_UDID not existing was for the original hacky xctest run, the change to SIMULATOR_MAINSCREEN_SCALE is totally random and it now XPASSes certain tests)

New build system and it's clearly worse than the old. Typical 2020s,
yes.
This also means CORRADE_TARGET_IOS_SIMULATOR is no longer set for
simulator builds. Let's see how many test breakages that causes.

Well actually the tests don't run on iOS at all now, so even the
breakages would be better than the current state.
mosra added a commit to mosra/magnum-plugins that referenced this pull request Aug 17, 2023
Also disabling iOS tests until mosra/corrade#176
is resolved.
mosra added a commit that referenced this pull request Aug 17, 2023
So the build doesn't fail every time. Will be enabled again once
#176 is resolved.
mosra added a commit to mosra/magnum that referenced this pull request Aug 18, 2023
Also disable iOS tests until mosra/corrade#176
is resolved.
mosra added a commit to mosra/magnum that referenced this pull request Aug 18, 2023
Also disable iOS tests until mosra/corrade#176
is resolved.
mosra added a commit to mosra/magnum that referenced this pull request Aug 18, 2023
Also disable iOS tests until mosra/corrade#176
is resolved.
sthalik pushed a commit to sthalik/corrade that referenced this pull request Aug 29, 2023
So the build doesn't fail every time. Will be enabled again once
mosra#176 is resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant