Skip to content

Commit

Permalink
Issue #11528: Split pitest coding into 3 to improve execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyom-Yadav authored and nrmancuso committed Jun 11, 2022
1 parent b8f4470 commit 8c7e41a
Show file tree
Hide file tree
Showing 3 changed files with 278 additions and 27 deletions.
50 changes: 30 additions & 20 deletions .ci/pitest.sh
Expand Up @@ -155,22 +155,42 @@ pitest-javadoc)
checkPitestReport ignoredItems
;;

pitest-coding)
pitest-coding-1)
mvn --no-transfer-progress -e -P"$1" clean test-compile org.pitest:pitest-maven:mutationCoverage;
declare -a ignoredItems=(
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> || parent.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) {</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> else if (type != TokenTypes.ASSIGN</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (firstChild != null &#38;&#38; firstChild.getType() == TokenTypes.LPAREN) {</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (type != TokenTypes.ASSIGN</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (type == TokenTypes.LAMBDA &#38;&#38; isLambdaSingleParameterSurrounded(ast)) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentAst.getType() != TokenTypes.RCURLY) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentNode.getType() == TokenTypes.LITERAL_CATCH) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentStatementAst.getType() != TokenTypes.RCURLY) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> else if (isChild(currentNode, variable)) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (currentNode.getType() == TokenTypes.LITERAL_IF) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (curNode.getType() == ast.getType() &#38;&#38; curNode.getText().equals(ast.getText())) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (currentNodeType == TokenTypes.SLIST) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (!firstUsageFound) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (!isVarInOperatorDeclaration &#38;&#38; operator.getType() == TokenTypes.LITERAL_IF) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> while (result</span></pre></td></tr>"
);
checkPitestReport ignoredItems
;;

pitest-coding-2)
mvn --no-transfer-progress -e -P"$1" clean test-compile org.pitest:pitest-maven:mutationCoverage;
declare -a ignoredItems=(
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; isSameVariables(storedVariable, variable)</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> == ast.getParent()) {</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> if (ast.getParent().getType() == TokenTypes.SWITCH_RULE</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> if (astIterator.getType() == childType</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> if (storedVariable != null &#38;&#38; isSameVariables(storedVariable, ast)) {</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> result = findLastChildWhichContainsSpecifiedToken(</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> return ast.getType() == TokenTypes.LITERAL_IF</span></pre></td></tr>"
"FinalLocalVariableCheck.java.html:<td class='covered'><pre><span class='survived'> return loop1 != null &#38;&#38; loop1 == loop2;</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; ast.getType() == TokenTypes.PARAMETER_DEF) {</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; firstChild.getType() == TokenTypes.IDENT) {</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; methodAST.getType() == TokenTypes.METHOD_DEF</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> if (method.getType() == TokenTypes.METHOD_DEF) {</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> return instanceFields.contains(field)</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> if (ignoreSetter &#38;&#38; ast.getType() == TokenTypes.PARAMETER_DEF) {</span></pre></td></tr>"
"HiddenFieldCheck.java.html:<td class='covered'><pre><span class='survived'> if (type == TokenTypes.CLASS_DEF</span></pre></td></tr>"
"IllegalInstantiationCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; illegal.startsWith(JAVA_LANG)) {</span></pre></td></tr>"
Expand All @@ -179,33 +199,23 @@ pitest-coding)
"OneStatementPerLineCheck.java.html:<td class='covered'><pre><span class='survived'> if (countOfSemiInLambda.isEmpty()) {</span></pre></td></tr>"
"OneStatementPerLineCheck.java.html:<td class='covered'><pre><span class='survived'> multiline = !TokenUtil.areOnSameLine(prevSibling, ast)</span></pre></td></tr>"
"OneStatementPerLineCheck.java.html:<td class='covered'><pre><span class='survived'> if (!hasResourcesPrevSibling &#38;&#38; isMultilineStatement(currentStatement)) {</span></pre></td></tr>"
);
checkPitestReport ignoredItems
;;

pitest-coding-require-this-check)
mvn --no-transfer-progress -e -P"$1" clean test-compile org.pitest:pitest-maven:mutationCoverage;
declare -a ignoredItems=(
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; ast.getParent().getType() != TokenTypes.LITERAL_CATCH) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (isAnonymousClassDef(ast)) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (toVisit == null) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; parent.getType() != TokenTypes.CTOR_DEF</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; lastChild.getType() == TokenTypes.OBJBLOCK;</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (definitionToken.getType() == TokenTypes.STATIC_INIT) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (elistToken != null &#38;&#38; ident.getText().equals(ast.getText())) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (lookForMethod &#38;&#38; containsMethod(nameToFind)</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (variableDeclarationFrame.getType() == FrameType.CLASS_FRAME) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (fieldUsageFrame.getType() == FrameType.BLOCK_FRAME) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> if (sibling != null &#38;&#38; isAssignToken(parent.getType())) {</span></pre></td></tr>"
"RequireThisCheck.java.html:<td class='covered'><pre><span class='survived'> return left.getType() == right.getType() &#38;&#38; left.getText().equals(right.getText());</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> || parent.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) {</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> else if (type != TokenTypes.ASSIGN</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (firstChild != null &#38;&#38; firstChild.getType() == TokenTypes.LPAREN) {</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (type != TokenTypes.ASSIGN</span></pre></td></tr>"
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> if (type == TokenTypes.LAMBDA &#38;&#38; isLambdaSingleParameterSurrounded(ast)) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentAst.getType() != TokenTypes.RCURLY) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentNode.getType() == TokenTypes.LITERAL_CATCH) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; currentStatementAst.getType() != TokenTypes.RCURLY) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> else if (isChild(currentNode, variable)) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (currentNode.getType() == TokenTypes.LITERAL_IF) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (curNode.getType() == ast.getType() &#38;&#38; curNode.getText().equals(ast.getText())) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (currentNodeType == TokenTypes.SLIST) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (!firstUsageFound) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> if (!isVarInOperatorDeclaration &#38;&#38; operator.getType() == TokenTypes.LITERAL_IF) {</span></pre></td></tr>"
"VariableDeclarationUsageDistanceCheck.java.html:<td class='covered'><pre><span class='survived'> while (result</span></pre></td></tr>"
);
checkPitestReport ignoredItems
;;
Expand Down
58 changes: 54 additions & 4 deletions .github/workflows/pitest.yml
Expand Up @@ -107,7 +107,7 @@ jobs:
path: staging
retention-days: 7

pitest-coding:
pitest-coding-1:
runs-on: ubuntu-latest
steps:
- name: Setup local maven cache
Expand All @@ -117,9 +117,9 @@ jobs:
key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }}
- name: Checkout
uses: actions/checkout@v2
- name: pitest-Coding
- name: pitest-Coding-1
run: |
./.ci/pitest.sh pitest-coding
./.ci/pitest.sh pitest-coding-1
- name: Stage results
if: failure() || github.ref == 'refs/heads/master'
run: |
Expand All @@ -128,7 +128,57 @@ jobs:
if: failure() || github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
name: pitest-coding-coverage-report
name: pitest-coding-1-coverage-report
path: staging
retention-days: 7

pitest-coding-2:
runs-on: ubuntu-latest
steps:
- name: Setup local maven cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }}
- name: Checkout
uses: actions/checkout@v2
- name: pitest-Coding-2
run: |
./.ci/pitest.sh pitest-coding-2
- name: Stage results
if: failure() || github.ref == 'refs/heads/master'
run: |
mkdir staging && cp -r target/pit-reports/ staging
- name: Archive code coverage results
if: failure() || github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
name: pitest-coding-2-coverage-report
path: staging
retention-days: 7

pitest-coding-require-this-check:
runs-on: ubuntu-latest
steps:
- name: Setup local maven cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }}
- name: Checkout
uses: actions/checkout@v2
- name: pitest-Coding-require-this-check
run: |
./.ci/pitest.sh pitest-coding-require-this-check
- name: Stage results
if: failure() || github.ref == 'refs/heads/master'
run: |
mkdir staging && cp -r target/pit-reports/ staging
- name: Archive code coverage results
if: failure() || github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
name: pitest-coding-require-this-check-coverage-report
path: staging
retention-days: 7

Expand Down

0 comments on commit 8c7e41a

Please sign in to comment.