db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r420048 - in /db/derby/code/trunk/java/testing: ./ org/apache/derbyTesting/functionTests/harness/ org/apache/derbyTesting/functionTests/tests/lang/ org/apache/derbyTesting/functionTests/tests/largedata/ org/apache/derbyTesting/functionTests...
Date Sat, 08 Jul 2006 04:31:24 GMT
Author: fuzzylogic
Date: Fri Jul  7 21:31:23 2006
New Revision: 420048

URL: http://svn.apache.org/viewvc?rev=420048&view=rev
Log:
DERBY-1091: Test harness does not pass jvm flags properly if there are more
than 1 property in jvm flags

Committed for Myrna Van Lunteren <m.v.lunteren@gmail.com>

Modified:
    db/derby/code/trunk/java/testing/README.htm
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerStream_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/streamingColumn_app.properties

Modified: db/derby/code/trunk/java/testing/README.htm
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/README.htm?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/README.htm (original)
+++ db/derby/code/trunk/java/testing/README.htm Fri Jul  7 21:31:23 2006
@@ -1585,11 +1585,17 @@
           <br>
           <br>
         </li>
-        <li>jvmflags - sets specific jvm properties for the jvm used in
-the
-test harness, for instance initial memory, and heap size, or properties
-normally passed on with a -D. For instance: <br>
-          <small>java -Djvmflags=ms32M -mx128M
+        <li>jvmflags - sets specific jvm properties for each jvm instantiated by the
+test harness, for instance for setting initial memory, and heap size, or other properties
+that need to be passed on to the jvm, separated by '^'. This property
+can be set on the commandline for either RunTest or RunSuite, or in one
+of the properties files used by the tests. The property jvmflags
+when passed on at the command line supercedes the properties set in a suite's propertyfile,

+and those supercede jvmflags properties set in a subsuite's or test's propertyfile,
+because the 'highest' level properties are passed to the jvm last. Setting this property
+for a test that runs with useprocess=false cannot have any effect.
+Example: <br>
+          <small>java -Djvmflags=ms32M^-mx128M
 org.apache.derbyTesting.functionTests.RunTest lang/streamingColumn.java</small><br>
           <br>
         </li>

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
Fri Jul  7 21:31:23 2006
@@ -173,10 +173,10 @@
 
         if (!jvmName.equals("jview"))
         {
-            if (setJvmFlags && (jvmflags.indexOf("-ms") == -1))
+            if (setJvmFlags && ((jvmflags.indexOf("-ms") == -1) || (jvmflags.indexOf("-Xms")
== -1)))
             // only setMs if no starting memory was given
                 jvm.setMs(16*1024*1024); // -ms16m
-            if (setJvmFlags && (jvmflags.indexOf("-mx") == -1))
+            if (setJvmFlags && ((jvmflags.indexOf("-mx") == -1) || (jvmflags.indexOf("-Xmx")
== -1)))
             // only setMx if no max memory was given
                 jvm.setMx(32*1024*1024); // -mx32m
             jvm.setNoasyncgc(true); // -noasyncgc

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
Fri Jul  7 21:31:23 2006
@@ -843,8 +843,25 @@
             javaCmd = "java";
         else
             p.put("javaCmd", javaCmd);
-    	if ( jvmflags != null )
-    		p.put("jvmflags", jvmflags);
+
+        // all jvmflags should get appended, with command line overwrite top suite 
+        // properties overwrite lower level suite properties
+        // but we're letting the jvm handle that by putting the cmdline last.
+        // note that at this point, the parentproperties already should have appended the
+        // jvmflags from the command line and the top suite properties file
+        // only need to add the lower suite properties in the mix
+        String totaljvmflags = jvmflags;
+        String subjvmflags = p.getProperty("jvmflags");
+        String parentjvmflags = parentProperties.getProperty("jvmflags");
+        if ((subjvmflags != null) && (parentjvmflags != null) && (!subjvmflags.equals(parentjvmflags)))
+        {
+            totaljvmflags = subjvmflags + "^" + totaljvmflags;
+        }
+        if (totaljvmflags != null)
+        {
+            jvmflags= totaljvmflags;
+        }
+
     	if ( classpath != null )
     		p.put("classpath", classpath);
     	if ( classpathServer != null )

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunSuite.java
Fri Jul  7 21:31:23 2006
@@ -93,7 +93,6 @@
 		{
 		 		javaCmd = "j9";
 				String javaHome = System.getProperty("java.home");
-				//jvmflags = "-Xiss16k -Xss512k -Xmso16k -Xmx392388k";
 		}
 		String j9config = System.getProperty("com.ibm.oti.configuration");
 		if (j9config != null) 
@@ -384,10 +383,13 @@
 		    javaCmd = jcmd;
 		    suiteProperties.put("javaCmd", javaCmd);
 		}
