为什么我的 kcov 命令的 outdir 总是空的?
why is my outdir from my kcov command always empty?
所以,我需要将 kcov 集成到我的 gitlab-ci 中以查看测试可执行文件的代码覆盖率。 kcov 的文档指出我需要 运行 "kcov /path/to/outdir ./myexec" 在 html 文件中生成报告。然而,即使命令成功,/path/to/outdir 仍然是空的,我不知道为什么因为测试通过并且 kcov returns 没有错误
这里是.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
我的测试执行程序是滥用测试,它是通过 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 succeeded
kcov 文档指出:“/path/to/outdir 将包含应用程序 运行 时连续生成的 lcov 样式 HTML 输出”
然而,当我浏览人工制品时,我什么也没找到
您好,您似乎将 /kcov
指定为 outdir:
kcov --include-path=../../src /kcov ./abuse-test
由于您在基于 *nix 的系统上工作,/
表示从文件系统根目录开始的绝对路径。
cd kcov
步骤采用相对路径(从当前目录向下),因为它缺少 /
。
所以我想将您的 kcov
命令更改为:
kcov --include-path=../../src kcov ./abuse-test
会解决您的问题。
所以,我需要将 kcov 集成到我的 gitlab-ci 中以查看测试可执行文件的代码覆盖率。 kcov 的文档指出我需要 运行 "kcov /path/to/outdir ./myexec" 在 html 文件中生成报告。然而,即使命令成功,/path/to/outdir 仍然是空的,我不知道为什么因为测试通过并且 kcov returns 没有错误
这里是.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
我的测试执行程序是滥用测试,它是通过 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 succeeded
kcov 文档指出:“/path/to/outdir 将包含应用程序 运行 时连续生成的 lcov 样式 HTML 输出”
然而,当我浏览人工制品时,我什么也没找到
您好,您似乎将 /kcov
指定为 outdir:
kcov --include-path=../../src /kcov ./abuse-test
由于您在基于 *nix 的系统上工作,/
表示从文件系统根目录开始的绝对路径。
cd kcov
步骤采用相对路径(从当前目录向下),因为它缺少 /
。
所以我想将您的 kcov
命令更改为:
kcov --include-path=../../src kcov ./abuse-test
会解决您的问题。