You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/01/13 15:44:31 UTC

[6/6] maven-surefire git commit: [SUREFIRE-1455] JaCoCo on integration tests

[SUREFIRE-1455] JaCoCo on integration tests


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/27a5e6ae
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/27a5e6ae
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/27a5e6ae

Branch: refs/heads/SUREFIRE-1455
Commit: 27a5e6aeba83b8a00924a2457652651a298ee0a1
Parents: 2c5c594
Author: Tibor17 <ti...@apache.org>
Authored: Wed Dec 27 17:01:25 2017 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sat Jan 13 16:44:06 2018 +0100

----------------------------------------------------------------------
 pom.xml                                         | 63 ++++++++------------
 surefire-integration-tests/pom.xml              | 53 +++++++---------
 .../surefire/its/fixture/SurefireLauncher.java  | 15 ++++-
 .../src/test/resources/junit47-parallel/pom.xml | 10 ++++
 .../src/test/resources/testng-simple/pom.xml    |  2 +
 5 files changed, 72 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27a5e6ae/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d6b74bb..3592b31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -433,7 +433,7 @@
           <configuration>
             <!-- NOTE: Be sure to isolate the Surefire version under test from the version running the tests! -->
             <useSystemClassLoader>false</useSystemClassLoader>
-            <argLine>-Xms128m -Xmx128m</argLine>
+            <argLine>-Xms128m -Xmx144m ${jacoco.agent}</argLine>
           </configuration>
         </plugin>
         <plugin>
@@ -463,14 +463,6 @@
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <version>0.7.9</version>
-          <configuration>
-            <includes>
-              <include>**/failsafe/*</include>
-              <include>**/failsafe/**/*</include>
-              <include>**/surefire/*</include>
-              <include>**/surefire/**/*</include>
-            </includes>
-          </configuration>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
@@ -481,6 +473,31 @@
     </pluginManagement>
     <plugins>
       <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>jacoco-agent</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <propertyName>jacoco.agent</propertyName>
+          <append>true</append>
+          <inclNoLocationClasses>true</inclNoLocationClasses>
+          <haltOnFailure>false</haltOnFailure>
+          <jmx>false</jmx>
+          <includes>
+            <include>**/failsafe/*</include>
+            <include>**/failsafe/**/*</include>
+            <include>**/surefire/*</include>
+            <include>**/surefire/**/*</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
         <version>3.0.0-M1</version>
@@ -693,33 +710,5 @@
         </plugins>
       </build>
     </profile>
-    <profile>
-      <id>jenkins</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.jacoco</groupId>
-            <artifactId>jacoco-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>jacoco-agent</id>
-                <goals>
-                  <goal>prepare-agent</goal>
-                </goals>
-                <configuration>
-                  <propertyName>jacoco.agent</propertyName>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <argLine>-Xms128m -Xmx144m ${jacoco.agent}</argLine>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
   </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27a5e6ae/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index 4187d5f..c1a6c4a 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -117,6 +117,7 @@
             <testBuildDirectory>${project.build.testOutputDirectory}</testBuildDirectory>
             <verifier.forkMode>${verifier.forkMode}</verifier.forkMode>
             <jdk.home>${jdk.home}</jdk.home>
+            <jacoco.agent>${jacoco-it.agent}</jacoco.agent>
           </systemPropertyVariables>
           <redirectTestOutputToFile>false</redirectTestOutputToFile>
         </configuration>
@@ -163,6 +164,27 @@
         </configuration>
       </plugin>
       <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>jacoco-agent</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>jacoco-agent-it</id>
+            <goals>
+              <goal>prepare-agent-integration</goal>
+            </goals>
+            <configuration>
+              <propertyName>jacoco-it.agent</propertyName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
           <skip>true</skip>
@@ -208,36 +230,5 @@
         <verifier.forkMode>auto</verifier.forkMode>
       </properties>
     </profile>
-    <profile>
-      <id>jenkins</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.jacoco</groupId>
-            <artifactId>jacoco-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>jacoco-agent</id>
-                <goals>
-                  <goal>prepare-agent</goal>
-                </goals>
-                <configuration>
-                  <skip>true</skip>
-                </configuration>
-              </execution>
-              <execution>
-                <id>jacoco-agent-it</id>
-                <goals>
-                  <goal>prepare-agent-integration</goal>
-                </goals>
-                <configuration>
-                  <propertyName>argLine</propertyName>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
   </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27a5e6ae/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 163aaac..1c6c971 100755
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -23,10 +23,9 @@ import org.apache.maven.it.VerificationException;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
-import static java.util.Collections.singletonList;
-
 /**
  * Encapsulate all needed features to start a surefire run
  * <br>
@@ -119,7 +118,17 @@ public final class SurefireLauncher
 
     private List<String> getInitialGoals()
     {
-        return singletonList( "-Dsurefire.version=" + surefireVersion );
+        List<String> goals = new ArrayList<>();
+
+        goals.add( "-Dsurefire.version=" + surefireVersion );
+
+        String jacocoAgent = System.getProperty( "jacoco.agent", "" );
+        if ( !jacocoAgent.isEmpty() )
+        {
+            goals.add( "-Djacoco.agent=" + jacocoAgent );
+        }
+
+        return goals;
     }
 
     public SurefireLauncher showErrorStackTraces()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27a5e6ae/surefire-integration-tests/src/test/resources/junit47-parallel/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-parallel/pom.xml b/surefire-integration-tests/src/test/resources/junit47-parallel/pom.xml
index 1a61ae1..2c17576 100644
--- a/surefire-integration-tests/src/test/resources/junit47-parallel/pom.xml
+++ b/surefire-integration-tests/src/test/resources/junit47-parallel/pom.xml
@@ -26,11 +26,13 @@
     <version>1.0</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
+
   <groupId>org.apache.maven.plugins.surefire</groupId>
   <artifactId>junit47-parallel</artifactId>
   <version>1.0-SNAPSHOT</version>
   <name>junit47-parallel</name>
   <url>http://maven.apache.org</url>
+
   <developers>
     <developer>
       <id>tibordigana</id>
@@ -49,6 +51,11 @@
       <version>4.8.1</version>
     </dependency>
   </dependencies>
+
+  <properties>
+    <argLine/>
+  </properties>
+
   <build>
     <plugins>
       <plugin>
@@ -60,6 +67,9 @@
       </plugin>
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>${argLine} ${jacoco.agent}</argLine>
+        </configuration>
       </plugin>
     </plugins>
   </build>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27a5e6ae/surefire-integration-tests/src/test/resources/testng-simple/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/testng-simple/pom.xml b/surefire-integration-tests/src/test/resources/testng-simple/pom.xml
index 2fcdfde..ebf9f03 100644
--- a/surefire-integration-tests/src/test/resources/testng-simple/pom.xml
+++ b/surefire-integration-tests/src/test/resources/testng-simple/pom.xml
@@ -74,6 +74,7 @@
 
   <properties>
     <surefire.testng.verbose>0</surefire.testng.verbose>
+    <argLine/>
   </properties>
 
   <build>
@@ -92,6 +93,7 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <version>${surefire.version}</version>
         <configuration>
+          <argLine>${argLine} ${jacoco.agent}</argLine>
           <runOrder>reversealphabetical</runOrder>
           <properties>
             <property>