Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing with new coverage collection #746

Closed
LaurentTho3 opened this issue Mar 12, 2020 · 0 comments
Closed

Tests failing with new coverage collection #746

LaurentTho3 opened this issue Mar 12, 2020 · 0 comments

Comments

@LaurentTho3
Copy link
Contributor

Hello,

I am trying to run PIT on the apache commons BCEL project (https://github.com/apache/commons-bcel) version 6.4.0 (tag rel/commons-bcel-6.4.0). When using recent versions of PIT (>= 1.4.7) the build fails, saying that 33 tests did not pass when calculating line coverage although the tests pass when ran without PIT. The tests are returning errors similar to this one:

Example of error returned by tests
Description [testClass=org.apache.bcel.verifier.VerifierTestCase, name=testDefaultMethodValidation(org.apache.bcel.verifier.Verifier
TestCase)]
java.lang.NoClassDefFoundError: Could not initialize class org.apache.bcel.generic.Type
at org.apache.bcel.verifier.statics.Pass2Verifier$CPESSC_Visitor.visitMethod(Pass2Verifier.java:636)
        at org.apache.bcel.classfile.Method.accept(Method.java:108)
        at org.apache.bcel.classfile.DescendingVisitor.visitMethod(DescendingVisitor.java:158)
        at org.apache.bcel.classfile.Method.accept(Method.java:108)
        at org.apache.bcel.classfile.DescendingVisitor.visitJavaClass(DescendingVisitor.java:98)
        at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:213)
        at org.apache.bcel.classfile.DescendingVisitor.visit(DescendingVisitor.java:84)
        at org.apache.bcel.verifier.statics.Pass2Verifier$CPESSC_Visitor.<init>(Pass2Verifier.java:360)
        at org.apache.bcel.verifier.statics.Pass2Verifier$CPESSC_Visitor.<init>(Pass2Verifier.java:316)
        at org.apache.bcel.verifier.statics.Pass2Verifier.constant_pool_entries_satisfy_static_constraints(Pass2Verifier.java:301)
        at org.apache.bcel.verifier.statics.Pass2Verifier.do_verify(Pass2Verifier.java:160)
        at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:70)
        at org.apache.bcel.verifier.Verifier.doPass2(Verifier.java:75)
        at org.apache.bcel.verifier.VerifierTestCase.testDefaultMethodValidation(VerifierTestCase.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:176)
        at junit.framework.TestCase.runBare(TestCase.java:141)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:129)
        at junit.framework.TestSuite.runTest(TestSuite.java:252)
        at junit.framework.TestSuite.run(TestSuite.java:247)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
        at org.pitest.junit.adapter.CustomRunnerExecutor.run(CustomRunnerExecutor.java:42)
        at org.pitest.junit.adapter.AdaptedJUnitTestUnit.execute(AdaptedJUnitTestUnit.java:69)
        at org.pitest.coverage.execute.CoverageDecorator.execute(CoverageDecorator.java:49)
        at org.pitest.testapi.execute.containers.UnContainer.execute(UnContainer.java:31)
        at org.pitest.testapi.execute.Pitest.executeTests(Pitest.java:57)
        at org.pitest.testapi.execute.Pitest.run(Pitest.java:48)
        at org.pitest.coverage.execute.CoverageWorker.run(CoverageWorker.java:51)
        at org.pitest.coverage.execute.CoverageMinion.main(CoverageMinion.java:90)

I suspect the error has to do with the new coverage collection because the tests do not fail with PIT 1.4.6.

To reproduce:

git clone https://github.com/apache/commons-bcel
git checkout rel/commons-bcel-6.4.0
mvn clean test-compile org.pitest:pitest-maven:1.4.7:mutationCoverage # fails when computing coverage
mvn clean test-compile org.pitest:pitest-maven:1.4.6:mutationCoverage # coverage computed ok
hcoles pushed a commit that referenced this issue Dec 31, 2020
Failing test to describe general issue behind coverage bugs - child
classes are initialized after their parents, so coverage probe is not
initialized when parent refers to child in a static initializer block.
hcoles pushed a commit that referenced this issue Dec 31, 2020
Failing test to describe general issue behind coverage bugs - child
classes are initialized after their parents, so coverage probe is not
initialized when parent refers to child in a static initializer block.
@hcoles hcoles mentioned this issue Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant