Skip to content

Commit

Permalink
7446: Add Maven profile for enabling test coverage
Browse files Browse the repository at this point in the history
Reviewed-by: hirt
  • Loading branch information
aptmac committed Nov 25, 2021
1 parent 24f4cb0 commit 35c8e0e
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 89 deletions.
13 changes: 9 additions & 4 deletions application/coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, 2020, Red Hat Inc. All rights reserved.
Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, 2021, Red Hat Inc. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -39,7 +39,7 @@
<artifactId>missioncontrol.application</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>coverage</artifactId>
<artifactId>coverage.application</artifactId>
<name>Code coverage report jmc/application</name>
<packaging>pom</packaging>

Expand All @@ -48,6 +48,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
</dependency>
<!-- First all the modules in application/ -->
<dependency>
<groupId>org.openjdk.jmc</groupId>
Expand Down Expand Up @@ -495,7 +500,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>report-aggregate</id>
Expand Down
13 changes: 7 additions & 6 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<spotless.config.path>${basedir}/../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
<jfr.tests/>
<jfr.vmargs>-XX:+FlightRecorder</jfr.vmargs>
<jacoco.plugin.version>0.8.7</jacoco.plugin.version>
</properties>

<modules>
Expand Down Expand Up @@ -117,9 +118,14 @@
<module>org.openjdk.jmc.updatesite.rcp</module>
<module>l10n</module>
<module>tests</module>
<module>coverage</module>
</modules>
<profiles>
<profile>
<id>coverage</id>
<modules>
<module>coverage</module>
</modules>
</profile>
<profile>
<id>no-jfr</id>
<activation>
Expand Down Expand Up @@ -182,11 +188,6 @@
<artifactId>flightrecorder.test</artifactId>
<version>${revision}${changelist}</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
53 changes: 30 additions & 23 deletions application/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,39 @@
<test.excludes>${test.excludes.default}</test.excludes>
</properties>
</profile>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
Expand Down
76 changes: 49 additions & 27 deletions application/uitests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -50,7 +50,6 @@
<test.excludes.default>**/*$*</test.excludes.default>
<ui.test.excludes>**/uitest/**,${test.excludes.default}</ui.test.excludes>
<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
<jacoco.plugin.version>0.8.7</jacoco.plugin.version>
<jmc.version>${revision}${changelist}</jmc.version>
</properties>

Expand Down Expand Up @@ -157,44 +156,67 @@
<ui.test.osappargs>--launcher.appendVmargs</ui.test.osappargs>
</properties>
</profile>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<product>org.openjdk.jmc.rcp.application.product</product>
<application>org.openjdk.jmc.rcp.application.app</application>
<argLine>${ui.test.vmargs} ${ui.test.osvmargs} ${surefireArgLine}</argLine>
<appArgLine>-nl en -consoleLog ${ui.test.osappargs}</appArgLine>
<useUIHarness>${ui.test.run}</useUIHarness>
<useUIThread>false</useUIThread>
<failIfNoTests>false</failIfNoTests>
<includes>${test.includes}</includes>
<!-- To be used along with the maven toolchains plugin
<useJDK>SYSTEM</useJDK> -->
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<product>org.openjdk.jmc.rcp.application.product</product>
<application>org.openjdk.jmc.rcp.application.app</application>
<argLine>${ui.test.vmargs} ${ui.test.osvmargs} ${surefireArgLine}</argLine>
<argLine>${ui.test.vmargs} ${ui.test.osvmargs}</argLine>
<appArgLine>-nl en -consoleLog ${ui.test.osappargs}</appArgLine>
<useUIHarness>${ui.test.run}</useUIHarness>
<useUIThread>false</useUIThread>
<testFailureIgnore>false</testFailureIgnore>
<failIfNoTests>false</failIfNoTests>
<includes>${test.includes}</includes>
<!-- To be used along with the maven toolchains plugin
Expand Down
8 changes: 4 additions & 4 deletions core/coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, 2020, Red Hat Inc. All rights reserved.
Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, 2021, Red Hat Inc. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -39,7 +39,7 @@
<artifactId>missioncontrol.core</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>coverage</artifactId>
<artifactId>coverage.core</artifactId>
<name>Code coverage report jmc/core</name>
<packaging>pom</packaging>

Expand Down Expand Up @@ -111,7 +111,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>report-aggregate</id>
Expand Down
10 changes: 9 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<manifest-location>META-INF</manifest-location>
<jacoco.plugin.version>0.8.7</jacoco.plugin.version>
<maven.jar.version>3.2.0</maven.jar.version>
<maven.bundle.version>5.1.1</maven.bundle.version>
<spotless.version>2.14.0</spotless.version>
Expand Down Expand Up @@ -116,8 +117,15 @@
<module>org.openjdk.jmc.flightrecorder.writer</module>
<module>org.openjdk.jmc.jdp</module>
<module>tests</module>
<module>coverage</module>
</modules>
<profiles>
<profile>
<id>coverage</id>
<modules>
<module>coverage</module>
</modules>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>jmc-publish</id>
Expand Down
56 changes: 32 additions & 24 deletions core/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<mockito.core.version>3.7.7</mockito.core.version>
<mockito.inline.version>3.7.7</mockito.inline.version>
<build.helper.maven.version>3.2.0</build.helper.maven.version>
<surefireArgLine></surefireArgLine>
</properties>
<profiles>
<profile>
Expand Down Expand Up @@ -111,6 +112,36 @@
<test.excludes>${test.excludes.default}</test.excludes>
</properties>
</profile>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
Expand All @@ -124,35 +155,12 @@
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>-Duser.language=en -Duser.region=nl -Duser.timezone=GMT -Djava.locale.providers=COMPAT ${surefireArgLine}</argLine>
<argLine>-Duser.language=en -Duser.region=nl -Duser.timezone=GMT -Djava.locale.providers=COMPAT @{surefireArgLine}</argLine>
<includes>${test.includes}</includes>
<excludes>${test.excludes}</excludes>
<failIfNoTests>${fail.if.no.tests}</failIfNoTests>
Expand Down

0 comments on commit 35c8e0e

Please sign in to comment.