maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [1/2] maven-surefire git commit: [SUREFIRE] make more stable test
Date Tue, 20 Oct 2015 18:51:26 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 3a421d33a -> ffadd7e72


[SUREFIRE] make more stable test


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

Branch: refs/heads/master
Commit: 8fd5d9f6f856847d382463097f015baa4020a450
Parents: 3a421d3
Author: Tibor17 <tibor17@lycos.com>
Authored: Tue Oct 20 20:38:39 2015 +0200
Committer: Tibor17 <tibor17@lycos.com>
Committed: Tue Oct 20 20:38:39 2015 +0200

----------------------------------------------------------------------
 .../junitcore/pc/ParallelComputerBuilderTest.java      | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8fd5d9f6/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 2cc1b5d..50faaa9 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
@@ -522,13 +522,24 @@ public class ParallelComputerBuilderTest
     public void beforeAfterThreadChanges()
         throws InterruptedException
     {
+        // try to GC dead Thread objects from previous tests
+        for ( int i = 0; i < 5; i++ )
+        {
+            System.gc();
+            TimeUnit.MILLISECONDS.sleep( 500 );
+        }
         Collection<Thread> expectedThreads = jvmThreads();
         ParallelComputerBuilder parallelComputerBuilder = new ParallelComputerBuilder( new
Logger() );
         parallelComputerBuilder.parallelMethods( 3 );
         ParallelComputer computer = parallelComputerBuilder.buildComputer();
         Result result = new JUnitCore().run( computer, TestWithBeforeAfter.class );
         assertTrue( result.wasSuccessful() );
-        TimeUnit.MILLISECONDS.sleep( 1250 );
+        // try to GC dead Thread objects
+        for ( int i = 0; i < 5 && expectedThreads.size() != jvmThreads().size();
i++ )
+        {
+            System.gc();
+            TimeUnit.MILLISECONDS.sleep( 500 );
+        }
         assertThat( jvmThreads(), is( expectedThreads ) );
     }
 


Mime
View raw message