You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2011/09/16 18:57:57 UTC

svn commit: r1171665 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/lang/_Suite.java functionTests/tests/memory/MemoryLeakFixesTest.java functionTests/tests/upgradeTests/OldVersions.java junit/BaseTestCase.java

Author: kahatlen
Date: Fri Sep 16 16:57:57 2011
New Revision: 1171665

URL: http://svn.apache.org/viewvc?rev=1171665&view=rev
Log:
DERBY-5412: MemoryLeakFixesTest.testRepeatedDatabaseCreationWithAutoStats() fails on phoneME: java.lang.InternalError: Number of class names exceeds vm limit.

BaseTestCase: Added helper method isPhoneME() that checks if the test
is running on a phoneME platform.

OldVersions and lang._Suite: Replaced existing checks for phoneME with
the new helper method.

MemoryLeakFixesTest: Added assertion to verify that database was
successfully shut down. Added manually invoked garbage collection on
phoneME to avoid exceeding internal limit on number of class names.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/MemoryLeakFixesTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/OldVersions.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1171665&r1=1171664&r2=1171665&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Fri Sep 16 16:57:57 2011
@@ -169,8 +169,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(LangHarnessJavaTest.suite());
         		
         suite.addTest(ResultSetsFromPreparedStatementTest.suite());
-        if (!( System.getProperty("java.vm.name").equals("CVM")
-            && System.getProperty("java.vm.version").startsWith("phoneme") ) )
+        if (!isPhoneME())
         { // Disable temporarily until CVM/phoneME is fixed.. See DERBY-4290)
         suite.addTest(OrderByAndSortAvoidance.suite());
         }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/MemoryLeakFixesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/MemoryLeakFixesTest.java?rev=1171665&r1=1171664&r2=1171665&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/MemoryLeakFixesTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/MemoryLeakFixesTest.java Fri Sep 16 16:57:57 2011
@@ -230,11 +230,20 @@ public class MemoryLeakFixesTest extends
             JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
             try {
                 ds.getConnection();
+                fail("Expected shutdown exception");
             } catch (SQLException e) {
                 assertSQLState("08006", e);
             } finally {
                 JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");
             }
+
+            if (isPhoneME()) {
+                // DERBY-5412: phoneME fails after some iterations because the
+                // number of class names exceeds a VM limit. If we invoke
+                // garbage collection manually, it seems to be able to reclaim
+                // the classes that are no longer in use, and complete the test.
+                Runtime.getRuntime().gc();
+            }
         }
 
         // extra sanity check making sure that the database was created in the

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/OldVersions.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/OldVersions.java?rev=1171665&r1=1171664&r2=1171665&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/OldVersions.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/OldVersions.java Fri Sep 16 16:57:57 2011
@@ -100,8 +100,7 @@ public class OldVersions
             }
             // Derby 10.3.1.4 does not boot on the phoneME advanced platform,
             // (see DERBY-3176) so don't run upgrade tests in this combination.
-            if ( System.getProperty("java.vm.name").equals("CVM")
-                  && System.getProperty("java.vm.version").startsWith("phoneme")
+            if ( BaseTestCase.isPhoneME()
                   && old[i][0]==10 && old[i][1]==3 
                   && old[i][2]==1 && old[i][3]==4 ) {
                 traceit("Skipping 10.3.1.4 on CVM/phoneme");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1171665&r1=1171664&r2=1171665&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Fri Sep 16 16:57:57 2011
@@ -607,6 +607,16 @@ public abstract class BaseTestCase
     }
 
     /**
+     * Check if the VM is phoneME.
+     *
+     * @return true if it is phoneME
+     */
+    public static boolean isPhoneME() {
+        return getSystemProperty("java.vm.name").equals("CVM") &&
+                getSystemProperty("java.vm.version").startsWith("phoneme");
+    }
+
+    /**
      * Determine if there is a platform match with os.name.
      * This method uses an exact equals. Other methods might be useful
      * later for starts with.