I use Pax Exam 4.11.0 and surefire plugin 2.20.1. The issue reproduces if I run Karaf as a separated process (KarafDistributionOption.runEmbedded(false)).
The issue is in communication between Surefire and PaxExam. Surefire uses System.in for communication between maven plugin's process and process where tests are running. The cause of the issue is that KarafJavaRunner steals master commands from surefire's CommandReader because they use System.in for sending data between processes. The flow: 1. Maven plugin’s process creates fork JVM process where tests will be run. 2. Test Fork’s process executes test with Pax Exam runner which creates new fork process with Pax Exam Karaf container 3. Test Fork’s process and Pax Exam’s process use the same System.in and System.out for sending and receiving data. It happens in the following method: InternalRunner#createShutdownHook: …….. final Pipe errPipe = new Pipe(process.getErrorStream(), System.err).start("Error pipe"); final Pipe outPipe = new Pipe(process.getInputStream(), System.out).start("Out pipe"); final Pipe inPipe = new Pipe(process.getOutputStream(), System.in).start("In pipe"); ……….. 1. When Test's Fork process ends the execution of test it send message BYE to Maven plugin process 2. Maven plugin process sends BYE_ACK to Test's Fork process 3. Pax Exam Fork process steals some bytes from Test's Fork process’s System.in 4. Test's Fork process doesn't receive all data and throws an exception 5. Test's Fork process calls "kill" command instead of "exit" and shutdown hook won't be called. 6. It follows to an issue with Jacoco. It doesn't fill report because it happens when shutdown hook is called. The discussion about the same issue you can find here: https://issues.jboss.org/browse/ISPN-8261 https://issues.apache.org/jira/browse/SUREFIRE-1374 I understand why you use System.out (for returning data from Karaf process to Test Fork process, e.g. logs). But what is the reason to use System.in in Pax Exam? -- -- ------------------ OPS4J - http://www.ops4j.org - ops4j@googlegroups.com --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.