r362998 - [analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 15:40:35 PDT 2019


Author: hubert.reinterpretcast
Date: Mon Jun 10 15:40:35 2019
New Revision: 362998

URL: http://llvm.org/viewvc/llvm-project?rev=362998&view=rev
Log:
[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

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

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

Modified: cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp Mon Jun 10 15:40:35 2019
@@ -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) {

Modified: cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp (original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp Mon Jun 10 15:40:35 2019
@@ -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"
 

Modified: cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c (original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c Mon Jun 10 15:40:35 2019
@@ -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"
 

Modified: cfe/trunk/test/Analysis/lambda-notes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambda-notes.cpp?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/lambda-notes.cpp (original)
+++ cfe/trunk/test/Analysis/lambda-notes.cpp Mon Jun 10 15:40:35 2019
@@ -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

Modified: cfe/trunk/test/Analysis/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lit.local.cfg?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/lit.local.cfg (original)
+++ cfe/trunk/test/Analysis/lit.local.cfg Mon Jun 10 15:40:35 2019
@@ -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',

Modified: cfe/trunk/test/Analysis/malloc-plist.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc-plist.c?rev=362998&r1=362997&r2=362998&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc-plist.c (original)
+++ cfe/trunk/test/Analysis/malloc-plist.c Mon Jun 10 15:40:35 2019
@@ -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);




More information about the cfe-commits mailing list