From 0cbec8dbb133d20f2130457f13f891fb3bdd590a Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 2 Mar 2019 14:35:39 -0700 Subject: [PATCH] [minor] include reference tests in jacoco (#1024) As previously configured reference tests were not included in jacaoco results, implying vast swaths of the EVM were not tested. By adding jacoco to the reference tests and including them in the report a more accurate picture of line level testing results. Signed-off-by: Adrian Sutton --- build.gradle | 12 +++++++----- docs/development/code-coverage.md | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index dc82168e6e..4586e6b0fd 100644 --- a/build.gradle +++ b/build.gradle @@ -72,7 +72,12 @@ allprojects { version = rootProject.version - jacoco { toolVersion = '0.8.2' } + jacoco { + toolVersion = '0.8.2' + if (project.tasks.findByName('referenceTests')) { + applyTo referenceTests + } + } sourceCompatibility = '1.8' targetCompatibility = '1.8' @@ -389,16 +394,13 @@ task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { additionalSourceDirs.from files(subprojects.sourceSets.main.allSource.srcDirs) sourceDirectories.from files(subprojects.sourceSets.main.allSource.srcDirs) classDirectories.from files(subprojects.sourceSets.main.output) - executionData.from files(subprojects.jacocoTestReport.executionData) //how to exclude some package/classes com.test.** + executionData.from fileTree(dir: '.', includes: ['**/jacoco/*.exec']) reports { xml.enabled true csv.enabled true html.destination file("build/reports/jacocoHtml") } onlyIf = { true } - doFirst { - executionData = files(executionData.findAll { it.exists() }) - } } configurations { annotationProcessor } diff --git a/docs/development/code-coverage.md b/docs/development/code-coverage.md index b94dab1652..2f29b496df 100644 --- a/docs/development/code-coverage.md +++ b/docs/development/code-coverage.md @@ -4,7 +4,7 @@ We use the jacoco test coverage plugin, which will generate coverage data whenev To run the report: ``` -./gradlew test jacocoTestReport +./gradlew test jacocoTestReport jacocoRootReport ``` The report will be available at `build/reports/jacoco/test/html/index.html` \ No newline at end of file