db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1448941 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit: NetworkServerTestSetup.java Utilities.java
Date Fri, 22 Feb 2013 08:46:02 GMT
Author: kristwaa
Date: Fri Feb 22 08:46:02 2013
New Revision: 1448941

URL: http://svn.apache.org/r1448941
Log:
DERBY-6012: Print thread dump and dump javacore if NetworkServerTestSetup has to kill off
the Network Server start up process due to timeout

Incremental improvement for error reporting in the case of timeouts.

Patch file: derby-6012-1a-error_reporting.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1448941&r1=1448940&r2=1448941&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Fri Feb 22 08:46:02 2013
@@ -211,7 +211,7 @@ final public class NetworkServerTestSetu
             if (serverShouldComeUp)
             {
                 if (!pingForServerStart(networkServerController)) {
-                    String msg = "Timed out waiting for network server to start";
+                    String msg = getTimeoutErrorMsg("network server to start");
                     // Dump the output from the spawned process
                     // and destroy it.
                     if (spawnedServer != null) {
@@ -219,10 +219,9 @@ final public class NetworkServerTestSetu
                         msg = spawnedServer.getFailMessage(msg);
                         spawnedServer = null;
                     }
-                    fail(msg);
                     //DERBY-6012 print thread dump and java core
-                    fail(ExceptionUtil.dumpThreads());
                     JVMInfo.javaDump();
+                    fail(msg + Utilities.NL + ExceptionUtil.dumpThreads());
                 }
             }
         }
@@ -255,8 +254,7 @@ final public class NetworkServerTestSetu
                     Thread.sleep(SLEEP_TIME);
                 } else {
                     BaseTestCase.fail(
-                        "Timed out waiting for server port " + port +
-                        " to become available on host " + conf.getHostName(),
+                        getTimeoutErrorMsg("server port to become available"),
                         ioe);
                 }
             }
@@ -564,7 +562,7 @@ final public class NetworkServerTestSetu
        throws InterruptedException 
     {
         if (!pingForServerStart(networkServerController)) {
-             fail("Timed out waiting for network server to start");
+             fail(getTimeoutErrorMsg("network server to start"));
         }
     }
     
@@ -715,4 +713,12 @@ final public class NetworkServerTestSetu
         return waitTime;
     }
 
+    /** Returns an error message for timeouts including the port and host. */
+    private static String getTimeoutErrorMsg(String failedAction) {
+        TestConfiguration conf = TestConfiguration.getCurrent();
+        int port = conf.getPort();
+        String host = conf.getHostName();
+        return "Timed out waiting for " +
+                failedAction + " (" + host + ":" + port + ")";
+    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java?rev=1448941&r1=1448940&r2=1448941&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java Fri Feb
22 08:46:02 2013
@@ -40,6 +40,12 @@ import junit.framework.Assert;
  */
 public class Utilities {
 
+    /** The newline character(s). */
+    public static final String NL;
+    static {
+        NL = BaseTestCase.getSystemProperty("line.separator");
+    }
+
     private Utilities() { }
 
     /**



Mime
View raw message