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

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/668ee318-dcc6-42dc-b0bb-ca045b91d42dn%40googlegroups.com.

Reply via email to