我目前正在切换到 funit 来全面测试我相当大的 Fortran 项目。是否有工具可以让我找出我的项目中哪些行尚未测试?我使用 emacs,是否有一个简单的脚本可以让我轻松查看我的文件的哪些部分尚未测试?
我可以想象为类似的事情招募 -prof 编译器,但我才刚刚开始。所以我绝对不能靠我自己做到这一点。
我目前正在切换到 funit 来全面测试我相当大的 Fortran 项目。是否有工具可以让我找出我的项目中哪些行尚未测试?我使用 emacs,是否有一个简单的脚本可以让我轻松查看我的文件的哪些部分尚未测试?
我可以想象为类似的事情招募 -prof 编译器,但我才刚刚开始。所以我绝对不能靠我自己做到这一点。
Depends on your compiler. I use Intel Fortran on Linux for testing purposes, and its coverage checking options. Compile and link your code with something like
ifort -g -prof-gen=srcpos ...
(Side note: parallel make does not work for me with -prof-gen
option enabled) The compilation will produce some extra files in your sources directory. Run the tests, each program execution will produce a *.dyn
file in you sources directory. After running all the tests execute
profmerge
proforder
codecov
This will produce a nice detailed HTML-formatted coverage report. Don't forget to delete old *.dyn
and pgopti.dpi*
files before running new series of tests, otherwise you will see an intersection of different coverage results.