]> granicus.if.org Git - clang/commitdiff
[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)
authorHubert Tong <hubert.reinterpretcast@gmail.com>
Mon, 10 Jun 2019 22:40:35 +0000 (22:40 +0000)
committerHubert Tong <hubert.reinterpretcast@gmail.com>
Mon, 10 Jun 2019 22:40:35 +0000 (22:40 +0000)
Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `tail`. `%diff_plist` is then, being unused, removed.

The changes were applied via a script.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62951

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362998 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/MismatchedDeallocator-path-notes.cpp
test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
test/Analysis/diagnostics/plist-multi-file.c
test/Analysis/lambda-notes.cpp
test/Analysis/lit.local.cfg
test/Analysis/malloc-plist.c

index 5529d495be860ea3e9f4b5b58176beb49af90868..6138af3399e9f986541431de649dbd8742a62dc0 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=plist %s -o %t.plist
-// RUN: tail -n +11 %t.plist | %diff_plist %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
 
 void changePointee(int *p);
 int *allocIntArray(unsigned c) {
index 26beda5300d1ea90af8917fd2b7b1af4fd0923de..b91e4ad3e2d1b20523f2b33e426cd721d727d7be 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -analyzer-output=plist-multi-file %s -o %t.plist
-// RUN: tail -n +11 %t.plist | %diff_plist %S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u %S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist -
 
 #include "Inputs/include/plist-diagnostics-include-check-macro.h"
 
index f6ff8097ff0945c59737a1cd39d62dd5967cafe9..aa26536f0ac0efe69900ba3cf2757f66b251b2e2 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=plist-multi-file -o %t.plist -verify %s
-// RUN: tail -n +11 %t.plist | %diff_plist %S/Inputs/expected-plists/plist-multi-file.c.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u %S/Inputs/expected-plists/plist-multi-file.c.plist -
 
 #include "plist-multi-file.h"
 
index e436068501cc8fb8f2ab83abff61082c59c8927f..0ae2d3efa280f08101fa0f31a1ad971e00441cb3 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core.DivideZero -analyzer-config inline-lambdas=true -analyzer-output plist -verify %s -o %t
-// RUN: tail -n +11 %t | %diff_plist %S/Inputs/expected-plists/lambda-notes.cpp.plist -
+// RUN: tail -n +11 %t | %normalize_plist | diff -u %S/Inputs/expected-plists/lambda-notes.cpp.plist -
 
 
 // Diagnostic inside a lambda
index 936c2520f6173775af17374a675b16415cad817f..5c94b8b240d4eb4e45c2cac16eb803c37ead635c 100644 (file)
@@ -9,11 +9,6 @@ import analyzer_test
 config.test_format = analyzer_test.AnalyzerTest(
         config.test_format.execute_external, config.use_z3_solver)
 
-# Diff command used by Clang Analyzer tests (when comparing .plist files
-# with reference output)
-config.substitutions.append(('%diff_plist',
-    'diff -u -w -I "<string>/" -I "<string>.:" -I "version"'))
-
 # Filtering command used by Clang Analyzer tests (when comparing .plist files
 # with reference output)
 config.substitutions.append(('%normalize_plist',
index 86a921db083653435be2207eb4d8ce498f1aa8ea..89e496150b3fccaa1c69a2dadd71c37ae9954097 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: rm -f %t
 // RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,unix.Malloc -analyzer-output=plist -verify -o %t -analyzer-config eagerly-assume=false %s
-// RUN: tail -n +11 %t | %diff_plist %S/Inputs/expected-plists/malloc-plist.c.plist -
+// RUN: tail -n +11 %t | %normalize_plist | diff -u %S/Inputs/expected-plists/malloc-plist.c.plist -
 
 typedef __typeof(sizeof(int)) size_t;
 void *malloc(size_t);