update android coverage doc to highlight how to generate coverage for internal repo
Bug: 1204715
Change-Id: I4b2656ddccfbfec65baff3612011b89d0cf745b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2923582
Auto-Submit: Prakhar Asthana <[email protected]>
Reviewed-by: Zhaoyang Li <[email protected]>
Reviewed-by: John Budorick <[email protected]>
Commit-Queue: Prakhar Asthana <[email protected]>
Cr-Commit-Position: refs/heads/master@{#887362}
diff --git a/build/android/docs/coverage.md b/build/android/docs/coverage.md
index ed24100..09fc2995 100644
--- a/build/android/docs/coverage.md
+++ b/build/android/docs/coverage.md
@@ -9,7 +9,7 @@
In order to use JaCoCo code coverage, we need to create build time pre-instrumented
class files and runtime **.exec** files. Then we need to process them using the
-**build/android/generate_jacoco_report.py** script.
+[build/android/generate_jacoco_report.py](https://source.chromium.org/chromium/chromium/src/+/main:build/android/generate_jacoco_report.py) script.
## How to collect coverage data
@@ -29,10 +29,6 @@
3. The coverage results of JUnit and instrumentation tests will be merged
automatically if they are in the same directory.
-4. If generating coverage and there are duplicate class files, as can happen
- when generating coverage for downstream targets, use the
- --include-substr-filter option to choose jars in the desired directory.
-
## How to generate coverage report
1. Now we have generated .exec files already. We can create a JaCoCo HTML/XML/CSV
@@ -75,3 +71,13 @@
--coverage-dir /tmp/coverage/ \
--sources-json-dir out/Debug/ \
```
+3. If generating coverage and there are duplicate class files, as can happen
+ when generating coverage for downstream targets, use the
+ `--include-substr-filter` option to choose jars in the desired directory. Eg.
+ for generating coverage report for Clank internal repo
+ ```shell
+ build/android/generate_jacoco_report.py --format html \
+ --output-dir /tmp/coverage_report/ --coverage-dir /tmp/coverage/ \
+ --sources-json-dir out/java_coverage/ \
+ --include-substr-filter obj/clank
+ ```