Code coverage profile not generated when running with xcodebuild test-without-building

Originator:vytis.s.lt
Number:rdar://36907005 Date Originated:26-Jan-2018 02:45 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.3 Beta
Classification:Serious Bug Reproducible:Always
 
Summary:
When building the project with command line xcodebuild build-for-testing and then running tests separate with xcodebuild test-without-building code coverage profile is not generated. 
Because we are tracking code coverage in tests it prevents us from splitting building and testing between multiple machines.

Steps to Reproduce:
1. Build sample project from command line:
xcodebuild -scheme Codecov -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.3' -enableCodeCoverage YES build-for-testing
2. Run tests from produced .xctestrun file:
xcodebuild -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.3' -enableCodeCoverage YES -xctestrun /path/to/DerivedData/Codecov-azxfrlmhznktvjavwttdxmosuzdn/Build/Products/Codecov_iphonesimulator11.0-x86_64.xctestrun test-without-building

Expected Results:
3. Code coverage profile data is generated inside same place as when running tests from Xcode (/path/to/DerivedData/Codecov-azxfrlmhznktvjavwttdxmosuzdn/Build/ProfileData/<UUID>/Coverage.profdata)

Actual Results:
3. Code coverage profile is not generated

Version:
Xcode 9.3 Beta

Notes:
This seems to be broken at least from Xcode 9.0.1 to the latest Xcode 9.3 Beta (9Q98q)

Comments

Yes this needs to be fixed I can reproduce this on xcode 10.2 as well


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!