[PATCH] D68733: Use -fdebug-compilation-dir to form absolute paths in coverage mappings

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 10:26:42 PDT 2019


vsk added a comment.

In D68733#1723734 <https://reviews.llvm.org/D68733#1723734>, @liaoyuke wrote:

> In D68733#1702609 <https://reviews.llvm.org/D68733#1702609>, @vsk wrote:
>
> > Thanks, lgtm!
> >
> > In PR43614 I mentioned adding an extra argument to llvm-cov to specify the base directory. On second thought, the existing `-path-equivalence` option should make that unnecessary.
>
>
> I just tested out this CL, and I don't think it's working correctly (even with -path-equivalence flag)
>
> The command I used is:
>  /usr/local/google/home/liaoyuke/chromium/src/third_party/llvm-build/Release+Asserts/bin/llvm-cov show -format=html -output-dir=/usr/local/google/home/liaoyuke/chromium/src/out/output_test_path -instr-profile=/usr/local/google/home/liaoyuke/chromium/src/out/output_test_path/linux/coverage.profdata -path-equivalence=../..,/usr/local/google/home/liaoyuke/chromium/src out/coverage/base_unittests


Hi @liaoyuke, thanks for trying this out.

> And the generated html files are as following: https://imgur.com/gallery/dlgQXhy
>  Specifically, there are a few problems:
> 
> 1. The index.html files still show relative paths, but I'm expecting an absolute path given that I passed in the -path-equivalence flag.

I have a question about the option you passed: `-path-equivalence=../..,<local-path>`. If I read this patch correctly, the final coverage mapping will contain (what looks like) absolute paths which are just rooted at the debug compilation dir. So, why remap `../..` instead of `<debug-compilation-dir>`?

> 2. The file level line-by-line view's styling is completely off, there is no table and no highlights.

Interesting. Have you confirmed that the issue does not reproduce without -fdebug-compilation-dir/-path-equivalence?

> 3. I also tried the "llvm-cov export" command, it seems that it doesn't respect the -path-equivalence flag at all, and the produced json still uses relative paths in them. (I'm guessing the root cause is the same as 1)

Hm, actually this could be a bug in llvm-cov. Reading through the source, it looks like the path remapping is done before the exporter is created, but perhaps I've missed something.

> Am I using the -path-equivalence flag correctly? And any other suggestions to work this around?




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68733/new/

https://reviews.llvm.org/D68733





More information about the cfe-commits mailing list