[PATCH] D62952: [analyzer][tests] Use normalize_sarif in place of diff_sarif

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 08:51:23 PDT 2019


hubert.reinterpretcast added a comment.

In D62952#1548377 <https://reviews.llvm.org/D62952#1548377>, @aaron.ballman wrote:

> In general, that seems reasonable, but I would prefer to take care of more of the work in lit.local.cfg than have to deal with that atrocious RUN line in every test case. Is there a way to retain a similarly succinct solution as diff_sarif?


There'd be no atrocious RUN line if we went with modifying the expected files beforehand and having the tool output a newline.

The unchanged:

  // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | %diff_sarif %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -

becomes:

  // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -

As in, `%diff_sarif` gets replaced with `%normalize_sarif | diff -U1 -b` and that's it.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62952/new/

https://reviews.llvm.org/D62952





More information about the cfe-commits mailing list