1 Star 4 Fork 0

musnows/Linux_Raspberry

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

这个目录下是和lcov代码测试覆盖率检测有关的信息。

依赖

使用之前,请先安装lcov2.0和google gtest

安装lcov2.0

wget https://github.com/linux-test-project/lcov/releases/download/v2.0/lcov-2.0.tar.gz
tar -zxvf lcov-2.0.tar.gz
cd lcov-2.0
sudo make install

系统依赖项

# ubuntu安装依赖项
sudo apt install -y perl libcapture-tiny-perl libdatetime-perl
# centos安装依赖项比较麻烦
sudo apt install -y perl
sudo perl -MCPAN -e 'install "包名"'

对于centos而言,请参考lcov仓库的readme,用perl命令安装缺少的包。

These perl packages include:

  - Capture::Tiny
  - DateTime
  - Devel::Cover
  - Digest::MD5
  - File::Spec
  - at least one flavor of JSON module.
    In order of performance/preference:
       - JSON::XS
       - Cpanel::JSON::XS
       - JSON::PP
       - JSON
 - Memory::Process
 - Module::Load::Conditional
 - Scalar::Util
 - Time::HiRes

If your system is missing any of these, then you may be able to install them
via:

   $ perl -MCPAN -e 'install "packageName"'

你可能连不上perl的moudle源,可以百度修改镜像源的办法,或者直接使用清华源

https://mirrors.tuna.tsinghua.edu.cn/help/CPAN/

goole gtest安装教程

unzip googletest-1.12.x.zip
cd googletest-1.12.x
cmake CMakeLists.txt
make
sudo make install

为了方便,我在本仓库下直接上传了lcov和gtest的安装包,你可以直接使用它们。实测centos8和ubuntu22.04都可以使用,安装命令相同。

使用

直接 make lcov 就行了。会生成一个coverage_report路径,内部有html文档。

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/musnows/raspberry-practice.git
git@gitee.com:musnows/raspberry-practice.git
musnows
raspberry-practice
Linux_Raspberry
master

搜索帮助