summaryrefslogtreecommitdiffstats
path: root/llvm/tools/sancov/coverage-report-server.py
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-10-12 02:29:26 +0000
committerVitaly Buka <vitalybuka@google.com>2019-10-12 02:29:26 +0000
commit23aa2aec78181fa064191b8f3c1c5b3ffa1c9424 (patch)
tree8f42b9d63b682fff0835cfd3bde006dc5f4613d3 /llvm/tools/sancov/coverage-report-server.py
parente8a462a01923676860ee4d7b0d191043ea4b9f63 (diff)
downloadbcm5719-llvm-23aa2aec78181fa064191b8f3c1c5b3ffa1c9424.tar.gz
bcm5719-llvm-23aa2aec78181fa064191b8f3c1c5b3ffa1c9424.zip
[sancov] Accommodate sancov and coverage report server for use under Windows
Summary: This patch makes the following changes to SanCov and its complementary Python script in order to resolve issues pertaining to non-UNIX file paths in JSON symbolization information: * Convert all paths to use forward slash. * Update `coverage-report-server.py` to correctly handle paths to sources which contain spaces. * Remove Linux platform restriction for all SanCov unit tests. All SanCov tests passed when ran on my local Windows machine. Patch by Douglas Gliner. Reviewers: kcc, filcab, phosek, morehouse, vitalybuka, metzman Reviewed By: vitalybuka Subscribers: vsk, Dor1s, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D51018 llvm-svn: 374629
Diffstat (limited to 'llvm/tools/sancov/coverage-report-server.py')
-rwxr-xr-xllvm/tools/sancov/coverage-report-server.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/tools/sancov/coverage-report-server.py b/llvm/tools/sancov/coverage-report-server.py
index 251d8f1b77b..5ea978fae64 100755
--- a/llvm/tools/sancov/coverage-report-server.py
+++ b/llvm/tools/sancov/coverage-report-server.py
@@ -32,6 +32,7 @@ import html
import os
import string
import math
+import urllib
INDEX_PAGE_TMPL = """
<html>
@@ -128,6 +129,7 @@ class ServerHandler(http.server.BaseHTTPRequestHandler):
src_path = None
def do_GET(self):
+ norm_path = os.path.normpath(urllib.parse.unquote(self.path[1:]))
if self.path == '/':
self.send_response(200)
self.send_header("Content-type", "text/html; charset=utf-8")
@@ -147,8 +149,8 @@ class ServerHandler(http.server.BaseHTTPRequestHandler):
response = string.Template(INDEX_PAGE_TMPL).safe_substitute(
filenames='\n'.join(filelist))
self.wfile.write(response.encode('UTF-8', 'replace'))
- elif self.symcov_data.has_file(self.path[1:]):
- filename = self.path[1:]
+ elif self.symcov_data.has_file(norm_path):
+ filename = norm_path
filepath = os.path.join(self.src_path, filename)
if not os.path.exists(filepath):
self.send_response(404)
OpenPOWER on IntegriCloud