[SUREFIRE-1351] Performance unit tests should GC to free limited memory size.


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

Branch: refs/heads/master
Commit: dc3f3674e17c3502312a88385272c6add9d4b4ad
Parents: 561c696
Author: Tibor17 <tibo...@lycos.com>
Authored: Sat Apr 1 15:05:02 2017 +0200
Committer: Tibor17 <tibo...@lycos.com>
Committed: Sat Apr 1 15:09:05 2017 +0200

----------------------------------------------------------------------
 surefire-providers/surefire-junit47/pom.xml                     | 1 +
 .../surefire/junitcore/pc/ParallelComputerBuilderTest.java      | 5 +++--
 .../maven/surefire/junitcore/pc/ParallelComputerUtilTest.java   | 3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/dc3f3674/surefire-providers/surefire-junit47/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/pom.xml 
b/surefire-providers/surefire-junit47/pom.xml
index 919c525..91dc0c1 100644
--- a/surefire-providers/surefire-junit47/pom.xml
+++ b/surefire-providers/surefire-junit47/pom.xml
@@ -128,6 +128,7 @@
           <includes>
             <include>**/JUnit47SuiteTest.java</include>
           </includes>
+          <argLine>-Xms256m -Xmx256m</argLine>
         </configuration>
       </plugin>
       <plugin>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/dc3f3674/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java
index 5184cdd..0af17cd 100644
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java
@@ -91,8 +91,7 @@ public class ParallelComputerBuilderTest
     }
 
     @Before
-    public void beforeTest()
-    {
+    public void beforeTest() throws InterruptedException {
         Class1.maxConcurrentMethods = 0;
         Class1.concurrentMethods = 0;
         shutdownTask = null;
@@ -101,6 +100,8 @@ public class ParallelComputerBuilderTest
         NotThreadSafeTest3.t = null;
         NormalTest1.t = null;
         NormalTest2.t = null;
+        System.gc();
+        Thread.sleep( 50L );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/dc3f3674/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtilTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtilTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtilTest.java
index 15daac9..e41dbaa 100644
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtilTest.java
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerUtilTest.java
@@ -87,7 +87,10 @@ public final class ParallelComputerUtilTest
 
     @Before
     public void beforeTest()
+        throws InterruptedException
     {
+        System.gc();
+        Thread.sleep( 50L );
         assertFalse( Thread.currentThread().isInterrupted() );
     }
 

Reply via email to