From cebae8e05e4f6b9c0d5a2db6b36bdb818be3a757 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 19 Aug 2023 19:56:47 +0300 Subject: [PATCH] Introduce mutation test script for changed code While there, optimize the existing `run-mutation-tests.sh` script. --- CONTRIBUTING.md | 2 +- run-branch-mutation-tests.sh | 23 +++++++++++++++++++++++ run-mutation-tests.sh | 4 +--- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 run-branch-mutation-tests.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 558292f502d..eab0c6185e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -80,6 +80,6 @@ Some pointers: [error-prone-support-developing]: https://github.com/PicnicSupermarket/error-prone-support/tree/master#-developing-error-prone-support [error-prone-support-full-build]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/run-full-build.sh [error-prone-support-issues]: https://github.com/PicnicSupermarket/error-prone-support/issues -[error-prone-support-mutation-tests]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/run-mutation-tests.sh +[error-prone-support-mutation-tests]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/run-branch-mutation-tests.sh [error-prone-support-patch]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/apply-error-prone-suggestions.sh [error-prone-support-pulls]: https://github.com/PicnicSupermarket/error-prone-support/pulls diff --git a/run-branch-mutation-tests.sh b/run-branch-mutation-tests.sh new file mode 100755 index 00000000000..d71e83f792e --- /dev/null +++ b/run-branch-mutation-tests.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Executes Pitest to determine the mutation test coverage of changed code. By +# default code that is changed relative to the default branch is exercised, +# though another change set may be specified; see the Arcmutate Git integration +# documentation for details [1]. The results are found in each Maven module's +# `target/pit-reports` directory. +# +# [1] https://docs.arcmutate.com/docs/git-integration.html + +set -e -u -o pipefail + +if [ "${#}" -gt 1 ]; then + echo "Usage: ${0} [DiffSpec]" + exit 1 +fi + +diffSpec="${1:-+GIT(from[refs/remotes/origin/HEAD])}" + +mvn clean test-compile pitest:mutationCoverage \ + -DargLine.xmx=2048m \ + -Dverification.skip \ + -Dfeatures="${diffSpec}" diff --git a/run-mutation-tests.sh b/run-mutation-tests.sh index eb7a095ee61..9da338cf838 100755 --- a/run-mutation-tests.sh +++ b/run-mutation-tests.sh @@ -13,9 +13,7 @@ fi targetTests="${1:-*}" -mvn clean test pitest:mutationCoverage \ +mvn clean test-compile pitest:mutationCoverage \ -DargLine.xmx=2048m \ -Dverification.skip \ - -Dsurefire.failIfNoSpecifiedTests=false \ - -Dtest="${targetTests}" \ -DtargetTests="${targetTests}"