+		// get System properties for jvmflags, and put them to the end, thus
+		// when the time comes to have this converted into actual jvm flags
+		// the ones given at the command line will overwrite whatever's in the suite
 		String jflags = sp.getProperty("jvmflags");
 		if (jflags != null)
 		{
-		    jvmflags = jflags;
+		    jvmflags = jvmflags + "^" + jflags;
 		    suiteProperties.put("jvmflags", jvmflags);
 		}
 		String testflags = sp.getProperty("testJavaFlags");
@@ -403,7 +405,7 @@
 		if (testprops != null)
 		{
 		    if (testSpecialProps == null)
-		        testSpecialProps = testflags;
+		        testSpecialProps = testprops;
 		    else // add to testSpecialProps
 		        testSpecialProps = testSpecialProps + "^" + testprops;
 		    suiteProperties.put("testSpecialProps", testSpecialProps);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
Fri Jul  7 21:31:23 2006
@@ -285,7 +285,13 @@
             // before going further, get the policy file copied and if
             // needed, modify it with the test's policy file
             composePolicyFile();
-     
+            String spacedJvmFlags = jvmflags;
+            // we now replace any '^' in jvmflags with ' '
+            if ((jvmflags != null) && (jvmflags.indexOf("^")>0))
+            {
+                spacedJvmFlags = spaceJvmFlags(jvmflags);   
+            }
+            
             System.out.println("Initialize for framework: "+ framework );
             if (jvmnet && framework.startsWith("DerbyNet"))
             {
@@ -298,11 +304,11 @@
                 }
 
                 ns = new NetServer(baseDir, jvmnetjvm, classpathServer, null,
-                                     jvmflags,framework, startServer);
+                                     spacedJvmFlags,framework, startServer);
             }
             else
                 ns = new NetServer(baseDir, jvmName, classpathServer, 
-                                     javaCmd, jvmflags,framework, startServer);
+                                     javaCmd, spacedJvmFlags,framework, startServer);
 
             //  With useprocess=true, we have a new dir for each test, and all files for
             // the test, including a clean database, go in that directory. So, network server
@@ -896,6 +902,25 @@
         throws Exception
     {
         // Get any properties specified on the command line
+        
+        // before doing anything else, get jvmflags, evaluate any -D 
+        // see if there is anything useful to the test harness in jvmflags
+        if ((jvmflags != null) && (jvmflags.length() > 0))
+        {
+            StringTokenizer st = new StringTokenizer(jvmflags,"^");
+            while (st.hasMoreTokens())
+            {
+                String tmpstr = st.nextToken();
+                if ((tmpstr.indexOf("=")> 0) && (tmpstr.startsWith("-D")))
+                {
+                    // strip off the '-D'
+                    String key = tmpstr.substring(2, tmpstr.indexOf("="));
+                    String value = tmpstr.substring((tmpstr.indexOf("=") +1), tmpstr.length());
+                    sp.put(key, value);
+                }
+            }
+        }
+        
         searchCP = sp.getProperty("ij.searchClassPath");
 		String frameworkp = sp.getProperty("framework");
 		if (frameworkp != null)
@@ -1292,7 +1317,6 @@
 		// Properties
 		Properties clp = new Properties();
 		Properties ap = new Properties();
-		Properties sdp = new Properties();
 
         // If there are special flags for ij or server, load these
         // into properties to be merged with app and/or derby props
@@ -1391,7 +1415,7 @@
 
 //System.out.println("clPropFile: " + clPropFile.getPath());
             bos = new BufferedOutputStream(new FileOutputStream(clPropFile));
-            clp.save(bos, "Derby Properties");
+            clp.store(bos, "Derby Properties");
         	bos.close();
         }
 
