来自TeamCity构建代理的"无法在Simulator中运行应用程序"

 白羊幸福的佳佳 发布于 2022-12-12 18:08

我在TeamCity构建代理输出中看到此错误:

...
[14:17:50][Step 2/2] Starting: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Foobar/Foobar.xcodeproj -scheme foobarNightly SYMROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build OBJROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build test -sdk iphonesimulator8.1
[14:17:50][Step 2/2] in directory: /Users/Me/buildAgent/work/e60c5dca158b2d23
...
[14:17:53][Step 2/2] FoobarTests (BUILD)
[14:17:53]=== BUILD TARGET FoobarTests OF PROJECT Foobar WITH CONFIGURATION Debug ===
[14:17:53]Check dependencies
[14:17:53]Testing failed:
[14:17:53]  Test target FoobarTests encountered an error (Unable to run app in Simulator If you believe this error represents a bug, please attach the log file at /var/folders/yy/lc1xnprn1w3g98mcy5mprm5c0000gn/T/com.apple.dt.XCTest-status/Session-2014-11-04_11:17:51-qkVM7k.log)
[14:17:53][Step 2/2] ** TEST FAILED **
[14:17:54][Step 2/2] Process exited with code 65
...

提到的日志包含的位置:

...
2014-11-04 11:17:51.085 Beginning test session with Xcode 6A1052d
2014-11-04 11:17:51.085 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Foobar/Foobar.xcodeproj -scheme foobarNightly SYMROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build OBJROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build test -sdk iphonesimulator8.1
2014-11-04 11:17:51.085 Testing on device:  {
        SimDevice: SimDevice : iPad 2 (B694B12B-BAE3-48FD-A351-CFC5855B5D14) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPad-2 } runtime={ SimRuntime : 8.1 (12B411) - com.apple.CoreSimulator.SimRuntime.iOS-8-1 }
}
2014-11-04 11:17:51.085 Initializing test infrastructure.
2014-11-04 11:17:51.085 Writing testing status log to /var/folders/yy/lc1xnprn1w3g98mcy5mprm5c0000gn/T/com.apple.dt.XCTest-status/Session-2014-11-04_11:17:51-qkVM7k.log.
2014-11-04 11:17:51.107 Creating the connection.
2014-11-04 11:17:51.107 Listening for proxy connection request from the test bundle (all platforms)
2014-11-04 11:17:51.107 Resuming the connection.
2014-11-04 11:17:51.107 Test connection requires daemon assistance.
2014-11-04 11:17:51.469 Checking test manager availability..., will wait up to 120s
2014-11-04 11:17:52.148 testmanagerd handled session request.
2014-11-04 11:17:52.148 Waiting for test process to launch.
2014-11-04 11:17:53.323 Launch session started, setting a disallow-finish-token on the run operation.
2014-11-04 11:17:53.323 Waiting for test process to check in..., will wait up to 120s
2014-11-04 11:17:53.334 Adding console adaptor for test process.
2014-11-04 11:17:54.012 Test operation failure: Unable to run app in Simulator
2014-11-04 11:17:54.012 _finishWithError:Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "Unable to run app in Simulator" UserInfo=0x7fcb28ddd570 {NSLocalizedDescription=Unable to run app in Simulator} didCancel: 1
...

如果我直接在构建代理程序机器上运行完全相同的命令:

$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Foobar/Foobar.xcodeproj -scheme foobarNightly SYMROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build OBJROOT=/Users/Me/buildAgent/work/e60c5dca158b2d23/Foobar/build test -sdk iphonesimulator8.1

有用.知道为什么这个失败来自TeamCity构建代理?

2 个回答
  • 根据TeamCity的文档,有两种方法可以在OS X上创建构建代理守护程序:

    系统范围: /Library/LaunchDaemons/jetbrains.teamcity.BuildAgent.plist

    特定于用户: ~/Library/LaunchAgents/jetbrains.teamcity.BuildAgent.plist

    事实证明,没有这些选项将允许TeamCity的生成代理启动Xcode的模拟器.

    如果在直接(而不是SSH)登录到构建代理程序计算机后手动启动构建代理程序:

    $ sh buildAgent/bin/agent.sh start
    

    TeamCity构建代理将能够启动模拟器.要在启动时运行此脚本,请.app使用Automator 创建一个:https://stackoverflow.com/a/6445525/429533

    2022-12-12 18:09 回答
  • 好吧,看起来我们已经找到了真正的问题.plist随TeamCity提供的文件包含SessionCreate属性,不应该有最新的Mac OS X版本.

    这个问题应该被固定在TeamCity的9.0.4,但作为一种解决方法,你应该将jetbrains.teamcity.BuildAgent.plist ~/Library/LaunchAgents/jetbrains.teamcity.BuildAgent.plist 并删除SessionCreate从它的属性和值.

    jetbrains.teamcity.BuildAgent.plist文件的当前变体是:

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>WorkingDirectory</key> <string>/agent/home/directory</string> <key>Debug</key> <false/> <key>Label</key> <string>jetbrains.teamcity.BuildAgent</string> <key>OnDemand</key> <false/> <key>KeepAlive</key> <true/> <key>ProgramArguments</key> <array> <string>bash</string> <string>--login</string> <string>-c</string> <string>launcher/bin/TeamCityAgentService-macosx-universal-32 -c ../conf/wrapper.conf</string> </array> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>logs/launchd.err.log</string> <key>StandardOutPath</key> <string>logs/launchd.out.log</string> </dict> </plist>

    2022-12-12 18:11 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有