[PATCH] D51018: [sancov] Fixed malformed JSON when symbolizing coverage information

Douglas Gliner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 17:27:24 PDT 2018


dgg5503 created this revision.
dgg5503 added reviewers: aizatsky, kcc.
dgg5503 added a project: Sanitizers.
Herald added a subscriber: llvm-commits.

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:

- Escapes backslashes in JSON string literals.
- Converts all paths to use forward slash.
- Updates `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.

Visualization of path and malformed JSON issues when SanCov is ran on a Windows machine
---------------------------------------------------------------------------------------

**Command:**

  sancov.exe -symbolize llvm\test\tools\sancov\Inputs\test-linux_x86_64 llvm\test\tools\sancov\Inputs\test-linux_x86_64.0.sancov

**Before:**

  {
    "covered-points" : ["4e132b", "4e1472", "4e1520", "4e1553", "4e1586"],
    "binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
    "point-symbol-info" : {
      "/usr\local\google\home\aizatsky\src\llvm\test\tools\sancov\Inputs\test.cpp" : {
        "bar(std::string)" : {
          "4e132b" : "12:0"
        },
        "main" : {
          "4e1472" : "14:0",
          "4e14c2" : "16:9",
          "4e1520" : "17:5",
          "4e1553" : "17:5",
          "4e1586" : "17:5",
          "4e1635" : "19:1",
          "4e1690" : "17:5"
        }
      }
    }
  }

**After (this patch):**

  {
    "covered-points" : ["4e132b", "4e1472", "4e1520", "4e1553", "4e1586"],
    "binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
    "point-symbol-info" : {
      "/usr/local/google/home/aizatsky/src/llvm/test/tools/sancov/Inputs/test.cpp" : {
        "bar(std::string)" : {
          "4e132b" : "12:0"
        },
        "main" : {
          "4e1472" : "14:0",
          "4e14c2" : "16:9",
          "4e1520" : "17:5",
          "4e1553" : "17:5",
          "4e1586" : "17:5",
          "4e1635" : "19:1",
          "4e1690" : "17:5"
        }
      }
    }
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D51018

Files:
  test/tools/sancov/blacklist.test
  test/tools/sancov/covered_functions.test
  test/tools/sancov/merge.test
  test/tools/sancov/not_covered_functions.test
  test/tools/sancov/print.test
  test/tools/sancov/stats.test
  test/tools/sancov/symbolize.test
  test/tools/sancov/symbolize_noskip_dead_files.test
  test/tools/sancov/validation.test
  tools/sancov/coverage-report-server.py
  tools/sancov/sancov.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51018.161586.patch
Type: text/x-patch
Size: 6583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180821/7a2232e9/attachment.bin>


More information about the llvm-commits mailing list