@@ -1435,6 +1459,7 @@
 //System.out.println(defaultPackageName + testBase + "_app.properties");
 //System.out.println("**************");
 
+
         // Try loading the ap and def properties if they exist
         // Merge only if the test's app properties has usedefaults property
         if ( isAp != null )
@@ -1532,8 +1557,39 @@
 		
 //System.out.println("appPropFile: " + appPropFile.getPath());
             bos = new BufferedOutputStream(new FileOutputStream(appPropFile));
-            ap.save(bos, "App Properties");
+            ap.store(bos, "App Properties");
             bos.close();
+            
+            // Check now through jvmflags for insteresting properties
+            // First grab jvmflags from _app.properties for the jvm process cannot
+            // use it if just in the test's _app.properties file
+            // note that it's already too late if useprocess is false
+            String apppropsjvmflags = ap.getProperty("jvmflags");
+            if (apppropsjvmflags != null)
+            {
+                if (jvmflags != null)
+                    jvmflags = apppropsjvmflags + "^" + jvmflags;
+                else
+                    jvmflags = apppropsjvmflags;
+            }
+            // see if there is anything useful for the test harness in jvmflags
+            // from commandline or suite properties
+            if ((jvmflags != null) && (jvmflags.length() > 0))
+            {
+                StringTokenizer st = new StringTokenizer(jvmflags,"^");
+                while (st.hasMoreTokens())
+                {
+                    
+                    String tmpstr = st.nextToken();
+                    if ((tmpstr.indexOf("=")> 0) && (tmpstr.startsWith("-D")))
+                    {
+                        // start at position 2, i.e. strip off the "-D"
+                        String key = tmpstr.substring(2, tmpstr.indexOf("="));
+                        String value = tmpstr.substring((tmpstr.indexOf("=")+1), tmpstr.length());
+                        ap.put(key, value);
+                    }
+                }
+            }
 
             // Depending on the framework, the app prop file may need editing
             if ( (framework.length()>0) || (encryption) )
@@ -1557,7 +1613,7 @@
         		try
         		{
             		bos = new BufferedOutputStream(new FileOutputStream(appPropFile));
-            		ap.save(bos, "Test Properties");
+            		ap.store(bos, "Test Properties");
             		bos.close();
                 }
             	catch(IOException ioe)
@@ -1632,19 +1688,6 @@
 				startServerProp.equalsIgnoreCase("false"))
 				startServer =false;
 			
-	        // Check for jvmflags (like "-nojit -ms32M -mx32M")
-	        // These may have been set as a system property already
-	        if (jvmflags == null)
-	        {
-	            jvmflags = ap.getProperty("jvmflags");
-	            // If set in app props to up the memory, this
-	            // is only meant to be applied to 11x vms
-	            if ( (jvmflags != null) && (!jvmName.equals("currentjvm")) )
-	            {
-	                if (jvmflags.startsWith("-ms"))
-	                    jvmflags = "";
-	            }
-	        }
 	        //Check derbyTesting.encoding property
 	        if(testEncoding == null) {
 	            testEncoding = ap.getProperty("derbyTesting.encoding");
@@ -1653,7 +1696,7 @@
 	            {
 	                    jvmflags = (jvmflags==null?"":jvmflags+" ") 
 	                                + "-Dfile.encoding=" + testEncoding; 
-	                    ap.put("file.encoding",testEncoding);	
+	                    ap.put("file.encoding",testEncoding);
 	            }
 	        }
 	       
@@ -1762,7 +1805,7 @@
         while (st.hasMoreTokens())
         {
 	        String token = st.nextToken();
-            if ( ! (token.startsWith("-D") || token.startsWith("-X"))) { sb.append(dintro);
}
+            if (! (token.startsWith("-"))) { sb.append(dintro); }
             sb.append(token);
             sb.append(" ");
         }
@@ -2242,13 +2285,18 @@
             
         if ( (jvmflags != null) && (jvmflags.length()>0) )
         {
+            // We now replace any '^' in jvmflags with ' '
+            if (jvmflags.indexOf("^")>0)
+            {
+                jvmflags = spaceJvmFlags(jvmflags);
+            }
             jvm.setFlags(jvmflags);
         }
         
         
         if (testType.equals("multi"))
         {
-            if ( (jvmflags != null) && (jvmflags.indexOf("mx") == -1) )
+            if ( (jvmflags != null) && (jvmflags.indexOf("mx") == -1) &&
(jvmflags.indexOf("Xmx") == -1))
                 jvm.setMx(64*1024*1024); // -mx64m
             
             // MultiTest is special case, so pass on properties
@@ -2344,6 +2392,19 @@
         return sCmd;
     }
 
+    public static String spaceJvmFlags(String caretedJvmFlags)
+    {
+    	String spacedJvmFlags = "";
+    	// there must at least be one
+    	StringTokenizer st = new StringTokenizer(jvmflags,"^");
+    	while (st.hasMoreTokens())
+    	{
+    	    spacedJvmFlags += st.nextToken() + " ";
+    	}
+    	spacedJvmFlags = spacedJvmFlags.substring(0,spacedJvmFlags.length() -1);
+    	return spacedJvmFlags;    
+    }
+    
     public static void composePolicyFile() throws ClassNotFoundException
     {
         try{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen_app.properties?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen_app.properties
Fri Jul  7 21:31:23 2006
@@ -1,2 +1,2 @@
 usedefaults=true
-jvmflags=-Xmx512M -Xms512M
+jvmflags=-Xmx512M^-Xms512M

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerStream_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerStream_app.properties?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerStream_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerStream_app.properties
Fri Jul  7 21:31:23 2006
@@ -1,2 +1,2 @@
 usedefaults=true
-jvmflags=-ms32M -mx128M
+jvmflags=-ms32M^-mx128M

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_app.properties?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/wisconsin_app.properties
Fri Jul  7 21:31:23 2006
@@ -11,7 +11,7 @@
 
 # flags specific to this test: it runs out of memory on jdk118 sometimes
 # so give the JVM more memory always:
-jvmflags=-ms32M -mx128M
+jvmflags=-ms32M^-mx128M
 
 usedefaults=true
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
Fri Jul  7 21:31:23 2006
@@ -11,4 +11,4 @@
 # to process the property file.  See any of the .java tests for this code.
 #
 database=jdbc:derby:wombat;create=true
-jvmflags=-mx128M -ms128M
+jvmflags=-mx128M^-ms128M

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/streamingColumn_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/streamingColumn_app.properties?rev=420048&r1=420047&r2=420048&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/streamingColumn_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/streamingColumn_app.properties
Fri Jul  7 21:31:23 2006
@@ -1,4 +1,4 @@
 supportfiles=tests/store/short.data,tests/store/shortbanner,tests/store/derby.banner,tests/store/empty.data,tests/store/char32703.data,tests/store/char32703trailingblanks.data,tests/store/char32675.data,tests/store/char32675trailingblanks.data
 usedefaults=true
-jvmflags=-ms32M -mx128M
+jvmflags=-ms32M^-mx128M
 useextdirs=true



Mime
View raw message