Ducaz035
Ducaz035

Reputation: 3132

PITEST incremental analysis cannot find local hash file

I'm currently trying PITest and so far it works properly. However, it is quite slow and the only solution so far is to use incremental analysis which potentially will solve the slowness. I've tried to set it as it's described in the documentation. Here is my configuration:

 <build>
<plugins>
  <plugin>
    <executions>
      <execution>
        <id>pitest-mutation-coverage</id>
        <goals>
          <goal>mutationCoverage</goal>
        </goals>
      </execution>
    </executions>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.4.6</version>
    <configuration>
      <threads>8</threads>
      <timestampedReports>false</timestampedReports>
      <historyInputFile>${project.basedir}/pitest.history</historyInputFile>
      <historyOutputFile>${project.basedir}/pitest.history</historyOutputFile>
      <avoidCallsTo>
        <avoidCallsTo>java.util.logging</avoidCallsTo>
        <avoidCallsTo>org.slf4j</avoidCallsTo>
      </avoidCallsTo>
      <mutators>
        <mutator>DEFAULTS</mutator>
      </mutators>
    </configuration>
  </plugin>
</plugins>

However, in practise I don't see PITest taking historyInput and historyOutput into account and instead in the logs I'm seeing

[INFO] Will read and write history at /var/folders/x1/qp5hhks571q0drb7kd7vjn0c0000gn/T/my.module.groupId.artifactId.version_pitest_history.bin

I've tried plenty of different settings and none of them seem to work. Is there anything I'm missing?

Update

In the end, it turns out that the plugin definition was coming from the parent-pom and overriding it is partially possible in the inheriting child-pom.

Upvotes: 1

Views: 866

Answers (1)

henry
henry

Reputation: 6106

There config you have posted works correctly.

You would only see the message

[INFO] Will read and write history at /var/folders/x1/qp5hhks571q0drb7kd7vjn0c0000gn/T/my.module.groupId.artifactId.version_pitest_history.bin

If you had also set withHistoryto true.

There looks to be a bug which stops things working if both are set. This needs to be fixed, but setting both doesn't really make sense.

withHistory is a convenience flag that sets both the in and outfile to point at a location in the temp dir.

The in/out file parameters are for when more fine grained control is needed (e.g the input file is being shared across a team).

So either set witHistory or set the history files explicitly, don't do both.

Upvotes: 1

Related Questions