OLD | NEW |
(Empty) | |
| 1 # Generate code coverage data |
| 2 |
| 3 1. Setup: Code coverage is only supported for Debug-iphonesimulator builds. |
| 4 (gtest_include_ios_coverage, ENABLE_TEST_CODE_COVERAGE?) |
| 5 |
| 6 1. Run a test target that supports code coverage, for example |
| 7 `ios_showcase_egtests`. Targets that support test target call |
| 8 `coverage_util::SetupIfNecessary()`. |
| 9 |
| 10 1. Find the `coverage.profraw` in the Documents folder of the app. You can look |
| 11 in the console output of the instrumented target. For example: |
| 12 |
| 13 ```Coverage data at: </Users/johndoe/Library/Developer/CoreSimulator/Devices
/\ |
| 14 82D642FA-FC18-4EDB-AFE0-A17454804BE4/data/Containers/Data/Application/\ |
| 15 E6B2B898-CE13-4958-93F3-E8B500446381/Documents/coverage.profraw>``` |
| 16 |
| 17 1. Create a `coverage.profdata` file out of the `coverage.profraw` file: |
| 18 |
| 19 `xcrun llvm-profdata merge -o out/Debug-iphonesimulator/coverage.profdata |
| 20 path/to/coverage.profraw` |
| 21 |
| 22 1. To see the **line coverage** for *all the instrumented source files*: |
| 23 |
| 24 `xcrun llvm-cov show |
| 25 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
| 26 -instr-profile=path/to/coverage.profdata -arch=x86_64` |
| 27 |
| 28  |
| 29 |
| 30 To see the **line coverage** for a *specific instrumented source |
| 31 file/folder* (e.g. `ios/showcase/core/app_delegate.mm`): |
| 32 |
| 33 `xcrun llvm-cov show |
| 34 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
| 35 -instr-profile=path/to/coverage.profdata -arch=x86_64 |
| 36 ios/showcase/core/app_delegate.mm` |
| 37 |
| 38  |
| 39 |
| 40 To see a **complete report**: |
| 41 |
| 42 `xcrun llvm-cov report |
| 43 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
| 44 -instr-profile=path/to/coverage.profdata -arch=x86_64` |
| 45 |
| 46  |
| 47 |
| 48 To see a **report** for a *folder/file* (e.g. `ios/showcase/core` folder): |
| 49 |
| 50 `xcrun llvm-cov show |
| 51 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
| 52 -instr-profile=path/to/coverage.profdata -arch=x86_64 ios/showcase/core` |
| 53 |
| 54  |
OLD | NEW |