Index: test/tools/sancov/blacklist.test =================================================================== --- test/tools/sancov/blacklist.test +++ test/tools/sancov/blacklist.test @@ -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 -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 Index: test/tools/sancov/covered_functions.test =================================================================== --- test/tools/sancov/covered_functions.test +++ test/tools/sancov/covered_functions.test @@ -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 -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 Index: test/tools/sancov/merge.test =================================================================== --- test/tools/sancov/merge.test +++ test/tools/sancov/merge.test @@ -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 %p/Inputs/test-linux_x86_64.1.symcov| FileCheck --check-prefix=MERGE2 %s Index: test/tools/sancov/not_covered_functions.test =================================================================== --- test/tools/sancov/not_covered_functions.test +++ test/tools/sancov/not_covered_functions.test @@ -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 -not-covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 --allow-empty %s Index: test/tools/sancov/print.test =================================================================== --- test/tools/sancov/print.test +++ test/tools/sancov/print.test @@ -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 CHECK: 0x4e132b Index: test/tools/sancov/stats.test =================================================================== --- test/tools/sancov/stats.test +++ test/tools/sancov/stats.test @@ -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 CHECK: all-edges: 8 Index: test/tools/sancov/symbolize.test =================================================================== --- test/tools/sancov/symbolize.test +++ test/tools/sancov/symbolize.test @@ -1,4 +1,4 @@ -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 CHECK: { Index: test/tools/sancov/symbolize_noskip_dead_files.test =================================================================== --- test/tools/sancov/symbolize_noskip_dead_files.test +++ test/tools/sancov/symbolize_noskip_dead_files.test @@ -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 CHECK: { Index: test/tools/sancov/validation.test =================================================================== --- test/tools/sancov/validation.test +++ test/tools/sancov/validation.test @@ -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 NOCFILE: WARNING: No coverage file for {{.*}}test-linux_x86_64 Index: tools/sancov/coverage-report-server.py =================================================================== --- tools/sancov/coverage-report-server.py +++ tools/sancov/coverage-report-server.py @@ -31,6 +31,7 @@ import os import string import math +import urllib INDEX_PAGE_TMPL = """ @@ -127,6 +128,7 @@ 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") @@ -146,8 +148,8 @@ 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) Index: tools/sancov/sancov.cpp =================================================================== --- tools/sancov/sancov.cpp +++ tools/sancov/sancov.cpp @@ -347,7 +347,8 @@ void indent() { OS.indent(Indent * 2); } static void printJSONStringLiteral(StringRef S, raw_ostream &OS) { - if (S.find('"') == std::string::npos) { + if (S.find('"') == std::string::npos && + S.find('\\') == std::string::npos) { OS << "\"" << S << "\""; return; } @@ -355,6 +356,8 @@ for (char Ch : S.bytes()) { if (Ch == '"') OS << "\\"; + else if (Ch == '\\') + OS << "\\"; OS << Ch; } OS << "\""; @@ -565,7 +568,7 @@ static std::string normalizeFilename(const std::string &FileName) { SmallString<256> S(FileName); 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 {