public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* Harness fix
@ 2006-06-22 20:05 Anthony Balkissoon
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Balkissoon @ 2006-06-22 20:05 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

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

[-- Attachment #2: AcceptRunnerErrorStream.diff --]
[-- Type: text/x-patch, Size: 3508 bytes --]

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 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Harness fix
@ 2006-05-18 20:06 Anthony Balkissoon
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Balkissoon @ 2006-05-18 20:06 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]

This patch moves DetectBootclasspath from
gnu/testlet/DetectBootclasspath to an inner class of Harness which
indirectly fixes a problem found by Tom Fitzsimmons where
DetectBootclasspath wasn't being compiled by default, leading to
problems setting up the compiler.

2006-05-18  Anthony Balkissoon  <abalkiss@redhat.com>

	* Harness.java:
	(getBootClassPath): Changed location of DetectBootclasspath because it
	is now an inner class of Harness rather than a separate source file
	in gnu/testlet.
	(Harness.DetectBootclasspath): New inner class.
	* gnu/testlet/DetectBootclasspath.java: Removed this file.

--Tony

[-- Attachment #2: DBCPFix.diff --]
[-- Type: text/x-patch, Size: 6088 bytes --]

Index: Harness.java
===================================================================
RCS file: /cvs/mauve/mauve/Harness.java,v
retrieving revision 1.6
diff -u -r1.6 Harness.java
--- Harness.java	26 Apr 2006 19:49:31 -0000	1.6
+++ Harness.java	18 May 2006 20:00:30 -0000
@@ -389,8 +389,7 @@
       ("compile", new Class[] 
           { String.class, PrintWriter.class, PrintWriter.class });    
     ecjWriterOut = new PrintWriter(new FileOutputStream(".ecjOut"));
-    ecjWriterErr = new PrintWriter(new FileOutputStream(".ecjErr"));
-    
+    ecjWriterErr = new PrintWriter(new FileOutputStream(".ecjErr"));        
     
     // Set up the compiler options now that we know whether or not we are
     // compiling, and print a header to the compiler error file.
@@ -474,7 +473,7 @@
   }
   
   /**
-   * Forks a process to run gnu/testlet/DetectBootclasspath on the VM that is
+   * Forks a process to run DetectBootclasspath on the VM that is
    * being tested.  This program detects the bootclasspath so we can use
    * it for the compiler's bootclasspath.
    * @return the bootclasspath as found, or null if none could be found.
@@ -483,8 +482,8 @@
   {
     try
     {
-      String c = vmCommand + " gnu.testlet.DetectBootclasspath";
-      Process p = Runtime.getRuntime().exec(c);      
+      String c = vmCommand + " Harness$DetectBootclasspath";
+      Process p = Runtime.getRuntime().exec(c);
       BufferedReader br = 
         new BufferedReader
         (new InputStreamReader(p.getInputStream()));
@@ -1031,8 +1030,7 @@
               if (temp.indexOf("gnu" + File.separatorChar + "testlet") != - 1
                   && temp.indexOf(folderName) == - 1)
                 break;
-              
-              
+                            
               // Look for test names for failing tests, so we can exclude
               // them from the run.  
               loc = temp.indexOf("gnu" + File.separatorChar + "testlet");
@@ -1296,4 +1294,57 @@
         }
     }
   }
+  
+  /**
+   * This tiny class is used for finding the bootclasspath of the VM used
+   * to run the tests.
+   * @author Anthony Balkissoon abalkiss at redhat dot com
+   *
+   */
+  public static class DetectBootclasspath
+  {
+    /**
+     * Look in the system properties for the bootclasspath of the VM and return
+     * it to the process that forked this process via the System.out stream.
+     * 
+     * Tries first to get the property "sun.boot.class.path", if there is none,
+     * then it tries "java.boot.class.path", if there is still no match, looks
+     * to see if there is a unique property key that contains "boot.class.path".
+     * If this fails too, prints an error message.
+     */
+    public static void main (String[] args)
+    {
+      String result = "BCP_FINDER:";
+      // Sun's VM stores the bootclasspath as "sun.boot.class.path".
+      String temp = System.getProperty("sun.boot.class.path");
+      if (temp == null)
+        // JamVM stores it as "boot.class.path"
+        temp = System.getProperty("java.boot.class.path");
+      if (temp == null)
+        {        
+          String[] s = (String[])(System.getProperties().keySet().toArray());
+          int count = 0;
+          String key = null;
+          for (int i = 0; i < s.length; i++)
+            {
+              if (s[i].indexOf("boot.class.path") != -1)
+                {
+                  count ++;
+                  key = s[i];                
+                }
+            }
+          if (count == 1)
+            temp = System.getProperty(key);
+          else
+            {
+              System.out.println("WARNING: Cannot auto-detect the " +
+                      "bootclasspath for your VM, please file a bug report" +
+                      " specifying which VM you are testing.");
+              return;
+            }
+        }
+      System.out.println(result + temp);
+    }
+  }
+
 }
Index: gnu/testlet/DetectBootclasspath.java
===================================================================
RCS file: gnu/testlet/DetectBootclasspath.java
diff -N gnu/testlet/DetectBootclasspath.java
--- gnu/testlet/DetectBootclasspath.java	26 Apr 2006 18:11:11 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
-package gnu.testlet;
-
-
-/**
- * This tiny class is used for finding the bootclasspath of the VM used
- * to run the tests.
- * @author Anthony Balkissoon abalkiss at redhat dot com
- *
- */
-public class DetectBootclasspath
-{
-  /**
-   * Look in the system properties for the bootclasspath of the VM and return
-   * it to the process that forked this process via the System.out stream.
-   * 
-   * Tries first to get the property "sun.boot.class.path", if there is none,
-   * then it tries "java.boot.class.path", if there is still no match, looks
-   * to see if there is a unique property key that contains "boot.class.path".
-   * If this fails too, prints an error message.
-   */
-  public static void main (String[] args)
-  {
-    String result = "BCP_FINDER:";
-    // Sun's VM stores the bootclasspath as "sun.boot.class.path".
-    String temp = System.getProperty("sun.boot.class.path");
-    if (temp == null)
-      // JamVM stores it as "boot.class.path"
-      temp = System.getProperty("java.boot.class.path");
-    if (temp == null)
-      {        
-        String[] s = (String[])(System.getProperties().keySet().toArray());
-        int count = 0;
-        String key = null;
-        for (int i = 0; i < s.length; i++)
-          {
-            if (s[i].indexOf("boot.class.path") != -1)
-              {
-                count ++;
-                key = s[i];                
-              }
-          }
-        if (count == 1)
-          temp = System.getProperty(key);
-        else
-          {
-            System.out.println("WARNING: Cannot auto-detect the " +
-                    "bootclasspath for your VM, please file a bug report" +
-                    " specifying which VM you are testing.");
-            return;
-          }
-      }
-    System.out.println(result + temp);
-  }
-}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-22 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-22 20:05 Harness fix Anthony Balkissoon
  -- strict thread matches above, loose matches on Subject: below --
2006-05-18 20:06 Anthony Balkissoon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).