db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1541258 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/junit/BaseTestCase.java java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Date Tue, 12 Nov 2013 22:06:01 GMT
Author: kmarsden
Date: Tue Nov 12 22:06:00 2013
New Revision: 1541258

URL: http://svn.apache.org/r1541258
Log:
DERBY-6401 Create a test option to stop running Junit tests after first failure or error

merge revision 1539829 from trunk


Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1539729

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1541258&r1=1541257&r2=1541258&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
Tue Nov 12 22:06:00 2013
@@ -92,6 +92,7 @@ public abstract class BaseTestCase
     public void runBare() throws Throwable {
         TestConfiguration config = getTestConfiguration();
         boolean trace = config.doTrace();
+        boolean stopAfterFirstFail = config.stopAfterFirstFail();
         long startTime = 0;
         if ( trace )
         {
@@ -155,6 +156,14 @@ public abstract class BaseTestCase
                 if (stackOut != null) {
                     stackOut.close();
                 }
+                if (stopAfterFirstFail) {
+                    // if run with -Dderby.tests.stopAfterFirstFail=true
+                    // exit after reporting failure. Useful for debugging
+                    // cascading failures or errors that lead to hang.
+                    running.printStackTrace(out);
+                    System.exit(1);
+                }
+                else
                 throw running;
             }
         }

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1541258&r1=1541257&r2=1541258&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Tue Nov 12 22:06:00 2013
@@ -119,6 +119,13 @@ public final class TestConfiguration {
     private final static String KEY_VERBOSE = "derby.tests.debug";    
     private final static String KEY_LOGIN_TIMEOUT = "derby.tests.login.timeout";    
     private final static String KEY_TRACE = "derby.tests.trace";
+
+    /**
+     * derby.tests.stopAfterFirstFail - debugging property to exit after 
+     * first failure. Can be useful for debugging cascading failures or errors
+     * that lead to hang scenario.
+     */
+    private final static String KEY_STOP_AFTER_FIRST_FAIL = "derby.tests.stopAfterFirstFail";
     private final static String KEY_SSL = "ssl";
     private final static String KEY_JMX_PORT = "jmxPort";
     
@@ -1165,7 +1172,9 @@ public final class TestConfiguration {
         this.doTrace = Boolean.valueOf(
             getSystemProperties().getProperty(KEY_TRACE)).
             booleanValue();
-        
+        this.stopAfterFirstFail = Boolean.valueOf(
+                getSystemProperties().getProperty(KEY_STOP_AFTER_FIRST_FAIL)).
+                booleanValue();
         this.jdbcClient = JDBCClient.getDefaultEmbedded();
         this.ssl = null;
         this.jmxPort = getNextAvailablePort();
@@ -1983,6 +1992,9 @@ public final class TestConfiguration {
         return doTrace;
     }
 
+    public boolean stopAfterFirstFail() {
+        return stopAfterFirstFail;
+    }
 	/**
 	 * <p>
 	 * Return true if we classes are being loaded from jar files. For the time
@@ -2094,6 +2106,7 @@ public final class TestConfiguration {
     private final int jmxPort;
     private boolean isVerbose;
     private boolean doTrace;
+    private boolean stopAfterFirstFail;
     private String ssl;
 
     /**



Mime
View raw message