maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject maven-surefire git commit: added more logs, FileDescriptor.out, skipped unit tests in maven-surefire-common
Date Mon, 20 Feb 2017 00:05:30 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/2.19.2-experimental 466fed5cb -> b1b2a08cd


added more logs, FileDescriptor.out, skipped unit tests in maven-surefire-common


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b1b2a08c
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b1b2a08c
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b1b2a08c

Branch: refs/heads/2.19.2-experimental
Commit: b1b2a08cde6bb53c3240950852aef9f70c24b965
Parents: 466fed5
Author: Tibor17 <tibor17@lycos.com>
Authored: Mon Feb 20 01:05:13 2017 +0100
Committer: Tibor17 <tibor17@lycos.com>
Committed: Mon Feb 20 01:05:13 2017 +0100

----------------------------------------------------------------------
 maven-surefire-common/pom.xml                   |  1 +
 .../lazytestprovider/AbstractCommandStream.java |  1 +
 .../AbstractForkInputStream.java                |  4 +++
 .../OutputStreamFlushableCommandline.java       |  5 ++-
 .../TestProvidingInputStream.java               |  7 +++++
 .../booterclient/output/ForkClient.java         |  1 +
 .../maven/surefire/booter/CommandReader.java    | 16 ++++++++--
 .../surefire/booter/ForkingRunListener.java     | 33 +++++++++++++-------
 .../maven/surefire/booter/ForkedBooter.java     | 19 ++++++++---
 9 files changed, 67 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index 54825b7..1e6f94f 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -161,6 +161,7 @@
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <skipTests>true</skipTests>
           <redirectTestOutputToFile>true</redirectTestOutputToFile>
           <includes>
             <include>**/JUnit4SuiteTest.java</include>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractCommandStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractCommandStream.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractCommandStream.java
index 3a9c31b..d7d33f8 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractCommandStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractCommandStream.java
@@ -130,6 +130,7 @@ public abstract class AbstractCommandStream
             System.out.println( getClass().getSimpleName()
                                         + " last byte sent of cmd "
                                         + lastCommand
+                                        + " "
                                         + cmd
                                         + " "
                                         + len

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
index 8cc0cdd..95e742a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
@@ -41,6 +41,8 @@ public abstract class AbstractForkInputStream
      */
     public void setFlushReceiverProvider( FlushReceiverProvider flushReceiverProvider )
     {
+        System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                    + " :: setFlushReceiverProvider() :: " + flushReceiverProvider
);
         this.flushReceiverProvider = requireNonNull( flushReceiverProvider );
     }
 
@@ -52,6 +54,8 @@ public abstract class AbstractForkInputStream
             FlushReceiver flushReceiver = flushReceiverProvider.getFlushReceiver();
             if ( flushReceiver != null )
             {
+                System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                            + " :: tryFlush() :: flushReceiver.flush();"
);
                 flushReceiver.flush();
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
index 5cd19f2..3e56693 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
@@ -51,7 +51,8 @@ public class OutputStreamFlushableCommandline
         public void flush()
             throws IOException
         {
-            System.out.println( getClass().getSimpleName() + " flush OutputStream " );
+            System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                        + " :: flush() :: flush OutputStream" );
             outputStream.flush();
         }
     }
@@ -66,6 +67,8 @@ public class OutputStreamFlushableCommandline
 
         if ( process.getOutputStream() != null )
         {
+            System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                        + " :: execute() :: flushReceiver is set!!!" );
             flushReceiver = new OutputStreamFlushReceiver( process.getOutputStream() );
         }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
