因此,我需要将kcov集成到我的gitlab-ci中,以查看测试可执行文件上的代码覆盖率。来自kcov的文档指出,我需要运行"kcov /path/ to /outdir./myexec“来生成html文件格式的报告。但是,即使命令成功,/path/to/outdir仍然是空的,我不知道为什么,因为测试通过了,kcov没有返回错误
下面是.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我的测试exec是abuse- test,它是通过cmake->make生成的,位于名为TP3->build->test->abuse-test的文件夹中
ci中控制台的输出如下所示:
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 succeededkcov文档声明:"/path/to/outdir将包含在应用程序运行时连续生成的lcov样式的HTML输出“。
然而,当我浏览这些文物时,我什么也没找到
发布于 2019-07-11 17:49:36
您好,看起来您指定了/kcov作为输出目录:
kcov --include-path=../../src /kcov ./abuse-test由于您使用的是基于*nix的系统,因此/表示从文件系统的根开始的绝对路径。
cd kcov步骤假定有一个相对路径(从当前目录向下),因为它缺少/。
因此,我想将kcov命令更改为:
kcov --include-path=../../src kcov ./abuse-test就能解决你的问题。
https://stackoverflow.com/questions/56962013
复制相似问题