[PATCH] D53729: [llvm-cov] Don't remap existing paths
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 13:47:24 PDT 2018
greened created this revision.
greened added reviewers: seaneveson, vsk, Dor1s.
Herald added a subscriber: llvm-commits.
Ignore path rewrites for files that exist. The avoids testing problems caused by symlinks in the build area. For example:
/path -> /tmp/path
<configure LLVM in /path/to/sources to be built into /path/to/build>
llvm-cov testcase:
// RUN: llvm-cov show %t -instr-profile %t.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck %s
Expands to:
llvm-cov show /tmp/path/to/build/test.cpp.tmp -instr-profile \
/tmp/path/to/build/test.cpp.tmp.profdata \
-path-equivalence=/tmp,/tmp/path/to/sources 2>&1 \
| FileCheck /tmp/path/to/sources/test.cpp
Which results in llvm-cov looking for /tmp/path/to/sources/path/to/sources/test.cpp which doesn't exist.
With this change, /tmp/path/to/sources will not be remapped because /tmp/path/to/sources/test.cpp exists.
In general, this change solves problems with tools that invoke llvm-cov after expanding paths containing symlinks to nested path components.
Repository:
rL LLVM
https://reviews.llvm.org/D53729
Files:
tools/llvm-cov/CodeCoverage.cpp
Index: tools/llvm-cov/CodeCoverage.cpp
===================================================================
--- tools/llvm-cov/CodeCoverage.cpp
+++ tools/llvm-cov/CodeCoverage.cpp
@@ -401,6 +401,12 @@
// Create a mapping from coverage data file paths to local paths.
for (StringRef Filename : Coverage.getUniqueSourceFiles()) {
+ // Don't remap paths that exist.
+ llvm::sys::fs::file_status Status;
+ llvm::sys::fs::status(Filename, Status);
+ if (llvm::sys::fs::exists(Status))
+ continue;
+
SmallString<128> NativeFilename;
sys::path::native(Filename, NativeFilename);
if (NativeFilename.startswith(RemapFrom)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53729.171184.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181025/e4c25e8e/attachment.bin>
More information about the llvm-commits
mailing list