lcov绝对路径与相对路径

乔希·凯利

lcov如何决定何时使用绝对路径还是相对路径?

我有一个app目录,目录包含我产品的每个共享库的子目录和几个二进制文件的子目录。像这样:

/home/user/app/libfoo/bar
/home/user/app/libfoo/baz
/home/user/app/libqux
/home/user/app/testsuite
/home/user/app/product

但是,在通过lcov运行时genhtml,目录如下所示:

/home/user/app/libqux
/home/user/app/testsuite
/home/user/app/product
bar
baz

换句话说,共享库目录之一中的所有内容都使用相对路径,而其他所有内容都使用绝对路径。为什么?

我的lcov和的调用genhtml非常简单:

cd ~/app
testsuite/run_tests
lcov --capture --directory . --output-file coverage.info --gcov-tool gcov-5 --no-external
genhtml coverage.info --output-directory coverage
乔希·凯利

这是genhtml--prefix功能的结果

   -p prefix
   --prefix prefix
          Remove prefix from all directory names.

          Because lists containing long filenames are difficult  to  read,
          there  is a mechanism implemented that will automatically try to
          shorten all directory names on the overview page beginning  with
          a  common  prefix.  By  default, this is done using an algorithm
          that tries to find the prefix which, when applied, will minimize
          the resulting sum of characters of all directory names.

          Use this option to specify the prefix to be removed by yourself.

在我的案例中,/home/user/app/libfoo库层次结构的介入足够多,因此genhtml决定通过剥离该方法来节省更多字符,而不是采用更明显的剥离方法/home/user/app

传递显式--prefix /home/user/app选项可以解决此问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章