Jacoco shows 0% code coverage on RHEL 8.7 (Ootpa)

69 views
Skip to first unread message

Monisha G

unread,
Apr 19, 2023, 6:13:01 AM4/19/23
to JaCoCo and EclEmma Users
Basically , when jacoco report is generated on a server with RHEL  7.7 (Maipo) , the jacoco report shows accurate coverage . When this same code is compiled and executed on a server with RHEL 8.7 , the code coverage report shows 0% .

The report also shows "No execution data available" instead of displaying the class ID's.

1. We've verified that the same java (java8) and jacoco( org.jacoco.agent-0.8.2.jar & org.jacoco.cli-0.8.4-nodeps.jar) version is being used on both the servers. Basically , the same version and file system exists on both servers.

2.  Setting arguments for Jacoco :

JAVA_OPTS="-javaagent:/prd/im/bin/IMGUI/CodeCoverage/org.jacoco.agent-0.8.2.jar=destfile=/prd/im/bin/IMGUI/CodeCoverage/IMGUI_Code_Coverage/gui.exec,append=true,includes=*.class -Djacoco.dump.on.exit=true -Djacoco.debug=true -Djacoco.classDumpDir=/prd/im/bin/IMGUI/CodeCoverage/Testdump/

3. In order to ensure graceful JVM shutdown , "kill -15" was used in the application stop script .

Any inputs/help from the Team will be appreciated. Thanks!


Marc Hoffmann

unread,
Apr 19, 2023, 6:20:41 AM4/19/23
to JaCoCo and EclEmma Users
Hi,

please check the “Session” page on the top right corner of the reports.

Are your classes under test listed? If not, for whatever reason execution data has not been properly collected or dumped.

Regards,
-marc 

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/88e1b9ed-3f49-4dce-98d3-b7a674a51548n%40googlegroups.com.

Monisha G

unread,
Apr 19, 2023, 6:29:59 AM4/19/23
to JaCoCo and EclEmma Users
Hi Marc,

Thanks , the session page indeed does not list the Class ID's when the report is generated on RHEL 8 . I can see the class ID's on RHEL 7. Even though all the java , jacoco versions being used are the same on both the servers . Even the class dump directory for jacoco ( classDumpDir) remains empty after execution , when it ideally has to contain information regarding the classes.

Thanks,
Monisha

Marc Hoffmann

unread,
Apr 19, 2023, 6:42:41 AM4/19/23
to jac...@googlegroups.com
The JaCoCo agent creates an empty *.exec file at startup to verify the target location.

If the directory is completely empty this means that the agent is not configured at all or has a wrong configuration.

If you look at your java processes with ps you should see the actual command line.

Regards,
-marc

Monisha G

unread,
Apr 19, 2023, 6:53:17 AM4/19/23
to JaCoCo and EclEmma Users
Hi Marc,

The *.exec file generated in not completely empty , the size varies from 86 , 127 to 256 bytes on RHEL8 server . As opposed to the *.exec file generated on RHEL7 server which is approximately 8 MB. And I've analysed the *.exec file through Eclipse using EclEmma plugin , the class ID's seem to be missing on RHEL8.

The issue here being the *.exec file and it's size which amounts to 86 bytes most of the time. This has been the main issue as we're unable to figure out why the *.exec file size is so low and no class ID's have been listed in them

" ps -ef " command indeed shows the jacoco agent being configured alongwith JVM .

Thanks,
Monisha

Evgeny Mandrikov

unread,
Apr 20, 2023, 5:06:44 AM4/20/23
to JaCoCo and EclEmma Users
Hi,

On Wednesday, April 19, 2023 at 12:13:01 PM UTC+2 monis...@gmail.com wrote:
Basically , when jacoco report is generated on a server with RHEL  7.7 (Maipo) , the jacoco report shows accurate coverage . When this same code is compiled and executed on a server with RHEL 8.7 , the code coverage report shows 0% .

The report also shows "No execution data available" instead of displaying the class ID's.

1. We've verified that the same java (java8) and jacoco( org.jacoco.agent-0.8.2.jar & org.jacoco.cli-0.8.4-nodeps.jar) version is being used on both the servers. Basically , the same version and file system exists on both servers.

2.  Setting arguments for Jacoco :

JAVA_OPTS="-javaagent:/prd/im/bin/IMGUI/CodeCoverage/org.jacoco.agent-0.8.2.jar=destfile=/prd/im/bin/IMGUI/CodeCoverage/IMGUI_Code_Coverage/gui.exec,append=true,includes=*.class -Djacoco.dump.on.exit=true -Djacoco.debug=true -Djacoco.classDumpDir=/prd/im/bin/IMGUI/CodeCoverage/Testdump/

The parameter "includes" of JaCoCo agent is not about names of files, but about names of classes, i.e.
for the following Example.java

class Example {
    public static void main(String[] args) {
        System.out.println("Hello");
    }
}


execution of

javac Example.java
java "-javaagent:jacocoagent.jar=includes=*.class" -cp . Example

will produce jacoco.exec of small size without information about any classes and

java -jar jacococli.jar execinfo jacoco.exec

will show this

[INFO] Loading exec file jacoco.exec.
CLASS ID         HITS/PROBES   CLASS NAME
Session "Godins-M1-MacBook-Pro-a4a92418": Thu Apr 20 09:55:19 CEST 2023 - Thu Apr 20 09:55:19 CEST 2023


and in this case generated report shows "No execution data available".

Quoting documentation of agent https://www.jacoco.org/jacoco/trunk/doc/agent.html about "includes" parameter 

> Except for performance optimization or technical corner cases this option is normally not required.

The default is to include all classes, so execution of

java "-javaagent:jacocoagent.jar" -cp . Example
java -jar jacococli.jar execinfo jacoco.exec

produces

[INFO] Loading exec file jacoco.exec.
CLASS ID         HITS/PROBES   CLASS NAME
Session "Godins-M1-MacBook-Pro-1cf6c872": Thu Apr 20 10:59:40 CEST 2023 - Thu Apr 20 10:59:40 CEST 2023
d37513b16b860f3e    1 of   2   Example


From the above, quite doubtful that you have exact same settings or that you're receiving the expected results on RHEL 7.

Also could be noted that I have no idea why you have

-Djacoco.dump.on.exit=true -Djacoco.debug=true -Djacoco.classDumpDir=/prd/im/bin/IMGUI/CodeCoverage/Testdump/

JaCoCo agent doesn't use them and has never used them.


Regards,
Evgeny

Monisha G

unread,
Apr 20, 2023, 6:08:18 AM4/20/23
to JaCoCo and EclEmma Users
Hi Evgeny,

Thanks a lot for your suggestion ! After removing "includes=*.class" , we are able to generate the report .

Thanks,
Monisha

Ashish Ranjan Sinha

unread,
Jun 1, 2024, 2:37:18 AMJun 1
to JaCoCo and EclEmma Users
Hi Monisha G,

What was then used for includes option ?

Regards,
Ashish
Reply all
Reply to author
Forward
0 new messages