mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[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
This commit is contained in:
parent
325c19c5a1
commit
438143157b
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s --check-prefix=ALL
|
RUN: sancov -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s --check-prefix=ALL
|
||||||
RUN: sancov -covered-functions -blacklist %p/Inputs/fun_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -covered-functions -blacklist %p/Inputs/fun_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
RUN: sancov -covered-functions -blacklist %p/Inputs/src_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 %s
|
RUN: sancov -covered-functions -blacklist %p/Inputs/src_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 %s
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
RUN: sancov -covered-functions -strip_path_prefix=Inputs/ %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck --check-prefix=STRIP_PATH %s
|
RUN: sancov -covered-functions -strip_path_prefix=Inputs/ %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck --check-prefix=STRIP_PATH %s
|
||||||
RUN: sancov -demangle=0 -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck --check-prefix=NO_DEMANGLE %s
|
RUN: sancov -demangle=0 -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck --check-prefix=NO_DEMANGLE %s
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov| FileCheck --check-prefix=MERGE1 %s
|
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov| FileCheck --check-prefix=MERGE1 %s
|
||||||
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov %p/Inputs/test-linux_x86_64.1.symcov| FileCheck --check-prefix=MERGE2 %s
|
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov %p/Inputs/test-linux_x86_64.1.symcov| FileCheck --check-prefix=MERGE2 %s
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -skip-dead-files=0 -not-covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -skip-dead-files=0 -not-covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
RUN: sancov -not-covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 --allow-empty %s
|
RUN: sancov -not-covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 --allow-empty %s
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -print %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -print %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
|
|
||||||
CHECK: 0x4e132b
|
CHECK: 0x4e132b
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -print-coverage-stats %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -print-coverage-stats %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
|
|
||||||
CHECK: all-edges: 8
|
CHECK: all-edges: 8
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -symbolize -strip_path_prefix="llvm/" %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -symbolize -strip_path_prefix="llvm/" %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s --check-prefixes=CHECK,STRIP
|
||||||
|
RUN: sancov -symbolize %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s --check-prefixes=CHECK,NOSTRIP
|
||||||
|
|
||||||
CHECK: {
|
CHECK: {
|
||||||
CHECK-NEXT: "covered-points": [
|
CHECK-NEXT: "covered-points": [
|
||||||
@ -11,7 +12,8 @@ CHECK-NEXT: "4e1586"
|
|||||||
CHECK-NEXT: ],
|
CHECK-NEXT: ],
|
||||||
CHECK-NEXT: "binary-hash": "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
|
CHECK-NEXT: "binary-hash": "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
|
||||||
CHECK-NEXT: "point-symbol-info": {
|
CHECK-NEXT: "point-symbol-info": {
|
||||||
CHECK-NEXT: "test/tools/sancov/Inputs/test.cpp": {
|
STRIP-NEXT: "test/tools/sancov/Inputs/test.cpp": {
|
||||||
|
NOSTRIP-NEXT: "/usr/local/google/home/aizatsky/src/llvm/test/tools/sancov/Inputs/test.cpp": {
|
||||||
CHECK-NEXT: "bar(std::string)": {
|
CHECK-NEXT: "bar(std::string)": {
|
||||||
CHECK-NEXT: "4e132b": "12:0"
|
CHECK-NEXT: "4e132b": "12:0"
|
||||||
CHECK-NEXT: },
|
CHECK-NEXT: },
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: sancov -symbolize -skip-dead-files=0 -strip_path_prefix="llvm/" %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -symbolize -skip-dead-files=0 -strip_path_prefix="llvm/" %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
|
|
||||||
CHECK: {
|
CHECK: {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86-registered-target
|
||||||
RUN: not sancov -covered-functions %p/Inputs/test-linux_x86_64 2>&1 | FileCheck --check-prefix=NOCFILE %s
|
RUN: not sancov -covered-functions %p/Inputs/test-linux_x86_64 2>&1 | FileCheck --check-prefix=NOCFILE %s
|
||||||
|
|
||||||
NOCFILE: WARNING: No coverage file for {{.*}}test-linux_x86_64
|
NOCFILE: WARNING: No coverage file for {{.*}}test-linux_x86_64
|
||||||
|
@ -32,6 +32,7 @@ import html
|
|||||||
import os
|
import os
|
||||||
import string
|
import string
|
||||||
import math
|
import math
|
||||||
|
import urllib
|
||||||
|
|
||||||
INDEX_PAGE_TMPL = """
|
INDEX_PAGE_TMPL = """
|
||||||
<html>
|
<html>
|
||||||
@ -128,6 +129,7 @@ class ServerHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
src_path = None
|
src_path = None
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
norm_path = os.path.normpath(urllib.parse.unquote(self.path[1:]))
|
||||||
if self.path == '/':
|
if self.path == '/':
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header("Content-type", "text/html; charset=utf-8")
|
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(
|
response = string.Template(INDEX_PAGE_TMPL).safe_substitute(
|
||||||
filenames='\n'.join(filelist))
|
filenames='\n'.join(filelist))
|
||||||
self.wfile.write(response.encode('UTF-8', 'replace'))
|
self.wfile.write(response.encode('UTF-8', 'replace'))
|
||||||
elif self.symcov_data.has_file(self.path[1:]):
|
elif self.symcov_data.has_file(norm_path):
|
||||||
filename = self.path[1:]
|
filename = norm_path
|
||||||
filepath = os.path.join(self.src_path, filename)
|
filepath = os.path.join(self.src_path, filename)
|
||||||
if not os.path.exists(filepath):
|
if not os.path.exists(filepath):
|
||||||
self.send_response(404)
|
self.send_response(404)
|
||||||
|
@ -469,7 +469,7 @@ static std::unique_ptr<symbolize::LLVMSymbolizer> createSymbolizer() {
|
|||||||
static std::string normalizeFilename(const std::string &FileName) {
|
static std::string normalizeFilename(const std::string &FileName) {
|
||||||
SmallString<256> S(FileName);
|
SmallString<256> S(FileName);
|
||||||
sys::path::remove_dots(S, /* remove_dot_dot */ true);
|
sys::path::remove_dots(S, /* remove_dot_dot */ true);
|
||||||
return stripPathPrefix(S.str().str());
|
return stripPathPrefix(sys::path::convert_to_slash(S.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class Blacklists {
|
class Blacklists {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user