Jacoco continous dump to dest file

60 views
Skip to first unread message

shubh...@gmail.com

unread,
Aug 29, 2018, 4:17:51 AM8/29/18
to JaCoCo and EclEmma Users
Hey,

I am running Jacoco as a java agent to run my automatic testing on a very huge project which takes more than 1 day to complete and sometimes my main program doesn't shut down properly which results in a .exec file of very less size or even corrupted one.

So, 1 whole day of testing is wasted since I can't use the .exec to generated report.

Is there a way where the .exec is continuously getting dumped, I don't want to use tcpserver/client thing here because everything is on same machine.

Message has been deleted
Message has been deleted

shubh...@gmail.com

unread,
Aug 29, 2018, 6:19:45 AM8/29/18
to JaCoCo and EclEmma Users

Either I can expose my agent via JMX and write a program which calls the Agent.dump(true) every minute or I can have a thread in Agent class which will call dump(true) every minute until shutdown.

Do you think any of these options will serve my requirement?


I ran my application where I manually invoked the dump method many times from JMX while it was executing which resulted in little increase of .exec file. Again I ran the application without any manual dumps, it generated the .exec file of size little lesser than the formal one but there HTML report is almost the same. My application takes 5 minutes to execute completely.

Suppose, my application runs for 2-3 day and its shutdown was not proper or was accidentally killed by something/someone then the .exec file which I'll get will be very small or corrupted but if I take the dump every minute then I will lose the execution data of maximum 1 minute that too in the worst case?

Please correct me if I am wrong?

Thanks,
Shubham

Marc Hoffmann

unread,
Aug 29, 2018, 7:12:16 AM8/29/18
to jac...@googlegroups.com
Hi Shubham,

your statements look reasonable.

The only thing I would add is that you should use a separate file for every dump. Otherwise the entire dump can be corrupted if your JVM exists unexpectedly just in this Moment.

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/abe51704-1a3a-49f7-bb4f-7310d22c7329%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

shubh...@gmail.com

unread,
Aug 29, 2018, 7:23:16 AM8/29/18
to JaCoCo and EclEmma Users

Thanks, Marc for your reply.

I can only use the second file if I take the approach of running a thread inside Agent class where I can have a second variable like destfile_backup and dump it in there.

But if automate via JMX style it will still use the destfile only.

Evgeny Mandrikov

unread,
Aug 29, 2018, 7:27:29 AM8/29/18
to JaCoCo and EclEmma Users


On Wednesday, August 29, 2018 at 1:23:16 PM UTC+2, shubh...@gmail.com wrote:

Thanks, Marc for your reply.

I can only use the second file if I take the approach of running a thread inside Agent class where I can have a second variable like destfile_backup and dump it in there.

But if automate via JMX style it will still use the destfile only.


and so method "getExecutionData" that returns "byte[]" which is exactly content for exec file

shubh...@gmail.com

unread,
Aug 29, 2018, 7:31:07 AM8/29/18
to JaCoCo and EclEmma Users
Thanks a lot, Evgeny Mandrikov..!
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages