erlangcovercommon-test

How to configure cover for a node with multliple applications


I have 4 applications within a node, all tested with Common Test.

My cover specification:

{level, details}.
{incl_dirs, ["apps/app1/ebin", "apps/app2/ebin", "apps/app3/ebin", "apps/app4/ebin"]}.

Test command:

ct_run -pa apps/*/ebin -pa deps/*/ebin -dir apps/*/test/ -logdir tests -cover cover.spec

The problem is that cover report (html) for each application contains all modules from other apps as well, which obviously have 0% coverage. Is there a way to configure it to exclude modules which do not belong to given app?


Solution

  • Looking at the cover configuration documentation, it doesn't seem like you can exclude by application. However, you can use the {excl_dirs_r, Dirs}. option to exclude a directory if the dependencies are contained in a single tree. Alternatively, you can use {incl_mods, Mods}. to only cover the modules you are interested in. I've used this second approach, and it works for me. You can write a script to collect the names of all the modules in your own applications.