harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r502047 - in /harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc: PhantomReferenceTest.java WeakReferenceTest.java
Date Wed, 31 Jan 2007 23:51:53 GMT
Author: gshimansky
Date: Wed Jan 31 15:51:52 2007
New Revision: 502047

URL: http://svn.apache.org/viewvc?view=rev&rev=502047
Log:
Applied HARMONY-3101 [drlvm][smoke tests] smoke tests gc.WeakReferenceTest and gc.PhantomReferenceTest
fail in some environment


Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/PhantomReferenceTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/WeakReferenceTest.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/PhantomReferenceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/PhantomReferenceTest.java?view=diff&rev=502047&r1=502046&r2=502047
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/PhantomReferenceTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/PhantomReferenceTest.java Wed Jan 31 15:51:52
2007
@@ -41,13 +41,22 @@
 
         System.gc();
         System.out.println("waiting for a reference..");
-        Reference enqueued = queue.poll();
-        if (ref.get() != null) {
-            System.out.println("FAIL: reference was not cleared.");
+        // wait a little before calling poll()
+        Reference enqueued;
+        int count = 500;
+        do {
+            try {
+                Thread.sleep(20);
+            } catch (Exception e) {
+            }
+            enqueued = queue.poll();
+        } while (enqueued == null && count-- > 0);
+        if (count == 0) {
+            System.out.println("FAIL: reference was not enqueued");
             return;
         }
-        if (enqueued == null) {
-            System.out.println("FAIL: reference was not enqueued");
+        if (ref.get() != null) {
+            System.out.println("FAIL: reference was not cleared.");
             return;
         }
         if (enqueued.get() != null) {

Modified: harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/WeakReferenceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/WeakReferenceTest.java?view=diff&rev=502047&r1=502046&r2=502047
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/WeakReferenceTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/WeakReferenceTest.java Wed Jan 31 15:51:52
2007
@@ -45,13 +45,22 @@
 
         System.gc();
         System.out.println("waiting for a reference..");
-        Reference enqueued = queue.poll();
-        if (ref.get() != null) {
-            System.out.println("FAIL: reference was not cleared.");
+        // wait a little before calling poll()
+        Reference enqueued;
+        int count = 500;
+        do {
+            try {
+                Thread.sleep(20);
+            } catch (Exception e) {
+            }
+            enqueued = queue.poll();
+        } while (enqueued == null && count-- > 0);
+        if (count == 0) {
+            System.out.println("FAIL: reference was not enqueued");
             return;
         }
-        if (enqueued == null) {
-            System.out.println("FAIL: reference was not enqueued");
+        if (ref.get() != null) {
+            System.out.println("FAIL: reference was not cleared.");
             return;
         }
         if (enqueued.get() != null) {



Mime
View raw message