Skip to content

Add Jacoco test coverage support to TestKit Gradle daemons #16603

@mateuszkwiecinski

Description

@mateuszkwiecinski

My Gradle test runs increased instability from being just flaky to failing at ~100% rate. The exception is:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:test'.
...
Caused by: java.lang.RuntimeException: Failed to store cache entry for task ':android:test'
...
Caused by: java.lang.RuntimeException: Could not pack tree 'jvmArgumentProviders.jacocoAgent$0.jacoco.destinationFile': java.io.IOException: Request to write '65536' bytes exceeds size in header of '1506326' bytes for entry 'tree-jvmArgumentProviders.jacocoAgent%240.jacoco.destinationFile'
...
Suppressed: java.io.IOException: This archive contains unclosed entries.
...
Caused by: java.io.UncheckedIOException: java.io.IOException: Request to write '65536' bytes exceeds size in header of '1506326' bytes for entry 'tree-jvmArgumentProviders.jacocoAgent%240.jacoco.destinationFile'
...
Caused by: java.io.IOException: Request to write '65536' bytes exceeds size in header of '1506326' bytes for entry 'tree-jvmArgumentProviders.jacocoAgent%240.jacoco.destinationFile'

The build passes if caching is disabled
edit: Actually, after disabling the cache build becomes flaky again and sometimes fails on jacocoTestReport task with

Caused by: : Unable to read execution data file /home/runner/work/project-starter/project-starter/android/build/jacoco/test.exec
at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:518)
at org.jacoco.ant.ReportTask.execute(ReportTask.java:491)
...
Caused by: java.io.EOFException
at org.jacoco.core.internal.data.CompactDataInput.readBooleanArray(CompactDataInput.java:64)
at org.jacoco.core.data.ExecutionDataReader.readExecutionData(ExecutionDataReader.java:150)
...

Expected Behavior

I expect build to complete successfuly

Current Behavior

Build fails with exception pasted above.

Context

I started observing this kind of exceptions in gradle 6.7, and I assumed that's something on my side but didn't have time to investigate. Now, when I'm using most recent Gradle version 6.8.3, I found a bit of time and discovered that disabling Gradle caching the build passes (both locally and on a GA runner)

Steps to Reproduce

set org.gradle.caching=true in gradle.properties, run any test task.

Your Environment

Build scan URL: https://scans.gradle.com/s/nfobgvarfutg2
Failer run with full stacktrace: https://github.com/usefulness/project-starter/pull/159/checks?check_run_id=2160476298

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions