priestjim / gen_rpc

A scalable RPC library for Erlang-VM based languages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude coverage on test scripts files. This will artificially boost up code coverage on main code.

linearregression opened this issue · comments

Code coverage includes test code. These files will boost the overall number up.
Code Coverage should be done on product files only.
Output after runnjng code coverage below shows the list of test code to exclude:
|----------------------------------|------------|
| module | coverage |
|----------------------------------|------------|
| local_functional_SUITE | 98% |
| multi_rpc_functional_SUITE | 87% |
| gen_rpc_test_helper | 79% |
| remote_functional_SUITE | 96%

Unfortunately, for some reason, code coverage includes those files as well. I haven't found a way to exclude them for now.

specify exclude dir/mods in cover-spec?
http://www.erlang.org/doc/apps/common_test/cover_chapter.html
%% Directories to exclude in cover.
{excl_dirs, Dirs}.

  %% Directories, including subdirectories, to exclude.
  {excl_dirs_r, Dirs}.

  %% Specific modules to exclude in 

Yeah, it doesn't care, apparently!

When setting {cover_enabled,true} in rebar.config, it seems rebar3 will perform its own cover compilation/analysis, independent of common_test. The coverspec file given to common_test is not read by rebar3 at all, so files included/excluded there are not honoured by rebar3's cover analysis. I don't know if it is possible to specify which modules rebar3 should cover compile and not, but by default it seems that it takes all beam files found in ebin and test.

If you want common_test to do the cover analysis, then set cover_enabled to false (default) in rebar.config, and only keep the cover option to common_test, pointing out the coverspec file.

The cover result can then be found in the HTML logs from common_test.

Closing as this discussion can be continued in rebar3's issues.