aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/bazel/bazel_coverage_test.sh
Commit message (Collapse)AuthorAge
* Do not hardcode LCOV pathGravatar Vladimir Zaytsev2018-08-10
| | | | | | | | fixes #5644 Closes #5646. PiperOrigin-RevId: 208175002
* Collect code coverage for binaries invoked via sh_test.Gravatar Irina Iancu2018-07-23
| | | | | | | | | Fixes #5331. Change-Id: Idb01a3f206ed37992f200f7e0e51ed9831262613 RELNOTES: Code coverage is collected for Java binaries invoked from sh_test. PiperOrigin-RevId: 205654442
* Create Bazel coverage report action.Gravatar elenairina2018-07-06
| | | | | | | Fixes #5246 RELNOTES: None. PiperOrigin-RevId: 203453340
* [LcovMerger] Make int fields of SourceFileCoverage be dynamically computed.Gravatar elenairina2018-07-04
| | | | | RELNOTES: None. PiperOrigin-RevId: 203264765
* Implement LcovMerger.Gravatar elenairina2018-06-11
| | | | | | | | | | | | | | LcovMerger is a tool that merges all the intermediate lcov tracefiles (with .dat extension) found under a coverage directory and prints the merged tracefile to a given output file. A custom implementation for merging lcov tracefiles is needed because the merging functionality of lcov itself is very slow. LcovMerger is required to get a single coverage report (lcov tracefile) from a bazel coverage command that executes multiple tests. ATM LcovMerger is only invoked by tools/test/collect_coverage.sh that collects and merges the tracefiles from a single test invocation. It will also be used from a CoverageReportAction. Progress on #5246. PiperOrigin-RevId: 200054506
* Add --experimental_java_coverage.Gravatar elenairina2017-12-05
| | | | | | | | | | | | | | | | | | Context: java_import or other custom rules (genrules or Skylark) do not propagate coverage information. Coverage metadata is retrieved from the compilation information and it is passed around through providers as Artifact(s). The problem with the current implementation is that there is no way of retrieving instrumentation metadata from arbitrary jars provided by java_import or other custom rules. --experimental_java_coverage solves the issue presented above ONLY for the java rules (has no effect for android/[]/etc). Implementation details: * For each build jar create a .txt file containing the relative path of each Java file. This file is included in the build jar. It is used for recreating the correct path for each covered file when included in the coverage report. * java_binary/java_test will set 3 environment variables: 1) JACOCO_METADATA_JAR - in experimental mode will be a txt file containing all the jars considered for collecting coverage (JacocoCoverageRunner filters out the ones that don't have .uninstrumented.class files). In non-experimental mode will be a jar containing all the instrumented class files. 2) JACOCO_MAIN_CLASS - The main class to be called for the current coverage run. Previously this information was embedded in the JACOCO_METADATA_JAR's manifest. 3) JACOCO_JAVA_RUNFILES RELNOTES: --experimental_java_coverage is available for testing. PiperOrigin-RevId: 177941471
* Automated rollback of commit 411039319c1c67f2b9c8a7ada9e0a11d9bd4023f.Gravatar elenairina2017-09-28
| | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks coverage for android_test (N/A). Can be reproduced with unknown commit. *** Original change description *** Rollforward change of Java coverage logic. RELNOTES: None. *** Original change description *** Automated rollback of commit 8d6fc64b18c7e35b93f5c43dae1dbd2f8cae2147. PiperOrigin-RevId: 170322801
* BEP: also report baseline coverageGravatar Klaus Aehlig2017-09-27
| | | | | | | ...as part of the TargetComplete message. Change-Id: I8aa321a2810c3926db943f32cb1811a169e34dd7 PiperOrigin-RevId: 170171458
* Rollforward change of Java coverage logic.Gravatar elenairina2017-09-26
| | | | | | | | | | RELNOTES: None. *** Original change description *** Automated rollback of commit 8d6fc64b18c7e35b93f5c43dae1dbd2f8cae2147. PiperOrigin-RevId: 170038845
* BEP: Add coverage data to test_resultGravatar Klaus Aehlig2017-09-26
| | | | | | | | Include the coverage data file into the list of files repeorted in the test_result event in the BEP. Change-Id: Ia7b653addd5589268ce919b3e0349371dbc18bf2 PiperOrigin-RevId: 169956864
* Automated rollback of commit 8d6fc64b18c7e35b93f5c43dae1dbd2f8cae2147.Gravatar plf2017-09-04
| | | | PiperOrigin-RevId: 167480127
* Rolling forward Java coverage.Gravatar elenairina2017-09-01
| | | | | | | Instead of passing all the runtime jars in the environment variable, we now write them all to a file and store the file path in the env variable, jacoco runner reading the jars from there. Changes on Jacoco runner side are here: https://github.com/bazelbuild/bazel/commit/05418b33dd87d63e2653e594d462b2aedb0e22e5 RELNOTES: A new Java coverage implementation is available. Makes possible coverage for Skylark JVM rules. PiperOrigin-RevId: 167248966
* Automated rollback of commit 8adcf839c5c42defaa2fabedfb0208e4ce97ac95.Gravatar ajmichael2017-08-10
| | | | | | | *** Reason for rollback *** RELNOTES: None PiperOrigin-RevId: 164775289
* Change logic of Blaze Java coverage.Gravatar elenairina2017-08-08
| | | | | | | | | | | | | | | | | | Change is needed due to the fact that java_import or other custom rules (genrules or Skylark) do not propagate coverage information. The lack of coverage data is caused by the fact that it is retrieved from compilation information and it is passed around through providers as Artifact(s) (also known as instrumentation metadata). The problem with the current implementation is that there is no way of retrieving instrumentation metadata from arbitrary jars provided by java_import or other custom rules. The instrumentation metadata in the current implementation is a separate jar that contains uninstrumented classes for offline Jacoco instrumentation. This change addresses that problem by having just one jar instead of 2 (the build jar and the instrumentation jar), adding the uninstrumented classes in the build jar and completely removing any other instrumentation metadata. Implementation details: * For each build jar there is a .txt file created that contains the relative path of each Java file. This file will also be included in the final build jar. It is used for recreating the correct path for each covered file when included in the coverage report. * java_binary/java_test will set 2 environment variables: 1) JACOCO_METADATA_JARS - replaces the previous JACOCO_METADATA_JAR that was a jar that merged all the uninstrumented classes on the classpath in one jar. The new environment variable holds the paths of the runtime classpath jars - only some of them contain uninstrumented classes, letting the Jacoco coverage runner to filter and analyze them. 2) JACOCO_MAIN_CLASS - The main class to be called for the current coverage run. Previously this information was embedded in the JACOCO_METADATA_JAR's manifest. PiperOrigin-RevId: 164562533
* Add functionality from the old shell-based coverage runner script to the new ↵Gravatar lberki2017-05-23
| | | | | | | | | | | | | one. This isn't a principled solution, but since it depends on /usr/bin/lcov, it should never be relied on at all. It's mostly a courtesy to people who came to use C++ coverage in Bazel before we removed it. Fixes #2685. Progress on #1118. RELNOTES: None. PiperOrigin-RevId: 156866370
* Remove some debugging code from bazel_coverage_test.sh .Gravatar lberki2017-04-19
| | | | | | | They were added in https://github.com/bazelbuild/bazel/commit/3a5d3db6436bbaf5351da9ea9c19a41ae7c95ca9 by Yours Truly. RELNOTES: None. PiperOrigin-RevId: 153468590
* Re-enable the Java coverage tests.Gravatar lberki2017-04-18
| | | | | | | | | It has been disabled in https://github.com/bazelbuild/bazel/commit/bce889840f91f14c05418d960984bcf1a5f59411 and in https://github.com/bazelbuild/bazel/commit/21fb8cac60c36cb527d6131ab0092bcdf138d99a and then was not re-enabled. Also update src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD to which I accidentally submitted a change directly to our OSS repository. RELNOTES: None. PiperOrigin-RevId: 153460778
* Reactivate bazel_coverage_testGravatar Damien Martin-Guillerez2016-12-21
| | | | | | | | | | | | | This test was deactivated due to #2227 but the recent fix in our coverage tooling actually fixed the test to. Fixes #2227. -- Change-Id: I3e0e979c57cd198252cbe14369971027630bac66 Reviewed-on: https://cr.bazel.build/8038 PiperOrigin-RevId: 142564037 MOS_MIGRATED_REVID=142564037
* Avoids NullPointerException when running `bazel coverage //:xxx`, since ↵Gravatar Yue Gan2016-12-20
| | | | | | | | | | PathFragment.getParentDirectory() may return null. Fixes #2212. Also adds coverage-specific attributes to the java_binary rule. -- PiperOrigin-RevId: 142516883 MOS_MIGRATED_REVID=142516883
* Disable failing tests related to code coverage work.Gravatar John Cater2016-12-13
| | | | | | | | | | | This will silence the problems in #2227 and #2228 until the actual underlying issues can be fixed. -- Change-Id: Id2bc062104b4111bbcde8455f30059b3cb04eff6 Reviewed-on: https://cr.bazel.build/7870 PiperOrigin-RevId: 141892371 MOS_MIGRATED_REVID=141892371
* Add coverage support for java test.Gravatar Yue Gan2016-12-07
(series 4/4 of open-sourcing coverage command for java test) -- PiperOrigin-RevId: 141292977 MOS_MIGRATED_REVID=141292977