harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r613122 - in /harmony/enhanced/drlvm/trunk: build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc vm/tests/kernel/java/lang/RuntimeTest.java
Date Fri, 18 Jan 2008 10:25:15 GMT
Author: varlax
Date: Fri Jan 18 02:25:14 2008
New Revision: 613122

URL: http://svn.apache.org/viewvc?rev=613122&view=rev
Log:
Fixed HARMONY-3711 [drlvm][test] kernel test RuntimeTest.test_freeMemory fails intermittently:
- invoke gc() to get clean initial state
- skip test if heap is too close to the end
- grow probe in small linear chunks to not jump over starting boundaries

Modified:
    harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc
    harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest.java

Modified: harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc?rev=613122&r1=613121&r2=613122&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc
(original)
+++ harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86.gc_cc
Fri Jan 18 02:25:14 2008
@@ -1,8 +1,5 @@
 ## HARMONY-3521
 java/lang/RuntimeAdditionalTest*.java
 
-## HARMONY-3711
-java/lang/RuntimeTest.java
-
 # HARMONY-3953
 java/lang/ClassTestDesiredAssertionStatus.java

Modified: harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc?rev=613122&r1=613121&r2=613122&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc
(original)
+++ harmony/enhanced/drlvm/trunk/build/make/excludes/exclude.drlvm_kernel.windows.x86_64.gc_cc
Fri Jan 18 02:25:14 2008
@@ -1,8 +1,5 @@
 ## HARMONY-3521
 java/lang/RuntimeAdditionalTest*.java
 
-## HARMONY-3711
-java/lang/RuntimeTest.java
-
 # HARMONY-3953
 java/lang/ClassTestDesiredAssertionStatus.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest.java?rev=613122&r1=613121&r2=613122&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest.java Fri Jan 18 02:25:14
2008
@@ -83,24 +83,30 @@
      *  
      */
     public void test_freeMemory() {
-        /**/System.out.println("test_freeMemory");
+        Runtime.getRuntime().gc();
         long r1 = Runtime.getRuntime().freeMemory();
-        assertTrue("Runtime.freeMemory method must not return negative value!",
+        assertTrue("Runtime.freeMemory() returned negative value: " + r1,
                 r1 >= 0);
+        if (r1 < 500000) {
+            // low memory condition, 
+            // avoid false alarm if indicator is too coarse-grained 
+            return;
+        }
+        int probe = 0;
         try {
             String stmp = "";
-            for (int ind = 0; ind < 100; ind++) {
+            for (int ind = 0; ind < 300; ind++) {
                 stmp += "0123456789";
             }
-            while (true) {
-                stmp += stmp;
-                if (r1 > Runtime.getRuntime().freeMemory())
-                    break;
-
+            String inc = stmp;
+            probe = stmp.length();
+            while (r1 <= Runtime.getRuntime().freeMemory()) {
+                stmp += inc;
+                probe = stmp.length();
             }
         } catch (OutOfMemoryError e) {
-            fail("Runtime.freeMemory method should be sensitive to huge "
-                    + "memory allocating!");
+            fail("Runtime.freeMemory() failed to detect " + probe
+                    + " memory reduction from " + r1);
         }
     }
 



Mime
View raw message