maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r398506 - in /maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter: ForkConfiguration.java SurefireBooter.java
Date Mon, 01 May 2006 02:42:22 GMT
Author: brett
Date: Sun Apr 30 19:42:21 2006
New Revision: 398506

URL: http://svn.apache.org/viewcvs?rev=398506&view=rev
Log:
fix exception output in forking surefire, and permit debugging of forking surefire

Modified:
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java

Modified: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java?rev=398506&r1=398505&r2=398506&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
Sun Apr 30 19:42:21 2006
@@ -141,6 +141,12 @@
             }
         }
 
+        if ( System.getProperty( "maven.surefire.debug" ) != null )
+        {
+            cli.createArgument().setLine(
+                "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
);
+        }
+
         cli.createArgument().setValue( "-classpath" );
 
         cli.createArgument().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator
) );

Modified: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java?rev=398506&r1=398505&r2=398506&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
Sun Apr 30 19:42:21 2006
@@ -655,64 +655,76 @@
      * @param args
      */
     public static void main( String[] args )
-        throws SurefireExecutionException, IOException
+        throws Throwable
     {
-        if ( args.length > 1 )
+        //noinspection CatchGenericClass,OverlyBroadCatchBlock
+        try
         {
-            setSystemProperties( new File( args[1] ) );
-        }
-
-        File surefirePropertiesFile = new File( args[0] );
-        Properties p = loadProperties( surefirePropertiesFile );
+            if ( args.length > 1 )
+            {
+                setSystemProperties( new File( args[1] ) );
+            }
 
-        SurefireBooter surefireBooter = new SurefireBooter();
+            File surefirePropertiesFile = new File( args[0] );
+            Properties p = loadProperties( surefirePropertiesFile );
 
-        for ( Enumeration e = p.propertyNames(); e.hasMoreElements(); )
-        {
-            String name = (String) e.nextElement();
+            SurefireBooter surefireBooter = new SurefireBooter();
 
-            if ( name.startsWith( "report." ) && !name.endsWith( ".params" ) &&
!name.endsWith( ".types" ) )
+            for ( Enumeration e = p.propertyNames(); e.hasMoreElements(); )
             {
-                String className = p.getProperty( name );
+                String name = (String) e.nextElement();
 
-                String params = p.getProperty( name + ".params" );
-                String types = p.getProperty( name + ".types" );
-                surefireBooter.addReport( className, constructParamObjects( params, types
) );
+                if ( name.startsWith( "report." ) && !name.endsWith( ".params" )
&& !name.endsWith( ".types" ) )
+                {
+                    String className = p.getProperty( name );
+
+                    String params = p.getProperty( name + ".params" );
+                    String types = p.getProperty( name + ".types" );
+                    surefireBooter.addReport( className, constructParamObjects( params, types
) );
+                }
+                else if ( name.startsWith( "testSuite." ) && !name.endsWith( ".params"
) && !name.endsWith( ".types" ) )
+                {
+                    String className = p.getProperty( name );
+
+                    String params = p.getProperty( name + ".params" );
+                    String types = p.getProperty( name + ".types" );
+                    surefireBooter.addTestSuite( className, constructParamObjects( params,
types ) );
+                }
+                else if ( name.startsWith( "classPathUrl." ) )
+                {
+                    surefireBooter.addClassPathUrl( p.getProperty( name ) );
+                }
+                else if ( name.startsWith( "surefireClassPathUrl." ) )
+                {
+                    surefireBooter.addSurefireClassPathUrl( p.getProperty( name ) );
+                }
             }
-            else if ( name.startsWith( "testSuite." ) && !name.endsWith( ".params"
) && !name.endsWith( ".types" ) )
-            {
-                String className = p.getProperty( name );
 
-                String params = p.getProperty( name + ".params" );
-                String types = p.getProperty( name + ".types" );
-                surefireBooter.addTestSuite( className, constructParamObjects( params, types
) );
-            }
-            else if ( name.startsWith( "classPathUrl." ) )
+            boolean childDelegation = Boolean.valueOf( p.getProperty( "childDelegation" )
).booleanValue();
+            String testSet = p.getProperty( "testSet" );
+            boolean result;
+            if ( testSet != null )
             {
-                surefireBooter.addClassPathUrl( p.getProperty( name ) );
+                result = surefireBooter.runSuitesInProcess( testSet, childDelegation, p );
             }
-            else if ( name.startsWith( "surefireClassPathUrl." ) )
+            else
             {
-                surefireBooter.addSurefireClassPathUrl( p.getProperty( name ) );
+                result = surefireBooter.runSuitesInProcess( childDelegation );
             }
-        }
 
-        boolean childDelegation = Boolean.valueOf( p.getProperty( "childDelegation" ) ).booleanValue();
-        String testSet = p.getProperty( "testSet" );
-        boolean result;
-        if ( testSet != null )
-        {
-            result = surefireBooter.runSuitesInProcess( testSet, childDelegation, p );
+            surefireBooter.writePropertiesFile( surefirePropertiesFile, "surefire", p );
+
+            //noinspection CallToSystemExit
+            System.exit( result ? TESTS_SUCCEEDED_EXIT_CODE : TESTS_FAILED_EXIT_CODE );
         }
-        else
+        catch ( Throwable t )
         {
-            result = surefireBooter.runSuitesInProcess( childDelegation );
+            // Just throwing does getMessage() and a local trace - we want to call printStackTrace
for a full trace
+            //noinspection UseOfSystemOutOrSystemErr
+            t.printStackTrace( System.err );
+            //noinspection ProhibitedExceptionThrown,CallToSystemExit
+            System.exit( 1 );
         }
-
-        surefireBooter.writePropertiesFile( surefirePropertiesFile, "surefire", p );
-
-        //noinspection CallToSystemExit
-        System.exit( result ? TESTS_SUCCEEDED_EXIT_CODE : TESTS_FAILED_EXIT_CODE );
     }
 
 }



Mime
View raw message