On Thursday, March 7, 2019 at 7:43:41 PM UTC+1, jk wrote:
>
>
> I tried to run with the CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS}" 
> but after which the jacoco.exec file generated is of 0 size.
>

Using examples that come with Tomcat as following:

java -version

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

mkdir /tmp/j
cd /tmp/j

wget 
"http://repo1.maven.org/maven2/org/jacoco/jacoco/0.8.3/jacoco-0.8.3.zip";
aunpack jacoco-0.8.3.zip

wget 
"https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.29/bin/apache-tomcat-8.5.29.tar.gz";
aunpack apache-tomcat-8.5.29.tar.gz

cat <<END >./apache-tomcat-8.5.29/bin/setenv.sh
CATALINA_OPTS="\${CATALINA_OPTS} 
-javaagent:/tmp/j/jacoco-0.8.3/lib/jacocoagent.jar=destfile=/tmp/j/jacoco.exec"
END

./apache-tomcat-8.5.29/bin/catalina.sh start

curl http://localhost:8080/examples/servlets/servlet/HelloWorldExample

./apache-tomcat-8.5.29/bin/catalina.sh stop 60

I just got non zero file:

ls -l jacoco.exec

-rw-r----- 1 evgeny.mandrikov wheel 38463 Mar  7 20:53 jacoco.exec

That includes information about execution of HelloWorldExample :

java -jar jacoco-0.8.3/lib/jacococli.jar execinfo jacoco.exec | grep 
HelloWorldExample

f4baf7db7add6fb6   19 of  19   HelloWorldExample

Among many other class files:

java -jar jacoco-0.8.3/lib/jacococli.jar execinfo jacoco.exec | wc -l

703

And got following report:

java -jar jacoco-0.8.3/lib/jacococli.jar report jacoco.exec --classfiles 
apache-tomcat-8.5.29/webapps/examples/WEB-INF/classes/ --html report


[image: report.png]


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/c01c70a0-b766-45f7-b2d9-77ef85b627a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to