And*_*lli 5 xcode profiling unit-testing xcode-instruments
我使用XCTest在Xcode中编写了单元测试,并且它们在Xcode 中运行良好.除了GUI环境,我还有一个makefile,可以从命令行自动执行某些进程.这些包括构建,测试,清理,分析等.其基本原理是在构建管道中包含脚本,主要用于夜间构建.有了这个,我们会在早上获得构建,性能报告,内存泄漏等等.
instruments -t "Allocations" -D build/hul.trace hul.xcodeproj
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
Instruments Trace Error : Target failed to run: Unable to find actual binary to posix_spawn for path: hul.xcodeproj
Run Code Online (Sandbox Code Playgroud)
这与项目是静态库有关吗?我想要将结果写入文件的工具,以便我可以在第二天进行咨询,甚至自动执行某些处理,例如使用模式匹配.有没有人在使用仪器之前做过这样的事情?
编辑:这似乎做了一些事情:
sudo instruments -v -t "Time Profiler" "build/Build/Products/Debug-iphonesimulator/hulTests.xctest/" -w "iPhone SE"
Run Code Online (Sandbox Code Playgroud)
但是,我得到以下对话框:
我只是不知道适当的行动是什么......
编辑:有一件事是错的.根据文件:
-w [hardware device, or simulator name]
The name or identifier of the hardware device or simulator to target. Should be specified first
Run Code Online (Sandbox Code Playgroud)
所以上一行改为:
instruments -w "iPhone SE" -v -t "Time Profiler" "build/Build/Products/Debug-iphonesimulator/hulTests.xctest/"
Run Code Online (Sandbox Code Playgroud)
此外,除了"iPhone SE",我使用的是实际的设备标识符,而且我读到了你不应该使用的地方sudo.确实这有帮助!我注意到结果instruments -s devices和sudo instruments -s devices实际上是不同的.所以现在我得到了一个不同的错误:
Instruments : Instruments Accepted Command
Instruments : Preparing To Start Trace
Instruments : Starting Instrument(s)
Instruments : Stopping Instrument(s)
Instruments Trace Error : Target failed to run: Permission to debug com.hypelabs.test was denied.
make: *** [profile] Error 253
Run Code Online (Sandbox Code Playgroud)
我用Google搜索,这似乎表明签名错误,但如果我正在运行单元测试,这是否有意义?也就是说,我正在编写一个静态库,所以甚至没有.app文件可以签名.