index 766843d..e05fad2 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
@@ -148,8 +148,10 @@ public final class TestProvidingInputStream
      */
     public void provideNewTest()
     {
+        System.out.println( getClass().getSimpleName() + "#" + hashCode() + " :: provideNewTest()
:: before if" );
         if ( canContinue() )
         {
+            System.out.println( getClass().getSimpleName() + "#" + hashCode() + " :: provideNewTest()
:: after if" );
             barrier.release();
         }
     }
@@ -159,6 +161,7 @@ public final class TestProvidingInputStream
     {
         if ( closed.compareAndSet( false, true ) )
         {
+            System.out.println( getClass().getSimpleName() + "#" + hashCode() + " :: close()"
);
             invalidateInternalBuffer();
             barrier.drainPermits();
             barrier.release();
@@ -170,7 +173,11 @@ public final class TestProvidingInputStream
     {
         try
         {
+            System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                        + " :: awaitNextTest() :: before acquire" );
             barrier.acquire();
+            System.out.println( getClass().getSimpleName() + "#" + hashCode()
+                                        + " :: awaitNextTest() :: after acquire" );
         }
         catch ( InterruptedException e )
         {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index d6afcb2..2d00244 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -177,6 +177,7 @@ public class ForkClient
 
     private void processLine( String s )
     {
+        System.out.println( getClass().getSimpleName() + "#" + hashCode() + " :: processLine()
:: " + s );
         try
         {
             final byte operationId = (byte) s.charAt( 0 );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
index d7fd900..7e42c8e 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
@@ -25,6 +25,8 @@ import org.apache.maven.surefire.testset.TestSetFailedException;
 
 import java.io.DataInputStream;
 import java.io.EOFException;
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Iterator;
@@ -336,10 +338,18 @@ public final class CommandReader
         private void requestNextTest()
         {
             byte[] encoded = encodeStringForForkCommunication( ( (char) BOOTERCODE_NEXT_TEST
) + ",0,want more!\n" );
-            synchronized ( originalOutStream )
+            synchronized ( FileDescriptor.out )
             {
-                originalOutStream.write( encoded, 0, encoded.length );
-                originalOutStream.flush();
+                FileOutputStream out = new FileOutputStream( FileDescriptor.out );
+                try
+                {
+                    out.write( encoded, 0, encoded.length );
+                    out.getFD().sync();
+                }
+                catch ( IOException e )
+                {
+                    //
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
index 7856dac..84ca644 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
@@ -19,6 +19,9 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Enumeration;
 import java.util.Properties;
@@ -112,8 +115,6 @@ public class ForkingRunListener
     public static final byte BOOTERCODE_WARNING = (byte) 'W';
 
 
-    private final PrintStream target;
-
     private final int testSetChannelId;
 
     private final boolean trimStackTraces;
@@ -124,7 +125,6 @@ public class ForkingRunListener
 
     public ForkingRunListener( PrintStream target, int testSetChannelId, boolean trimStackTraces
)
     {
-        this.target = target;
         this.testSetChannelId = testSetChannelId;
         this.trimStackTraces = trimStackTraces;
         stdOutHeader = createHeader( BOOTERCODE_STDOUT, testSetChannelId );
@@ -203,11 +203,15 @@ public class ForkingRunListener
         System.arraycopy( header, 0, encodeBytes, 0, header.length );
         System.arraycopy( content, 0, encodeBytes, header.length, i );
 
-        synchronized ( target ) // See notes about synchronization/thread safety in class
javadoc
+        synchronized ( FileDescriptor.out ) // See notes about synchronization/thread safety
in class javadoc
         {
-            target.write( encodeBytes, 0, encodeBytes.length );
-            target.flush();
-            if ( target.checkError() )
+            FileOutputStream out = new FileOutputStream( FileDescriptor.out );
+            try
+            {
+                out.write( encodeBytes, 0, encodeBytes.length );
+                out.getFD().sync();
+            }
+            catch ( IOException e )
             {
                 // We MUST NOT throw any exception from this method; otherwise we are in
loop and CPU goes up:
                 // ForkingRunListener -> Exception -> JUnit Notifier and RunListener
-> ForkingRunListener -> Exception
@@ -273,15 +277,20 @@ public class ForkingRunListener
     private void encodeAndWriteToTarget( String string )
     {
         byte[] encodeBytes = encodeStringForForkCommunication( string );
-        synchronized ( target ) // See notes about synchronization/thread safety in class
javadoc
+        synchronized ( FileDescriptor.out ) // See notes about synchronization/thread safety
in class javadoc
         {
-            target.write( encodeBytes, 0, encodeBytes.length );
-            target.flush();
-            if ( target.checkError() )
+            FileOutputStream out = new FileOutputStream( FileDescriptor.out );
+            try
+            {
+                out.write( encodeBytes, 0, encodeBytes.length );
+                out.getFD().sync();
+            }
+            catch ( IOException e )
             {
                 // We MUST NOT throw any exception from this method; otherwise we are in
loop and CPU goes up:
                 // ForkingRunListener -> Exception -> JUnit Notifier and RunListener
-> ForkingRunListener -> Exception
-                DumpErrorSingleton.getSingleton().dumpStreamText( "Unexpected IOException:
" + string );
+                DumpErrorSingleton.getSingleton()
+                        .dumpStreamText( "Unexpected IOException with stream: " + string
);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1b2a08c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index e18b08e..365f297 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -28,8 +28,11 @@ import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.lang.reflect.InvocationTargetException;
@@ -228,13 +231,21 @@ public final class ForkedBooter
         };
     }
 
-    private static void encodeAndWriteToOutput( String string, PrintStream out )
+    private static void encodeAndWriteToOutput( String string, PrintStream out1 )
     {
         byte[] encodeBytes = encodeStringForForkCommunication( string );
-        synchronized ( out )
+        synchronized ( FileDescriptor.out )
         {
-            out.write( encodeBytes, 0, encodeBytes.length );
-            out.flush();
+            FileOutputStream out = new FileOutputStream( FileDescriptor.out );
+            try
+            {
+                out.write( encodeBytes, 0, encodeBytes.length );
+                out.getFD().sync();
+            }
+            catch ( IOException e )
+            {
+                //
+            }
         }
     }
 


Mime
View raw message