From 54dd12d888ae1782d0ff1ac5f99f86ef48d698ca Mon Sep 17 00:00:00 2001 From: Vamsi Manohar Date: Wed, 1 Mar 2023 12:47:07 -0800 Subject: [PATCH] Enabling Jacoco Report Signed-off-by: Vamsi Manohar --- .github/workflows/sql-test-and-build-workflow.yml | 8 ++++---- build-tools/sqlplugin-coverage.gradle | 10 ++++++++-- doctest/build.gradle | 9 +++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sql-test-and-build-workflow.yml b/.github/workflows/sql-test-and-build-workflow.yml index b0ffd15581..a60f51c454 100644 --- a/.github/workflows/sql-test-and-build-workflow.yml +++ b/.github/workflows/sql-test-and-build-workflow.yml @@ -25,11 +25,11 @@ jobs: matrix: entry: - { os: ubuntu-latest, java: 11 } - - { os: windows-latest, java: 11, os_build_args: -x jacocoTestReport -PbuildPlatform=windows } - - { os: macos-latest, java: 11, os_build_args: -x jacocoTestReport } + - { os: windows-latest, java: 11, os_build_args: -x doctest -PbuildPlatform=windows } + - { os: macos-latest, java: 11} - { os: ubuntu-latest, java: 17 } - - { os: windows-latest, java: 17, os_build_args: -x jacocoTestReport -PbuildPlatform=windows } - - { os: macos-latest, java: 17, os_build_args: -x jacocoTestReport } + - { os: windows-latest, java: 17, os_build_args: -PbuildPlatform=windows } + - { os: macos-latest, java: 17 } runs-on: ${{ matrix.entry.os }} steps: diff --git a/build-tools/sqlplugin-coverage.gradle b/build-tools/sqlplugin-coverage.gradle index 6f99ceac1f..b5d808d199 100644 --- a/build-tools/sqlplugin-coverage.gradle +++ b/build-tools/sqlplugin-coverage.gradle @@ -16,6 +16,7 @@ * cluster is stopped and dump it to a file. Luckily our current security policy seems to allow this. This will also probably * break if there are multiple nodes in the integTestCluster. But for now... it sorta works. */ +import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'jacoco' // Get gradle to generate the required jvm agent arg for us using a dummy tasks of type Test. Unfortunately Elastic's @@ -45,7 +46,12 @@ integTest.runner { } testClusters.integTest { - jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}" + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + // Replacing build with absolute path to fix the error "error opening zip file or JAR manifest missing : /build/tmp/expandedArchives/..../jacocoagent.jar" + jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('build',"${buildDir}") + } else { + jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('javaagent:','javaagent:/') + } systemProperty 'com.sun.management.jmxremote', "true" systemProperty 'com.sun.management.jmxremote.authenticate', "false" systemProperty 'com.sun.management.jmxremote.port', "7777" @@ -54,7 +60,7 @@ testClusters.integTest { } jacocoTestReport { - dependsOn integTest, test + dependsOn integTest, testF executionData.from = [dummyTest.jacoco.destinationFile, dummyIntegTest.jacoco.destinationFile] sourceDirectories.from = sourceSets.main.java.sourceDirectories classDirectories.from = files(sourceSets.main.java.outputDir) diff --git a/doctest/build.gradle b/doctest/build.gradle index 6760d068a5..89aa507da3 100644 --- a/doctest/build.gradle +++ b/doctest/build.gradle @@ -94,12 +94,13 @@ task stopPrometheus() { } } } - -stopPrometheus.mustRunAfter startPrometheus +if(getOSFamilyType() != "windows") { + stopPrometheus.mustRunAfter startPrometheus + startOpenSearch.dependsOn startPrometheus + stopOpenSearch.finalizedBy stopPrometheus +} doctest.dependsOn startOpenSearch -startOpenSearch.dependsOn startPrometheus doctest.finalizedBy stopOpenSearch -stopOpenSearch.finalizedBy stopPrometheus check.dependsOn doctest clean.dependsOn(cleanBootstrap)