【问题标题】:iOS tests will not run on simulator when using Jenkins through JNLP通过 JNLP 使用 Jenkins 时,iOS 测试不会在模拟器上运行
【发布时间】:2015-05-28 07:26:21
【问题描述】:

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

Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "由于等待测试进程签入超时正在取消测试..."

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

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

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

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

其他信息:

XCode 版本 6.2 (6C131e)

日志文件:

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

【问题讨论】:

  • 尝试从命令行使用 xcodebuild 运行测试时看到完全相同的“模拟器验证失败”错误。 Xcode (6C131e) 的相同版本和内部版本号。对我们来说,这开始于升级到 Xcode 6.2 后的一段时间。测试过去运行良好,但我不确定它们何时开始失败,因为有人在某个时候在我们的构建盒上禁用了它们。如果/当我找到解决方案时,我会在这里发布答案。如果你做了什么,如果你能做同样的事情,我将不胜感激。
  • 原来对我来说是一个红鲱鱼。我得到并且仍然得到错误,但是由于完全不同的原因测试没有运行。我的笨蛋就是无法克服最初的错误。一旦我修复了测试运行。不过,Apple 开发者论坛对此有一些行动:devforums.apple.com/thread/264762?start=0&tstart=0
  • 感谢您的链接!接下来我会尝试这些建议,如果我找到解决方案肯定会更新。
  • 好的,我有办法了!以下是对我有用的步骤:重启机器,从 Finder 启动 XCode 应用程序,退出 XCode,然后运行 ​​Jenkins 脚本。我认为这主要与首先从 Finder 启动 XCode 有关。我仍然看到错误,但至少现在运行单元测试。感谢您为我指明正确的方向,戴夫!
  • 请在下面制定一个答案,以便这个问题对社区更有用,然后接受它。

标签: ios xcode jenkins jnlp


【解决方案1】:

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

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

  1. 退出所有正在运行的 Xcode、Instruments 和 iOS 模拟器实例
  2. 删除开发者文件夹:/Library/Developer
  3. 删除所有 Xcode 安装:/Applications/Xcode.app,...
  4. 重新启动您的 Mac
  5. 从 Apple Developer Portal 下载 Xcode.dmg(不是从 App Store 下载)
  6. 重新安装 Xcode
  7. 启动 Xcode

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

希望这会有所帮助。

【讨论】:

    【解决方案2】:

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

    1. 重启远程机器
    2. 从 Finder 启动 Xcode 应用程序
    3. 退出 Xcode
    4. 运行 Jenkins 测试脚本

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-17
        • 2012-11-11
        • 1970-01-01
        • 1970-01-01
        • 2016-11-29
        • 1970-01-01
        • 2012-07-05
        相关资源
        最近更新 更多