<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm-cov does not handle path separator correctly on Windows"
href="https://bugs.llvm.org/show_bug.cgi?id=51663">51663</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-cov does not handle path separator correctly on Windows
</td>
</tr>
<tr>
<th>Product</th>
<td>Runtime Libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>libprofile library
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>efanzh@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Specifically, the `SOURCE` argument for `llvm-cov show` does not work well on
Windows.
If I specify a directory in `SOURCES`, llvm-cov will find all files in that
directory, and use them to filter coverage data. The problem is that llvm-cov
compares the paths as if they were strings. On Windows, both “/” and “\” can be
used as path separator, and `C:\xyz` and `C:/xyz` should be treated as the same
path on Windows. Failing to do this may lead to incorrect report.
To reproduce, run this PowerShell script in an empty directory on Windows:
--------------------------------------------------------------------------------
echo "int main() {}" > main.cpp
$cwd = $(pwd).ToString()
$cwd = $cwd.Replace("\", "/") # Comment this line to see the exprectd result.
clang++ -fprofile-instr-generate -fcoverage-mapping "$cwd/main.cpp" -o main.exe
$env:LLVM_PROFILE_FILE="main.profraw"
.\main.exe
llvm-profdata merge -o main.profdata main.profraw
llvm-cov show --format html --instr-profile main.profdata main.exe . >
main.html
--------------------------------------------------------------------------------
I got an empty HTML report on my PC from running this script. You can also try
to comment `$cwd = $cwd.Replace("\", "/")` to get a correct report.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>