Can I force Perl Devel::Cover to generate a coverage report if I killed the build testcover process before it was finished?

淺唱寂寞╮ 提交于 2019-12-10 17:27:15

问题


If I am able to start up Devel::Cover successfully and it starts to collect data in the cover_db directory, can I then kill the process and then after the fact get Devel::Cover or some other utility to process those binary Devel::Cover run files and structure files into the HTML coverage report?

To ask the question another way ... Can I use Devel::Cover to get a coverage report for a process that I am unable to stop, other than by killing the process?

This question is related to: How do I get code coverage of Perl CGI script when executed by Selenium?


回答1:


The way I usually handle this (say, for running tests on servers) is:

  • Generate a __DIE__ handler for the Perl process. This ensures that the process completes normally and Devel::Cover finishes the DB population

  • Send SIGINT to the process to trigger the new DIE handler.

  • run cover program on the cover_db directory after the process is dead.



来源:https://stackoverflow.com/questions/2926017/can-i-force-perl-develcover-to-generate-a-coverage-report-if-i-killed-the-buil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!