diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/IncrementalAnalyser.java b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/IncrementalAnalyser.java index 872c29a7e..02a129b70 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/IncrementalAnalyser.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/IncrementalAnalyser.java @@ -30,10 +30,16 @@ public class IncrementalAnalyser implements MutationAnalyser { private final CoverageDatabase coverage; private final Map preAnalysed = new EnumMap<>(DetectionStatus.class); - public IncrementalAnalyser(final CodeHistory history, - final CoverageDatabase coverage) { + private final boolean enableLog; + + public IncrementalAnalyser(CodeHistory history, CoverageDatabase coverage) { + this(history, coverage, true); + } + + public IncrementalAnalyser(CodeHistory history, CoverageDatabase coverage, boolean enableLog) { this.history = history; this.coverage = coverage; + this.enableLog = enableLog; } @Override @@ -52,7 +58,9 @@ public Collection analyse( } } - logTotals(); + if (enableLog) { + logTotals(); + } return mrs; diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/tooling/MutationCoverage.java b/pitest-entry/src/main/java/org/pitest/mutationtest/tooling/MutationCoverage.java index 3818414f7..b66a5b8ec 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/tooling/MutationCoverage.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/tooling/MutationCoverage.java @@ -376,8 +376,9 @@ private List buildMutationTests(CoverageDatabase coverageD final MutationSource source = new MutationSource(mutationConfig, testPrioritiser, bas, interceptor); - final MutationAnalyser analyser = new IncrementalAnalyser( - new DefaultCodeHistory(this.code, history), coverageData); + final MutationAnalyser analyser = new IncrementalAnalyser(new DefaultCodeHistory(this.code, history), + coverageData, + enableIncrementalAnalysisLogging(history)); final WorkerFactory wf = new WorkerFactory(this.baseDir, coverage() .getConfiguration(), mutationConfig, args, @@ -394,6 +395,13 @@ private List buildMutationTests(CoverageDatabase coverageD return builder.createMutationTestUnits(this.code.getCodeUnderTestNames()); } + private boolean enableIncrementalAnalysisLogging(HistoryStore history) { + // Horrible hack to prevent logging during pre scan phase. This would + // cause confusion as if only part of the log is read it appears that + // incremental analysis has affected no mutants + return !(history instanceof NullHistoryStore); + } + private void checkMutationsFound(final List tus) { if (tus.isEmpty()) { if (this.data.shouldFailWhenNoMutations()) {