Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Xcode 7代码覆盖率报告不工作_Ios_Xcode_Llvm - Fatal编程技术网

Ios Xcode 7代码覆盖率报告不工作

Ios Xcode 7代码覆盖率报告不工作,ios,xcode,llvm,Ios,Xcode,Llvm,对于某个iOS项目,我在使用Xcode 7进行代码覆盖率报告时遇到问题 我遵循这里给出的说明: 在我试过的三个项目中,有两个效果很好,但有一个项目让我头疼。使用llvm cov实用程序从收集的配置文件数据生成报告时,如下所示: xcrun llvm-cov report -instr-profile Coverage.profdata MyAppBinary 我收到错误消息: error: Failed to load coverage: The file was not recogniz

对于某个iOS项目,我在使用Xcode 7进行代码覆盖率报告时遇到问题

我遵循这里给出的说明:

在我试过的三个项目中,有两个效果很好,但有一个项目让我头疼。使用llvm cov实用程序从收集的配置文件数据生成报告时,如下所示:

xcrun llvm-cov report -instr-profile Coverage.profdata MyAppBinary 
我收到错误消息:

error: Failed to load coverage: The file was not recognized as a valid object file
我检查了测试方案是否启用了“收集覆盖率数据”。我还检查了-fprofile instr generate和-fcoverage映射编译器选项是否传递给了clang

文件大小和类型对我来说也是有效的:

ilMac:llvm-cov-test ilja$ ls -la
total 61976
drwxr-xr-x   4 ilja  staff       136 14 Okt 21:53 .
drwxr-xr-x+ 75 ilja  staff      2550 14 Okt 16:31 ..
-rw-r--r--   1 ilja  staff   1797416 14 Okt 21:53 Coverage.profdata
-rwxr-xr-x   1 ilja  staff  29932040 14 Okt 16:32 MyAppBinary

ilMac:llvm-cov-test ilja$ file Coverage.profdata 
Coverage.profdata: data

ilMac:llvm-cov-test ilja$ file MyAppBinary 
MyAppBinary: Mach-O universal binary with 2 architectures
MyAppBinary (for architecture i386):    Mach-O executable i386
MyAppBinary (for architecture x86_64):  Mach-O 64-bit executable x86_64
我还注意到,Xcode中用于测试运行的“覆盖率”选项卡显示的是“无覆盖率数据”,而不是指示条


知道我做错了什么吗?

该项目将Xcode构建设置中的“仅构建活动体系结构”设置设置为“是”。将其切换为“否”后,我现在可以运行llvmcov命令。不过,数字与Xcode中显示的数字不同

我只使用
x86_64
体系结构就可以解决这个问题


xcodebuild
命令中使用
ARCHS=“x86\u 64”
发布我的解决方案,以防有人需要它。 在这篇文章之后 我采取了以下步骤:

  • 已安装的cobertura插件
  • 安装slather插件
  • 已启用项目的代码覆盖率(在架构首选项中)
  • 在jenkins中添加了执行shell命令
  • /usr/bin/xcodebuild test-workspace MyApp.xcworkspace-scheme MyAppTests-configuration DebugMyApp-destination“platform=iOS模拟器,OS=9.3,name=iphone6”-enableCodeOverage YES

  • 然后再为Slater建造一个阀杆
  • slather覆盖率\
    --数据输入格式\
    --CoberturaXML\
    --忽略“./***/Xcode*”\
    --输出目录slather报告\
    --方案MyAppTests\
    --工作区MyApp.xcworkspace\
    MyApp.xcodeproj

  • 最后但并非最不重要的一点是添加构建后步骤“publich cobertura报告” Cobertura xml报告模式-slather报告/Cobertura.xml
  • 享受:)

  • 我试着去看同一篇文章,却犯了同样的错误。你解决这个问题了吗?如果是的话,你能帮我吗?提前感谢!!!如果我不想使用slather进行代码覆盖,有什么帮助吗?