diff --git a/AGENTS.md b/AGENTS.md index 5a5d25602c..3c0c058243 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,6 +36,11 @@ After you add or change tests for a change to `/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 -- `, where `` +is the text in brackets after the mutant in the `pitestDiff` report, such as `MathMutator#2`, and say so in the PR. +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 with snapshot` CI job fails, read `.github/third-party/README.md`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa1755ce16..a13f3ad24b 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ The build applies [cribro](https://github.com/cribro-dev/cribro) in `settings.gr `./gradlew ::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 -- `. `-Pcribro.diffCoverageEnabled=false` runs `test` without JaCoCo and skips the report. -`./gradlew ::pitestDiff -Pcribro.pitestTargetTests=` 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 ::pitestDiff -Pcribro.pitestTargetTests=` 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 -- `, where `` 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. diff --git a/settings.gradle b/settings.gradle index e4e952cada..7a5a0ae54a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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'