Skip to content

Integrate kover #3141

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

Merged
merged 4 commits into from
Jan 19, 2022
Merged

Integrate kover #3141

merged 4 commits into from
Jan 19, 2022

Conversation

qwwdfsad
Copy link
Member

PTAL.

You can play with it locally, I guess what you will be interested in is :project:koverReport -Pkover.enabled=true.
The link to the report will be in the console output among the last lines.

The overall plan is the following:

  • Merge this PR
  • Rebase all active branches
  • Enable additional TC build step koverVerify -Pkover.enabled=true for Linux builds. JVM-only, separate build step (to avoid unwanted interference with stress and lincheck tests). I will also make HTML reports the part of the build output.
  • File an issue and eventually figure out/fix our inconsistent coverage in other projects.

Alternatively, to simplify local development, we could enable Kover unconditionally and explicitly disable in on TC.
I would prefer such an approach in any project but coroutines where we heavily use/rely on stress tests locally.

@qwwdfsad qwwdfsad requested a review from dkhalanskyjb January 17, 2022 11:48
Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

On Linux, many tests fail for :kotlinx-coroutines-android:test -Pkover.enabled=true. An example:

kotlinx.coroutines.android.HandlerDispatcherTest > testImmediateDispatcherYield FAILED
    java.lang.RuntimeException: java.lang.IllegalAccessException: class org.robolectric.res.ResourceTableFactory cannot access a member of class android.R$styleable with modifiers "private static transient"
        at org.robolectric.res.ResourceTableFactory.addMissingStyleableAttributes(ResourceTableFactory.java:93)
        at org.robolectric.res.ResourceTableFactory.lambda$newFrameworkResourceTable$0(ResourceTableFactory.java:19)
        at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:50)
        at org.robolectric.res.ResourceTableFactory.newFrameworkResourceTable(ResourceTableFactory.java:12)
        at org.robolectric.internal.SdkEnvironment.getSystemResourceTable(SdkEnvironment.java:35)
        at org.robolectric.ApkLoader.getSystemResourceTable(ApkLoader.java:32)
        at org.robolectric.android.internal.ParallelUniverse.injectResourceStuffForLegacy(ParallelUniverse.java:266)
        at org.robolectric.android.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:125)
        at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:377)
        at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:252)
        at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:130)
        at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:42)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:84)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.base/java.lang.Thread.run(Thread.java:834)

        Caused by:
        java.lang.IllegalAccessException: class org.robolectric.res.ResourceTableFactory cannot access a member of class android.R$styleable with modifiers "private static transient"
            at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
            at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
            at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
            at java.base/java.lang.reflect.Field.get(Field.java:416)
            at org.robolectric.res.ResourceTableFactory.addMissingStyleableAttributes(ResourceTableFactory.java:91)
            ... 48 more

kotlinx.coroutines.android.HandlerDispatcherTest > testMainDispatcherToString STANDARD_OUT
    [Robolectric] kotlinx.coroutines.android.HandlerDispatcherTest.testMainDispatcherToString: sdk=28; resources=legacy
    [Robolectric] NOTICE: legacy resources mode is deprecated; see http://robolectric.org/migrating/#migrating-to-40

I didn't check the other subprojects. Will post an update once I do.

@qwwdfsad
Copy link
Member Author

qwwdfsad commented Jan 18, 2022

My bad, reverted the corresponding exclude at the last moment, the fix (Kotlin/kotlinx-kover#95) is actually applied only when the Android plugin is applied. Fixed

@qwwdfsad qwwdfsad requested a review from dkhalanskyjb January 18, 2022 14:55
@qwwdfsad qwwdfsad merged commit 5e5dcd7 into develop Jan 19, 2022
@qwwdfsad qwwdfsad deleted the integrate-kover branch January 19, 2022 10:33
yorickhenning pushed a commit to yorickhenning/kotlinx.coroutines that referenced this pull request Jan 28, 2022
dee-tree pushed a commit to dee-tree/kotlinx.coroutines that referenced this pull request Jul 21, 2022
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this pull request Sep 14, 2022
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

Successfully merging this pull request may close these issues.

2 participants