小编I_l*_*_93的帖子

如何从lcov代码覆盖率报告中删除某些目录?

我使用lcov和shell脚本并不是太强大,所以这对我来说是一个学习过程.我理解编写代码覆盖率报告的基础知识,但我不知道排除某些目录的代码行.在shell可执行文件中,我编写了以下代码:

    #!/bin/sh
    ROOT_DIR=$1
    DEST_DIR=$2
    TARGET_DIR=$3
    TARGET=$4

   #init lcov
   lcov -c -i -d $TARGET_DIR/.. -o $TARGET_DIR/cov_init.info

    #run unit test executable
    "$DEST_DIR/$TARGET"

     #capture coverage after running executable
     lcov -c -d $TARGET_DIR/.. -o $TARGET_DIR/cov_test.info

     #I added this in-generate delta of coverage
     lcov -a $TARGET_DIR/cov_init.info -a $TARGET_DIR/cov_test.info -o $TARGET_DIR/cov.info

  # I added this in- Excludes some third party code
                    lcov --remove $TARGET_DIR/cov.info '/opt/*' '/usr/*' '$ROOT_DIR/Common?ExternalLibraries/*'

  #I added this in-generate report
            genhtml $TARGET_DIR/cov.info --ignore-errors source --output-directory $DEST_DIR/CoverageReport/$TARGET
            xdg-open $DEST_DIR/CoverageReport/$TARGET/index.html &
Run Code Online (Sandbox Code Playgroud)

我很确定在运行可执行文件后捕获coverage之前我需要排除目录.

bash shell lcov

8
推荐指数
1
解决办法
9513
查看次数

为什么我的函数参数c ++中需要一个vector类型

嘿伙计们,当我编译我的代码时,我得到了一些我不理解的错误.其中一个错误告诉我vector不是一个类型,但是我把它定义为一个float类型,显示为const vector<float>& vector另一个错误告诉我我不能转换为int但是我没有在程序中看到我声明了输入变量或向量的int.这是我的错误和代码:

prog.cpp:5:58: error: 'vector' is not a type
 static void AutoCorrelation(const vector<float>& vector, vector<float>& autoCorrelationOut, float& autoCorrelationFactorOut);
                                                          ^
prog.cpp:5:64: error: expected ',' or '...' before '<' token
 static void AutoCorrelation(const vector<float>& vector, vector<float>& autoCorrelationOut, float& autoCorrelationFactorOut);
                                                                ^
prog.cpp: In function 'int main()':
prog.cpp:16:38: error: cannot convert 'std::vector<float>' to 'int' for argument '2' to 'void AutoCorrelation(const std::vector<float>&, int)'
  AutoCorrelation(vec1,vec2,factor_out);
                                      ^
prog.cpp: At global scope:
prog.cpp:20:51: error: 'vector' is not a type
 void AutoCorrelation(const vector<float>& vector, vector<float>& autoCorrelationOut, …
Run Code Online (Sandbox Code Playgroud)

c++ vector

-2
推荐指数
1
解决办法
99
查看次数

标签 统计

bash ×1

c++ ×1

lcov ×1

shell ×1

vector ×1