Erlang Common Test coverage specification file - Relative paths

198 views Asked by At

I am using Common Test for code coverage analysis in my erlang project.

File structure

myProject/
    ebin/
    src/
    test/
        myProject.coverspec

The .beam-files for the source code is located in ebin/ and for the tests they are in test/ together with the test sources.

I am currently using absolute paths to the .beam files in the .coverspec-file.

myProject.coverspec:

{level,details}.
{incl_dirs, ["/home/user/myProject/ebin", "/home/user/myProject/test"]}.

This works, but is far from optimal as the project development is distributed.

ct_run is called from the base of the project, myProject, the paths don't seem to be relative to myProject but somewhere else.

I've tried paths relative to both myProject and myProject/test w/o success.

My question is, where are the paths in myProject.coverspec relative to?

1

There are 1 answers

0
mkorszun On

In my last Erlang project where I have used CT and cover my setup looked like this:

  • cover.spec in project root directory:

    {incl_dirs, ["apps/application_manager/ebin", "apps/session_counter/ebin", "apps/session_heartbeat/ebin", "apps/session_api/ebin"]}.
    
  • Tests executed from project root via;

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

Not sure if this solves your problem but it worked for me.