why is my outdir from my kcov command always empty?

203 views Asked by At

so, i need to integrate kcov in my gitlab-ci to see code coverage on a test executable executable. the documentation from kcov states that i need to run "kcov /path/to/outdir ./myexec" to generate a report in an html file. however, even if the command succedes, /path/to/outdir is still empty and i dont know why since the tests pass and kcov returns no errors

here is the .gitlab-ci.yml:

 stage: coverage
 dependencies:
  - Build
 script:
 - mkdir build/test/kcov
 - cd build/test
 - kcov --include-path=../../src /kcov ./abuse-test
 - cd kcov
 - ls
 artifacts:
  paths:
    - TP3/build
    - TP3/src

my test exec is abuse-test, it is generated via cmake->make and is in a folder called TP3->build->test->abuse-test

the output of the console in the ci is the following:

  on igl601-runner3 5d2b3c01
Using Docker executor with image depot.dinf.usherbrooke.ca:4567/e19-igl601/eq09/image_tp3 ...
Pulling docker image depot.dinf.usherbrooke.ca:4567/e19-igl601/eq09/image_tp3 ...
Using docker image sha256:c2cf0a7c10687670c7b28ee23ac06899de88ebb0d86e142bfbf65171147fc167 for depot.dinf.usherbrooke.ca:4567/e19-igl601/eq09/image_tp3 ...
Running on runner-5d2b3c01-project-223-concurrent-0 via dinf-prj-16...
Fetching changes...
Removing TP3/build/
HEAD is now at b2e1277 Update .gitlab-ci.yml
From https://depot.dinf.usherbrooke.ca/e19-igl601/eq09
   b2e1277..7cf0af5  master     -> origin/master
Checking out 7cf0af56 as master...
Skipping Git submodules setup
Downloading artifacts for Build (8552)...
Downloading artifacts from coordinator... ok        id=8552 responseStatus=200 OK token=Pagxjp_C
$ cd TP3
$ mkdir build/test/kcov
$ cd build/test
$ kcov --include-path=../../src /kcov ./abuse-test
===============================================================================
All tests passed (3 assertions in 3 test cases)

$ cd kcov
$ ls
Uploading artifacts...
TP3/build: found 2839 matching files               
TP3/src: found 211 matching files                  
Uploading artifacts to coordinator... ok            id=8554 responseStatus=201 Created token=PxDHHjxf
Job succeeded

the kcov documentation states: "/path/to/outdir will contain lcov-style HTML output generated continuously while the application run"

and yet, when i browse the artefacts, i find nothing

1

There are 1 answers

0
Stefan van Gastel On BEST ANSWER

Hi it looks like you're specifying /kcov as the outdir:

kcov --include-path=../../src /kcov ./abuse-test

Since you're working on a *nix based system, the / implies an absolute path from the root of your filesystem.

The cd kcov step assumes a relative path (down from your current directory) since it is missing the /.

So I guess changing your kcov command to:

kcov --include-path=../../src kcov ./abuse-test

Would fix your issue.