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 ``` | |
14 Coverage data at /Users/johndoe/Library/Developer/CoreSimulator/Devices/ | |
15 82D642FA-FC18-4EDB-AFE0-A17454804BE4/data/Containers/Data/Application/ | |
16 E6B2B898-CE13-4958-93F3-E8B500446381/Documents/coverage.profraw | |
17 ``` | |
18 | |
19 1. Create a `coverage.profdata` file out of the `coverage.profraw` file: | |
20 | |
21 `xcrun llvm-profdata merge -o out/Debug-iphonesimulator/coverage.profdata | |
22 path/to/coverage.profraw` | |
23 | |
24 1. To see the **line coverage** for *all the instrumented source files*: | |
lindsayw
2017/04/03 15:32:09
Sorry if this is obvious, but why do all of these
lpromero
2017/04/04 14:49:50
Markdown rendering changes it to the required numb
| |
25 | |
26 `xcrun llvm-cov show | |
27 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests | |
28 -instr-profile=path/to/coverage.profdata -arch=x86_64` | |
29 | |
30 ![](images/llvm-cov_show.png) | |
31 | |
32 To see the **line coverage** for a *specific instrumented source | |
33 file/folder* (e.g. `ios/showcase/core/app_delegate.mm`): | |
34 | |
35 `xcrun llvm-cov show | |
36 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests | |
37 -instr-profile=path/to/coverage.profdata -arch=x86_64 | |
38 ios/showcase/core/app_delegate.mm` | |
39 | |
40 ![](images/llvm-cov_show_file.png) | |
41 | |
42 To see a **complete report**: | |
43 | |
44 `xcrun llvm-cov report | |
45 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests | |
46 -instr-profile=path/to/coverage.profdata -arch=x86_64` | |
47 | |
48 ![](images/llvm-cov_report.png) | |
49 | |
50 To see a **report** for a *folder/file* (e.g. `ios/showcase/core` folder): | |
51 | |
52 `xcrun llvm-cov show | |
53 out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests | |
54 -instr-profile=path/to/coverage.profdata -arch=x86_64 ios/showcase/core` | |
55 | |
56 ![](images/llvm-cov_report_folder.png) | |
OLD | NEW |