Nice/src/nice/tools/testsuite TestNice.java,1.31,1.32 TestCase.java,1.33,1.34

Daniel Bonniot <[email protected]> Wed, 23 Mar 2005 17:56:32 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16378/src/nice/tools/testsuite

Modified Files:
	TestNice.java TestCase.java 
Log Message:
Allow testcases to be run in a distinct JVM.


Index: TestCase.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** TestCase.java	21 Mar 2005 21:25:57 -0000	1.33
--- TestCase.java	23 Mar 2005 17:56:29 -0000	1.34
***************
*** 370,373 ****
--- 370,388 ----
  	}
  
+ 	public void runJVM(String jvm, String main) throws TestSuiteException {
+ 		try {
+ 			Process p = Runtime.getRuntime().exec(jvm + " -classpath classes:" + TestNice.getTempFolder() + " " + main);
+ 			CharArrayWriter out = new CharArrayWriter();
+ 			int exitValue = nice.tools.compiler.dispatch.waitFor(p, out);
+ 			// Print the output of the execution.
+ 			System.out.println(out.toString());
+ 			if (exitValue != 0)
+ 				throw new TestSuiteException("Exit code: " + exitValue);
+ 		}
+ 		catch(IOException e) {
+ 			throw new TestSuiteException(e.getMessage());
+ 		}
+ 	}
+ 
  	/**
  	 * Runs the main method of the testcase. Only if main method exists and
***************
*** 397,400 ****
--- 412,421 ----
  					&&  ! _dontCompilePackages.contains(sourceFile.getPackage()))
  				{
+ 					if (TestNice.getJVM() != null)
+ 						{
+ 							runJVM(TestNice.getJVM(), sourceFile.getPackage() + ".fun");
+ 							continue;
+ 						}
+ 
  					ClassLoader loader = TestNice.getClassLoader();
  					try {

Index: TestNice.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestNice.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** TestNice.java	23 Feb 2005 16:57:57 -0000	1.31
--- TestNice.java	23 Mar 2005 17:56:29 -0000	1.32
***************
*** 143,146 ****
--- 143,154 ----
  
  	/**
+ 		 A JVM with which to run generated code (in a separate process).
+ 		 Useful for testing alternative JVMs like Kaffe without using them for
+ 		 running the testengine and the compilation itself.
+ 	*/
+ 	private static String _jvm = null;
+ 
+ 
+ 	/**
  	 * TODO
  	 * 
***************
*** 273,276 ****
--- 281,286 ----
  				else if ("-gcc".equalsIgnoreCase(s))
  					setGcc(args[i++]);
+ 				else if ("-jvm".equalsIgnoreCase(s))
+ 					setJvm(args[i++]);
  				else if ("-comment".equalsIgnoreCase(s))
  					_writeComments = true;
***************
*** 318,321 ****
--- 328,335 ----
  
  
+ 	private static void setJvm(String jvm) {
+ 		_jvm = jvm;
+ 	}
+ 
  
  	/**
***************
*** 542,545 ****
--- 556,564 ----
  
  
+ 	static String getJVM() {
+ 		return _jvm;
+ 	}
+ 
+ 
  
  	/**



-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click