Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ After you add or change tests for a change to `<module>/src/main`, run
part of `test`. PIT runs only the tests of the module whose code it mutates, so for a change to `nullaway/src/main`
name test classes under `nullaway/src/test`.

If no caller can observe a live mutant, mark it on its line with `// mutant: equivalent <id> -- <reason>`, where `<id>`
is the text in brackets after the mutant in the `pitestDiff` report, such as `MathMutator#2`, and say so in the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pitest deterministic across machines / runs, so ids like MathMutator#2 always refer to the same mutant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. It is like "mutator name", and "sequential index of the mutator in the specific line".

A line marked `// diff-coverage: ignore` needs no such marker: `pitestDiff` lists its live mutants apart. Run
`./gradlew -q cribro` before your first measurement in a task: it explains both reports and the marker syntax.

# Third-party projects in CI

When a `Build <project> with snapshot` CI job fails, read `.github/third-party/README.md`.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The build applies [cribro](https://github.com/cribro-dev/cribro) in `settings.gr

`./gradlew :<module>:test` prints which of the lines your branch changed the run did not execute, and which changed branches it took only one way. The report covers only the tests the run executed, so run the module's whole suite before you read an uncovered line as a missing test. For a stacked pull request, set `-Pcribro.diffBase` to the parent branch or commit so that only the current layer counts. To acknowledge a line you decided not to test, end it with `// diff-coverage: ignore -- <reason>`. `-Pcribro.diffCoverageEnabled=false` runs `test` without JaCoCo and skips the report.

`./gradlew :<module>:pitestDiff -Pcribro.pitestTargetTests=<test classes>` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail.
`./gradlew :<module>:pitestDiff -Pcribro.pitestTargetTests=<test classes>` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail. If no caller can observe a surviving mutant, mark it on its line with `// mutant: equivalent <id> -- <reason>`, where `<id>` is the text in brackets after the mutant in the report, such as `MathMutator#2`. A line marked `// diff-coverage: ignore` needs no such marker: the report lists its surviving mutants apart.

`-PenableJacoco=true` also instruments the `Test` tasks other than `test`, such as `testJdk*`, for `./gradlew codeCoverageReport`; the report gets data from `test` only while diff coverage is on. On CI, the Linux job sets it and the macOS and Windows jobs set `-Pcribro.diffCoverageEnabled=false`, so their tests run without JaCoCo.

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
// to automatically pull in relevant JDK toolchains when not present on the local machine
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
// diff coverage after `test` and the pitestDiff task in every Java project; see AGENTS.md
id("io.github.cribro-dev.cribro") version "1.2.0"
id("io.github.cribro-dev.cribro") version "1.4.0"
}

include ':annotations'
Expand Down
Loading