docker - 为什么我的 kcov 命令的 outdir 总是空的?
问题描述
所以,我需要将 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
我的测试执行程序是滥用测试,它是通过 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
会解决你的问题。
推荐阅读
- python - 接收时间过长如何关闭会话?
- php - 匹配带有 1 个或多个尾随子字符串的字符串
- javascript - 在 Google Sheets Apps Script 中,如何检查工作表是否存在以及是否不添加工作表
- iis - IIS备份物理路径
- asp.net-mvc - 我们应该如何在 MVC 中创建登录页面?
- java - 类型不匹配:无法从 List 转换
列出 - java - 如何使用 android 在 Firebase 数据库中获取子值?
- vb.net - 在 IDE 中的对话框 (msgbox()) 命令处暂停代码
- python - 使用 django 和 rest framweork 的错误 url
- c# - 我需要使用 CreateObject() 从 VB6 COM 自动化重新启动 .NET WPF 应用程序