Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

No possible to set a right coverage product path #2

Closed
aelam opened this issue Apr 6, 2016 · 3 comments
Closed

No possible to set a right coverage product path #2

aelam opened this issue Apr 6, 2016 · 3 comments

Comments

@aelam
Copy link

aelam commented Apr 6, 2016

    "coverage": {
      "product": "MSAppModuleKit-Example/libMSAppModuleKit.a"
    }

then I traced by arc unit --trace
You can see the product path and Coverage.profdata path alway has a MSAppModuleKit-Example(target name) . maybe you are not using Xcode7.3, it works differently.

MSAppModuleKit itself is managed by CocoaPods, I think it wouldn't affect arc unit

xcrun llvm-cov show -use-color=false -instr-profile "/Users/jenkins/Library/Developer/Xcode/DerivedData/MSAppModuleKit-dluocdmaoluajyeejotbfynnkjpa/Build/Intermediates/CodeCoverage/MSAppModuleKit-Example/Coverage.profdata" "/Users/jenkins/Library/Developer/Xcode/DerivedData/MSAppModuleKit-dluocdmaoluajyeejotbfynnkjpa/Build/Intermediates/CodeCoverage/MSAppModuleKit-Example/Products/Debug-iphonesimulator/MSAppModuleKit-Example/libMSAppModuleKit.a"
@jverkoey
Copy link
Contributor

jverkoey commented Apr 6, 2016

Thanks for filing!

I haven't tested this with 7.3 yet; can you provide more details regarding how the paths have changed?

@aelam
Copy link
Author

aelam commented Apr 7, 2016

my origin repo is MSAppModuleKit.git
My workspace is generated by pod lib
with my arcconfig here

{
  "phabricator.uri": "http://ph.benemind.com/",
  "load": [
    "arc-xcode-test-engine"
  ],
  "unit.xcode": {
    "build": {
      "workspace": "Example/MSAppModuleKit.xcworkspace",
      "scheme": "MSAppModuleKit_Example",
      "configuration": "Debug",
      "destination": "platform=iOS Simulator,name=iPhone 6S"
    },
    "coverage": {
      "product": "MSAppModuleKit_Example.a"
    }
  }

}

arc unit --coverage will work like per below . I am aware of that in the xcrun command, the paths are different from what I set in arcconfig
In fact. I am not sure which scheme I need to use. so I tried different schemes
MSAppModuleKit_Example, MSAppModuleKit_Tests, MSAppModuleKit.
Maybe I just set a wrong path . I'll appreciate if you give me a direction.

[2016-04-07 10:40:39] EXCEPTION: (CommandException) Command failed with error #1!
COMMAND
xcrun llvm-cov show -use-color=false -instr-profile "/Users/jenkins/Library/Developer/Xcode/DerivedData/MSAppModuleKit-dluocdmaoluajyeejotbfynnkjpa/Build/Intermediates/CodeCoverage/MSAppModuleKit_Example/Coverage.profdata" "/Users/jenkins/Library/Developer/Xcode/DerivedData/MSAppModuleKit-dluocdmaoluajyeejotbfynnkjpa/Build/Intermediates/CodeCoverage/MSAppModuleKit_Example/Products/Debug-iphonesimulator/MSAppModuleKit_Example.a"

STDOUT
(empty)

STDERR
error: Failed to load coverage: No such file or directory
 at [<phutil>/src/future/exec/ExecFuture.php:416]
arcanist(head=master, ref.master=e3e232530c6e), phutil(head=master, ref.master=23edd1b1f443), xcode-test-tengine(head=develop, ref.develop=5d560f0596ee)
  #0 ExecFuture::resolvex() called at [<xcode-test-tengine>/engine/XcodeUnitTestEngine.php:159]
  #1 XcodeUnitTestEngine::run() called at [<arcanist>/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php:147]
  #2 ArcanistConfigurationDrivenUnitTestEngine::run() called at [<arcanist>/src/workflow/ArcanistUnitWorkflow.php:167]
  #3 ArcanistUnitWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]

when I try to reproduce this issue ,I've found two other issues

  • before I run arc unit [-coverage] I've to add a fail case then make new settings works or else it will give me nothing
  • arc unit [--coverage] never give me a list like your README. failed case or nothing
# update .arcconfig
$ arc unit --coverage
# NOTHING printed
# then I add a fail case in my test case
$ arc unit --coverage
   BROKEN  MSAppModuleKit_Example
/Users/jenkins/Desktop/work/components/MSAppModuleKit/Example/Tests/Tests.m:35: error: -[Tests testA] : failed - No implementation for "-[Tests testA]"
   FAIL  Tests::A
   PASS   <1ms★  Tests::Example

@jverkoey
Copy link
Contributor

jverkoey commented Apr 8, 2016

I'm not able to run pod install on your project so I can't reproduce your issue locally.

In fact. I am not sure which scheme I need to use.

You want to use your unit test scheme. It doesn't look like your project has one, so you may need to create one by visiting the manage schemes page and creating a new scheme. Select your unit tests target. The resulting scheme will likely be called MSAppModuleKit_Tests. This is what you'll provide in .arcconfig.

As for coverage, can you provide the location of a Coverage.profdata file in your build output directory?

You should be able to run:

xcodebuild -workspace "Example/MSAppModuleKit.xcworkspace" -scheme "MSAppModuleKit_Tests" -configuration "Debug" -destination "platform=iOS Simulator,name=iPhone 6S" -enableCodeCoverage "YES" -showBuildSettings test

Find the value of OBJROOT and include it here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants