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

Test coverage for the Quest module not generated correctly. #3055

Open
ndegwamartin opened this issue Feb 12, 2024 · 4 comments
Open

Test coverage for the Quest module not generated correctly. #3055

ndegwamartin opened this issue Feb 12, 2024 · 4 comments
Labels
Bug Report Something isn't working as expected

Comments

@ndegwamartin
Copy link
Contributor

Describe the Issue
The command used on main branch fails on this branch with the following error

Command:

./gradlew -PlocalPropertiesFile=local.properties :quest:clean && ./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebugAndroidTest --stacktrace && /Users/runner/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/androidTest/opensrp/debug/quest-opensrp-debug-androidTest.apk && ./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebug --stacktrace && /Users/runner/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/opensrp/debug/quest-opensrp-debug.apk && /Users/runner/Library/Android/sdk/platform-tools/adb shell am instrument -w -e package org.smartregister.fhircore.quest.ui.profile -e coverage "true" org.smartregister.opensrp.test/org.smartregister.fhircore.quest.QuestTestRunner && /Users/runner/Library/Android/sdk/platform-tools/adb shell run-as org.smartregister.opensrp cat "/data/user/0/org.smartregister.opensrp/files/coverage.ec" > quest/coverage.ec && ./gradlew -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --stacktrace

Error

Error: Failed to generate Emma/JaCoCo coverage. Is Emma/JaCoCo jar on classpath?
Generated code coverage data to /data/user/0/org.smartregister.opensrp/files/coverage.ec
cat: /data/user/0/org.smartregister.opensrp/files/coverage.ec: No such file or directory
Error: The process '/bin/sh' failed with exit code 1

Enabling test coverage in the build file using the following debug configs results in the error logged here

android {
    ...
    buildTypes {
      debug {
		  enableAndroidTestCoverage = true
		  enableUnitTestCoverage = true
     }
        ...
    }
}

The specific error that emerged after this upgrade is

Caused by: java.io.IOException: Error while instrumenting org/hl7/fhir/r5/formats/JsonParser.class with JaCoCo 0.8.11.202310140853/f33756c.
	at org.jacoco.core.instr.Instrumenter.instrumentError(Instrumenter.java:161)
	at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:111)
	at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:136)
	... 123 more
Caused by: org.objectweb.asm.ClassTooLargeException: Class too large: org/hl7/fhir/r5/formats/JsonParser
	at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:622)
	at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:92)
	at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:109)
@ndegwamartin ndegwamartin added the Bug Report Something isn't working as expected label Feb 12, 2024
@ndegwamartin
Copy link
Contributor Author

The related PR that introduced the issue is Upgrade sdk libraries to latest versions #2825

@ndegwamartin
Copy link
Contributor Author

This issue is reported on HAPI FHIR repo as well : hapifhir/hapi-fhir#5210

@ndegwamartin
Copy link
Contributor Author

Attaching the full stacktrace - jacoco_full_stacktrace.txt

@FikriMilano
Copy link
Collaborator

Cc-ing myself @FikriMilano

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants