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/04/03 01:18:17 UTC

[maven-surefire] 01/01: [SUREFIRE-1510] Jenkins CI fails due to performance of Windows break concurrency of forked JVMs

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch windows
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit ee02966ec23638b3ad57f63ba1ae71f886d37ac9
Author: Tibor17 <ti...@apache.org>
AuthorDate: Mon Apr 2 21:05:59 2018 +0200

    [SUREFIRE-1510] Jenkins CI fails due to performance of Windows break concurrency of forked JVMs
---
 surefire-its/src/test/resources/fail-fast-junit/pom.xml             | 1 +
 .../src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java | 5 +++--
 .../src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java | 5 +++--
 .../src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java | 5 +++--
 .../src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java | 5 +++--
 .../src/test/resources/fork-mode/src/test/java/forkMode/Test1.java  | 6 +++---
 .../src/test/resources/fork-mode/src/test/java/forkMode/Test2.java  | 4 +++-
 .../src/test/resources/fork-mode/src/test/java/forkMode/Test3.java  | 4 +++-
 8 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/surefire-its/src/test/resources/fail-fast-junit/pom.xml b/surefire-its/src/test/resources/fail-fast-junit/pom.xml
index b82448e..f46d4ea 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/pom.xml
+++ b/surefire-its/src/test/resources/fail-fast-junit/pom.xml
@@ -54,6 +54,7 @@
         <configuration>
           <runOrder>alphabetical</runOrder>
           <forkMode>once</forkMode><!--override to default value in order to enable forkCount-->
+          <argLine>-Xms16m -Xmx32m</argLine>
         </configuration>
       </plugin>
     </plugins>
diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
index 4d09bab..0104224 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
+++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
@@ -2,17 +2,18 @@ package pkg;
 
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 public class ATest
 {
+    static final int DELAY_MULTIPLIER = 3;
 
     @Test
     public void someMethod()
         throws Exception
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3600 : 1500 );
+        MILLISECONDS.sleep( DELAY_MULTIPLIER * ( Runtime.getRuntime().availableProcessors() == 1 ? 3600L : 1500L ) );
         throw new RuntimeException( "assert \"foo\" == \"bar\"\n" +
                                         "             |\n"
                                         + "             false" );
diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
index 1dc76b7..dfea0dd 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
+++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
@@ -2,7 +2,8 @@ package pkg;
 
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static pkg.ATest.DELAY_MULTIPLIER;
 
 public class BTest
 {
@@ -11,7 +12,7 @@ public class BTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
+        MILLISECONDS.sleep( DELAY_MULTIPLIER * ( Runtime.getRuntime().availableProcessors() == 1 ? 9000L : 3750L ) );
         throw new RuntimeException();
     }
 
diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
index 2660779..125d5d4 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
+++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
@@ -2,7 +2,8 @@ package pkg;
 
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static pkg.ATest.DELAY_MULTIPLIER;
 
 public class CTest
 {
@@ -11,7 +12,7 @@ public class CTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
+        MILLISECONDS.sleep( DELAY_MULTIPLIER * ( Runtime.getRuntime().availableProcessors() == 1 ? 9000L : 3750L ) );
     }
 
 }
diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
index 12a9bc7..3d69f71 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
+++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
@@ -2,7 +2,8 @@ package pkg;
 
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static pkg.ATest.DELAY_MULTIPLIER;
 
 public class DTest
 {
@@ -11,7 +12,7 @@ public class DTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
+        MILLISECONDS.sleep( DELAY_MULTIPLIER * ( Runtime.getRuntime().availableProcessors() == 1 ? 9000L : 3750L ) );
     }
 
 }
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
index 7b3f5ed..5588106 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
@@ -34,10 +34,10 @@ public class Test1
     private static final Random RANDOM = new Random();
 
     public void test1()
-        throws IOException, InterruptedException
+        throws Exception
     {
-        int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" ));
-        Thread.sleep(sleepLength);
+        int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" ) );
+        Thread.sleep( sleepLength );
         dumpPidFile( this );
     }
 
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java
index 33d3cf1..2d4b1dc 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java
@@ -27,7 +27,9 @@ public class Test2
     extends TestCase
 {
 
-    public void test2() throws IOException {
+    public void test2() throws Exception {
+        int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" ) );
+        Thread.sleep( sleepLength );
         Test1.dumpPidFile(this);
     }
 
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
index c8eef74..a0f4f2c 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
@@ -27,7 +27,9 @@ public class Test3
     extends TestCase
 {
 
-    public void test3() throws IOException {
+    public void test3() throws Exception {
+        int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" ) );
+        Thread.sleep( sleepLength );
         Test1.dumpPidFile(this);
     }
 

-- 
To stop receiving notification emails like this one, please contact
tibordigana@apache.org.