xcode 通过 JNLP 使用 Jenkins 时,iOS 测试不会在模拟器上运行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29241877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:51:52  来源:igfitidea点击:

iOS tests will not run on simulator when using Jenkins through JNLP

iosxcodejenkinsjnlp

提问by PastryPup

I have been trying to get xcodebuild tests to work on a remote machine using Jenkins. I ran into the error of not being able to launch a GUI through SSH and solved it by launching a slave through JNLP as suggested here: Timeout when running xcodebuild tests under Xcode 6 via SSH. Now I'm getting a new error:

我一直在尝试让 xcodebuild 测试在使用 Jenkins 的远程机器上工作。我遇到了无法通过 SSH 启动 GUI 的错误,并按照此处的建议通过 JNLP 启动从站来解决它: Timeout when running xcodebuild tests under Xcode 6 via SSH。现在我收到一个新错误:

Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "Canceling tests due to timeout in Waiting for test process to check in..."

错误域=IDEUnitTestsOperationsObserverErrorDomain 代码=3“由于等待测试进程签入超时,正在取消测试...”

I also get these errors whether I successfully build and run the tests on the terminal or through Jenkins:

无论我是在终端上还是通过 Jenkins 成功构建和运行测试,我都会遇到这些错误:

iPhoneSimulator: SimVerifier returned: Error Domain=NSPOSIXErrorDomain Code=53 "Simulator verification failed." {NSLocalizedFailureReason=A connection to the simulator verification service could not be established., NSLocalizedRecoverySuggestion=Ensure that Xcode.app is installed on a volume with ownership enabled., NSLocalizedDescription=Simulator verification failed.}

