This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Harness fix


This patch allows the Harness to display info that tests sent to their
error stream (via System.err.pritnln or Throwable.printStackTrace or
something similar).  It also stops the timeout watcher for the startup
process and passes vmargs when autodetecting the bootclasspath for the
compiler.

The commit also included the README because I forgot to check it in with
the update I made yesterday (that patch was sent to this list).

2006-06-22  Anthony Balkissoon  <abalkiss@redhat.com>

	* Harness.java: 
	(runner_in_err): New field.
	(getBootClassPath): Use the vmArgs when forking the detector.
	(finalize): Close the pipe to the RunnerProcess' error stream.
	(initProcess): Set up the pipe to the RunnerProcess' error stream. 
	Stop the watcher after confirming startup.
	(runTest): Collect error stream output from the RunnerProcess in a 
	StringBuffer and print it when there's no new regular output from the 
	test.  Also print it after the test has completed.

--Tony
Index: Harness.java
===================================================================
RCS file: /cvs/mauve/mauve/Harness.java,v
retrieving revision 1.12
diff -u -r1.12 Harness.java
--- Harness.java	21 Jun 2006 20:17:55 -0000	1.12
+++ Harness.java	22 Jun 2006 20:01:51 -0000
@@ -128,6 +128,9 @@
 
   // A way to listen to the runner process
   private static BufferedReader runner_in = null;
+  
+  // A way to listen to the runner process' standard error stream
+  private static BufferedReader runner_in_err = null;
 
   // The process that will run the tests for us
   private static Process runnerProcess = null;
@@ -393,7 +396,6 @@
         throw e;
       }
     }
-    
     // Set up the compiler and the PrintWriters for the compile errors.
     ecjConstructor = 
       klass.getConstructor 
@@ -405,7 +407,6 @@
     
     ecjWriterErr = new CompilerErrorWriter(System.out);
     ecjWriterOut = new PrintWriter(System.out);
-    
     // Set up the compiler options now that we know whether or not we are
     // compiling.
     compileStringBase += getClasspathInstallString();
@@ -477,7 +478,7 @@
   {
     try
     {
-      String c = vmCommand + " Harness$DetectBootclasspath";
+      String c = vmCommand + vmArgs + " Harness$DetectBootclasspath";      
       Process p = Runtime.getRuntime().exec(c);
       BufferedReader br = 
         new BufferedReader
@@ -622,6 +623,7 @@
       {
         runTest("_dump_data_");
         runner_in.close();
+        runner_in_err.close();
         runner_out.close();        
         runnerProcess.destroy();
       } 
@@ -652,7 +654,10 @@
         runner_out = new PrintWriter(runnerProcess.getOutputStream(), true);
         runner_in = 
           new BufferedReader
-          (new InputStreamReader(runnerProcess.getInputStream()));                
+          (new InputStreamReader(runnerProcess.getInputStream()));
+        runner_in_err = 
+            new BufferedReader
+            (new InputStreamReader(runnerProcess.getErrorStream()));                
       }
     catch (IOException e)
       {
@@ -667,6 +672,7 @@
     // to time out.
     runner_watcher = new TimeoutWatcher(runner_timeout);    
     runTest("_confirm_startup_");
+    runner_watcher.stop();
     runner_watcher = new TimeoutWatcher(runner_timeout);
   }
   
@@ -756,6 +762,7 @@
   {
     String tn = stripPrefix(testName.replace(File.separatorChar, '.'));
     String outputFromTest;
+    StringBuffer sb = new StringBuffer();
     boolean invalidTest = false;
     int temp = -1;
 
@@ -788,6 +795,7 @@
             try
               {
                 runner_in.close();
+                runner_in_err.close();
                 runner_out.close();
                 runnerProcess.destroy();
               }
@@ -801,6 +809,8 @@
           }
         try
         {
+          if (runner_in_err.ready())
+            sb.append(runner_in_err.readLine() + "\n");
           if (runner_in.ready())
             {
               outputFromTest = runner_in.readLine();              
@@ -845,11 +855,17 @@
                 // pass these on to stdout.
                 System.out.println(outputFromTest);
             }
+          else
+            {
+              System.err.print(sb.toString());
+              sb = new StringBuffer();
+            }
         }
         catch (IOException e)
         {
         }
       }
+    System.err.print(sb.toString());
     if (temp == -1)
       {        
         // This means the watcher thread had to stop the process 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]