Index: docs/ios/coverage.md |
diff --git a/docs/ios/coverage.md b/docs/ios/coverage.md |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c0dab797dfded40516398a14ad02bd4080d04ed7 |
--- /dev/null |
+++ b/docs/ios/coverage.md |
@@ -0,0 +1,54 @@ |
+# Generate code coverage data |
+ |
+1. Setup: Code coverage is only supported for Debug-iphonesimulator builds. |
+ (gtest_include_ios_coverage, ENABLE_TEST_CODE_COVERAGE?) |
+ |
+1. Run a test target that supports code coverage, for example |
+ `ios_showcase_egtests`. Targets that support test target call |
+ `coverage_util::SetupIfNecessary()`. |
+ |
+1. Find the `coverage.profraw` in the Documents folder of the app. You can look |
+ in the console output of the instrumented target. For example: |
+ |
+ ```Coverage data at: </Users/johndoe/Library/Developer/CoreSimulator/Devices/\ |
+ 82D642FA-FC18-4EDB-AFE0-A17454804BE4/data/Containers/Data/Application/\ |
+ E6B2B898-CE13-4958-93F3-E8B500446381/Documents/coverage.profraw>``` |
+ |
+1. Create a `coverage.profdata` file out of the `coverage.profraw` file: |
+ |
+ `xcrun llvm-profdata merge -o out/Debug-iphonesimulator/coverage.profdata |
+ path/to/coverage.profraw` |
+ |
+1. To see the **line coverage** for *all the instrumented source files*: |
+ |
+ `xcrun llvm-cov show |
+ out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
+ -instr-profile=path/to/coverage.profdata -arch=x86_64` |
+ |
+  |
+ |
+ To see the **line coverage** for a *specific instrumented source |
+ file/folder* (e.g. `ios/showcase/core/app_delegate.mm`): |
+ |
+ `xcrun llvm-cov show |
+ out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
+ -instr-profile=path/to/coverage.profdata -arch=x86_64 |
+ ios/showcase/core/app_delegate.mm` |
+ |
+  |
+ |
+ To see a **complete report**: |
+ |
+ `xcrun llvm-cov report |
+ out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
+ -instr-profile=path/to/coverage.profdata -arch=x86_64` |
+ |
+  |
+ |
+ To see a **report** for a *folder/file* (e.g. `ios/showcase/core` folder): |
+ |
+ `xcrun llvm-cov show |
+ out/Debug-iphonesimulator/ios_showcase_egtests.app/ios_showcase_egtests |
+ -instr-profile=path/to/coverage.profdata -arch=x86_64 ios/showcase/core` |
+ |
+  |