]> source.dussan.org Git - sonarqube.git/commitdiff
Fix computation of JaCoCo coverage of module sonar-process
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 9 Dec 2014 16:55:41 +0000 (17:55 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 9 Dec 2014 16:55:41 +0000 (17:55 +0100)
The shutdown hook of ProcessEntryPoint was manually started by ProcessEntryPointTest but not unregistered from system hooks. It failed when JUnit JVM exited (without crashing build). The side-effect is that JaCoCo fail to export results.

server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java

index 987ee025a58b3a32ff42dea25b26f19fde10850a..9560c3c7f38b7144ed653b88b4372d4b05194cb7 100644 (file)
@@ -133,6 +133,10 @@ public class ProcessEntryPointTest {
 
     // emulate signal to shutdown process
     entryPoint.getShutdownHook().start();
+
+    // hack to prevent JUnit JVM to fail when executing the shutdown hook a second time
+    Runtime.getRuntime().removeShutdownHook(entryPoint.getShutdownHook());
+
     while (process.getState() != State.STOPPED) {
       Thread.sleep(10L);
     }