Emma is not creating the coverage.ec file
-
14-11-2019 - |
Question
Copied the emma.jar to $JAVA_HOME/lib/ext
& instrumented it using the following command.
java -cp emma.jar emma instr -m overwrite -cp @jarlist.txt
jarlist.txt contains the list of jar files deployed by tomcat from the war file. And it got instrumented successfully & created the coverage.em
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 5119 ms
EMMA: [4125 class(es) instrumented, 3142 resource(s) copied]
EMMA: metadata merged into [/root/install/apache-tomcat-7.0.19/webapps/coverage.em] {in 553 ms}
But even after restarting the tomcat multiple times coverage.ec file was not created. What I'm missing here?
Solution 2
When I copied the emma.jar inside the $CATALINA_HOME/webapps/myapplication/WEB-INF/lib & then instrumenting emma resolved this issue.
OTHER TIPS
You can Search the coverage.ec
in tomcat log after stopping the Tomcat service.
it will appear in log in the End of log with the Specified Path.
I followed the below steps:
- Copied the emma.jar into \jre\lib\ext folder
- Created jarlist.txt manually with the list of jar files i want to instrument.
example:
Jar names with the full path:
e:\driven\web\web-inf\lib\abc.jar e:\driven\web\web-inf\lib\xyz.jar
Placed the jarlist.txt in the same folder - jre\lib\ext folder
- Instrumented JARS using the Following command:
c:\Program files\java\jre\lib\ext> java -cp emma.jar emma instr -m overwrite -cp @jarlist.txt
Result: EMMA: processing instrumentation path ... EMMA: instrumentation path processed in 3819 ms EMMA: [1942 class(es) instrumented, 1030 resource(s) copied] EMMA: metadata merged into [\jre\lib\ext\coverage.em] {in 668 ms}
Second time if you try with the same command you will get only the following result:
EMMA: processing instrumentation path ... EMMA: instrumentation path processed in 1875 ms EMMA: [0 class(es) instrumented, 2972 resource(s) copied] EMMA: no output created: metadata is empty
Because jars already instrumented --> 0 classes and no output created.
--> Start your Tomcat and Perform some operations
Tomcat Log you can find like below: EMMA: collecting runtime coverage data ...
If u can find this means you will get coverage.ec file while stopping the Tomcat service.
Stop the Tomcat Service: Final phase of log will show like below:
EMMA: runtime coverage data merged into [\tomcat\bin\coverage.ec] {in 48 ms}
Report Generation:
c:\jre\lib\ext>java -cp emma.jar emma report -r html -in coverage.em,......\tomcat\bin\coverage.ec
EMMA: processing input files ... EMMA: 2 file(s) read and merged in 582 ms EMMA: writing [html] report to [c:\jre\lib\ext\coverage\index.html] ...
You can Open and view the Index.html to see the Report.