8

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

つまり、私の共有ライブラリ ディレクトリの 1 つに含まれるすべてのものは相対パスを使用し、それ以外のものはすべて絶対パスを使用します。 なんで?

lcovandの呼び出し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
4

1 に答える 1

6

これは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たため、より明白な方法である stripping ではなく、それを削除することでより多くの文字を節約できると判断しました/home/user/app

明示的なオプションを渡すと、--prefix /home/user/appこれが修正されます。

于 2015-09-24T21:50:58.113 に答える