【问题标题】:lcov absolute versus relative pathslcov 绝对路径与相对路径
【发布时间】:2015-09-24 13:29:18
【问题描述】:

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

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

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

但是,当运行lcovgenhtml 时,目录是这样列出的:

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

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

我对@9​​87654326@ 和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

【问题讨论】:

    标签: relative-path lcov


    【解决方案1】:

    这是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 选项可以解决此问题。

    【讨论】:

      猜你喜欢
      • 2012-01-11
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 1970-01-01
      • 2010-09-15
      • 2013-04-17
      相关资源
      最近更新 更多