iPhoneSimulator: Unable to connect to "com.apple.instruments.deviceservice.lockdown" (Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown"

iPhoneSimulator:SimVerifier 返回:错误域=NSPOSIXErrorDomain 代码=53“模拟器验证失败。” {NSLocalizedFailureReason=无法建立与模拟器验证服务的连接。, NSLocalizedRecoverySuggestion=确保 Xcode.app 安装在启用所有权的卷上。, NSLocalizedDescription=模拟器验证失败。}

iPhoneSimulator:无法连接到“com.apple.instruments.deviceservice.lockdown”(错误域=com.apple.CoreSimulator.SimError Code=146“无法在当前状态下查找:关机”

I've made sure ownership is enabled where XCode is installed, I've reset the content and settings on the simulator, and I've moved my plist file into /Library/LaunchAgents. I've tried Googling these errors and could not find anything that seems to relate to my issue. Does anyone have any other suggestions?

我已经确保在安装 XCode 的地方启用了所有权,我已经重置了模拟器上的内容和设置,并且我已经将我的 plist 文件移动到 /Library/LaunchAgents 中。我试过谷歌搜索这些错误,但找不到任何似乎与我的问题有关的东西。有人有其他建议吗?

Other information:

其他信息:

XCode Version 6.2 (6C131e)

XCode 6.2 版 (6C131e)

Log file:

日志文件:

2015-03-24 12:14:10.719 Beginning test session with Xcode 6C131e
2015-03-24 12:14:10.720 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test -project proj.xcodeproj -scheme development -destination platform=iOS Simulator,name=iPad Air
2015-03-24 12:14:10.720 Testing on device: <DVTiPhoneSimulator: 0x7f8235cb3570> {SimDevice: SimDevice : iPad Air (625C9344-19B9-4F6C-B70B-8BDD3B753E17) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPad-Air } runtime={ SimRuntime : 8.2 (12D508) - com.apple.CoreSimulator.SimRuntime.iOS-8-2 }}
2015-03-24 12:14:10.720 Writing testing status log to /var/folders/mx/9d2jm4sj6t54sld_9cj1bgz40000gn/T/com.apple.dt.XCTest-status/Session-2015-03-24_12:14:10-QR746X.log.
2015-03-24 12:14:10.720 Initializing test infrastructure.
2015-03-24 12:14:10.749 Creating the connection.
2015-03-24 12:14:10.749 Listening for proxy connection request from the test bundle (all platforms)
2015-03-24 12:14:10.749 Resuming the connection.
2015-03-24 12:14:10.749 Test connection requires daemon assistance.
2015-03-24 12:14:10.933 Checking test manager availability..., will wait up to 120s
2015-03-24 12:14:10.936 testmanagerd handled session request.
2015-03-24 12:14:10.936 Waiting for test process to launch.
2015-03-24 12:14:15.951 Launch session started, setting a disallow-finish-token on the run operation.
2015-03-24 12:14:15.952 Waiting for test process to check in..., will wait up to 120s
2015-03-24 12:14:15.979 Adding console adaptor for test process.
2015-03-24 12:16:15.956 Unable to get debug console for logging target process thread state.
2015-03-24 12:16:15.956 Test operation failure: Canceling tests due to timeout in Waiting for test process to check in...
2015-03-24 12:16:15.956 _finishWithError:Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "Canceling tests due to timeout in Waiting for test process to check in..." UserInfo=0x7f8231c1dff0 {NSLocalizedDescription=Canceling tests due to timeout in Waiting for test process to check in...} didCancel: 1

采纳答案by PastryPup

I still see the error messages, but I was able to get Jenkins to run my unit tests. Here are the steps that worked for me:

我仍然看到错误消息,但我能够让 Jenkins 运行我的单元测试。以下是对我有用的步骤:

  1. Reboot the remote machine
  2. Start the Xcode app from Finder
  3. Quit Xcode
  4. Run Jenkins test script
  1. 重启远程机器
  2. 从 Finder 启动 Xcode 应用程序
  3. 退出 Xcode
  4. 运行 Jenkins 测试脚本

回答by Yonathan W'Gebriel

You can resolve the "Simulator Verification Failed" error (Code=53) with the steps below. (For me, this problem was caused by conflict of command-line development tools and also due to Mac OS folder permission issues with the tools).

您可以通过以下步骤解决“模拟器验证失败”错误(代码=53)。(对我来说,这个问题是由命令行开发工具的冲突以及工具的 Mac OS 文件夹权限问题引起的)。

I was able to resolve it following these:

我能够通过以下方式解决它:

  1. Quit any running instances of Xcode, Instruments and iOS simulators
  2. Removing the developer folder: /Library/Developer
  3. Remove all your Xcode installations: /Applications/Xcode.app,...
  4. Reboot your Mac
  5. Download Xcode.dmg from Apple Developer Portal (NOTfrom the App Store)
  6. Reinstall Xcode
  7. Launch Xcode
  1. 退出任何正在运行的 Xcode、Instruments 和 iOS 模拟器实例
  2. 删除开发者文件夹:/Library/Developer
  3. 删除所有 Xcode 安装:/Applications/Xcode.app,...
  4. 重新启动你的 Mac
  5. 从 Apple Developer Portal(不是从 App Store)下载 Xcode.dmg
  6. 重新安装Xcode
  7. 启动 Xcode

Optionally, though not the best thing to do, if you wanna install multiple versions of Xcode, make sure you activate the right Xcode version from Xcode Preferences/Locations/Command-Line Tools, before building your projects.

或者,虽然不是最好的做法,但如果您想安装多个版本的 Xcode,请确保在构建项目之前从Xcode Preferences/Locations/Command-Line Tools激活正确的 Xcode 版本。

Hope this helps.

希望这可以帮助。

回答by Werner Altewischer

See my solution here: https://stackoverflow.com/a/40790171/480467

在此处查看我的解决方案:https: //stackoverflow.com/a/40790171/480467

The problem lies in the fact that the timeout counter in xcodebuild starts as soon as the command is executed, so the compile time counts towards the timeout (which is 120 seconds).

问题在于 xcodebuild 中的超时计数器在命令执行后立即启动,因此编译时间计入超时(120 秒)。