[PATCH] D62950: [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

2019-06-10 Thread Hubert Tong via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362996: [analyzer][tests] Use normalize_plist in place of 
diff_plist (`cat` cases) (authored by hubert.reinterpretcast, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62950

Files:
  cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
  cfe/trunk/test/Analysis/conditional-path-notes.c
  cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
  cfe/trunk/test/Analysis/copypaste/plist-diagnostics.cpp
  cfe/trunk/test/Analysis/cxx-for-range.cpp
  cfe/trunk/test/Analysis/diagnostics/deref-track-symbolic-region.c
  cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp
  cfe/trunk/test/Analysis/diagnostics/undef-value-caller.c
  cfe/trunk/test/Analysis/diagnostics/undef-value-param.c
  cfe/trunk/test/Analysis/diagnostics/undef-value-param.m
  cfe/trunk/test/Analysis/edges-new.mm
  cfe/trunk/test/Analysis/generics.m
  cfe/trunk/test/Analysis/inline-plist.c
  cfe/trunk/test/Analysis/inline-unique-reports.c
  cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.c
  cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.cpp
  cfe/trunk/test/Analysis/inlining/path-notes.c
  cfe/trunk/test/Analysis/inlining/path-notes.cpp
  cfe/trunk/test/Analysis/inlining/path-notes.m
  cfe/trunk/test/Analysis/method-call-path-notes.cpp
  cfe/trunk/test/Analysis/model-file.cpp
  cfe/trunk/test/Analysis/null-deref-path-notes.m
  cfe/trunk/test/Analysis/nullability-notes.m
  cfe/trunk/test/Analysis/objc-arc.m
  cfe/trunk/test/Analysis/objc-radar17039661.m
  cfe/trunk/test/Analysis/plist-macros-with-expansion.cpp
  cfe/trunk/test/Analysis/plist-macros.cpp
  cfe/trunk/test/Analysis/plist-output-alternate.m
  cfe/trunk/test/Analysis/plist-output.m
  cfe/trunk/test/Analysis/retain-release-path-notes.m
  cfe/trunk/test/Analysis/retain-release.m

Index: cfe/trunk/test/Analysis/retain-release-path-notes.m
===
--- cfe/trunk/test/Analysis/retain-release-path-notes.m
+++ cfe/trunk/test/Analysis/retain-release-path-notes.m
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=plist-multi-file %s -o %t
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/retain-release-path-notes.m.plist -
+// RUN: %normalize_plist <%t | diff -u %S/Inputs/expected-plists/retain-release-path-notes.m.plist -
 
 /***
 This file is for testing the path-sensitive notes for retain/release errors.
Index: cfe/trunk/test/Analysis/null-deref-path-notes.m
===
--- cfe/trunk/test/Analysis/null-deref-path-notes.m
+++ cfe/trunk/test/Analysis/null-deref-path-notes.m
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region -analyzer-output=text -fblocks -verify -Wno-objc-root-class %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region -analyzer-output=plist-multi-file -fblocks -Wno-objc-root-class %s -o %t
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/null-deref-path-notes.m.plist -
+// RUN: %normalize_plist <%t | diff -u %S/Inputs/expected-plists/null-deref-path-notes.m.plist -
 
 @interface Root {
 @public
Index: cfe/trunk/test/Analysis/conditional-path-notes.c
===
--- cfe/trunk/test/Analysis/conditional-path-notes.c
+++ cfe/trunk/test/Analysis/conditional-path-notes.c
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=text -verify
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -o %t
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/conditional-path-notes.c.plist -
+// RUN: %normalize_plist <%t | diff -u %S/Inputs/expected-plists/conditional-path-notes.c.plist -
 
 void testCondOp(int *p) {
   int *x = p ? p : p;
Index: cfe/trunk/test/Analysis/plist-output.m
===
--- cfe/trunk/test/Analysis/plist-output.m
+++ cfe/trunk/test/Analysis/plist-output.m
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-config eagerly-assume=false %s -analyzer-checker=osx.cocoa.RetainCount,deadcode.DeadStores,core -analyzer-output=plist -o %t.plist
-// RUN: cat %t.plist | %diff_plist %S/Inputs/expected-plists/plist-output.m.plist -

[PATCH] D62950: [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

2019-06-08 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast updated this revision to Diff 203707.
hubert.reinterpretcast added a comment.

Update based on review comments, building from rL362877 
 and D63041 


Repository:
  rC Clang

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

https://reviews.llvm.org/D62950

Files:
  test/Analysis/NewDelete-path-notes.cpp
  test/Analysis/conditional-path-notes.c
  test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
  test/Analysis/copypaste/plist-diagnostics.cpp
  test/Analysis/cxx-for-range.cpp
  test/Analysis/diagnostics/deref-track-symbolic-region.c
  test/Analysis/diagnostics/report-issues-within-main-file.cpp
  test/Analysis/diagnostics/undef-value-caller.c
  test/Analysis/diagnostics/undef-value-param.c
  test/Analysis/diagnostics/undef-value-param.m
  test/Analysis/edges-new.mm
  test/Analysis/generics.m
  test/Analysis/inline-plist.c
  test/Analysis/inline-unique-reports.c
  test/Analysis/inlining/eager-reclamation-path-notes.c
  test/Analysis/inlining/eager-reclamation-path-notes.cpp
  test/Analysis/inlining/path-notes.c
  test/Analysis/inlining/path-notes.cpp
  test/Analysis/inlining/path-notes.m
  test/Analysis/method-call-path-notes.cpp
  test/Analysis/model-file.cpp
  test/Analysis/null-deref-path-notes.m
  test/Analysis/nullability-notes.m
  test/Analysis/objc-arc.m
  test/Analysis/objc-radar17039661.m
  test/Analysis/plist-macros-with-expansion.cpp
  test/Analysis/plist-macros.cpp
  test/Analysis/plist-output-alternate.m
  test/Analysis/plist-output.m
  test/Analysis/retain-release-path-notes.m
  test/Analysis/retain-release.m

Index: test/Analysis/retain-release.m
===
--- test/Analysis/retain-release.m
+++ test/Analysis/retain-release.m
@@ -17,8 +17,8 @@
 // RUN: -Wno-objc-root-class -x objective-c++ -std=gnu++98\
 // RUN: -analyzer-config osx.cocoa.RetainCount:TrackNSCFStartParam=true\
 // RUN: -DTRACK_START_PARAM
-// RUN: cat %t.objcpp.plist | %diff_plist %S/Inputs/expected-plists/retain-release.m.objcpp.plist -
-// RUN: cat %t.objc.plist | %diff_plist %S/Inputs/expected-plists/retain-release.m.objc.plist -
+// RUN: %normalize_plist <%t.objcpp.plist | diff -u %S/Inputs/expected-plists/retain-release.m.objcpp.plist -
+// RUN: %normalize_plist <%t.objc.plist | diff -u %S/Inputs/expected-plists/retain-release.m.objc.plist -
 
 void clang_analyzer_eval(int);
 
Index: test/Analysis/retain-release-path-notes.m
===
--- test/Analysis/retain-release-path-notes.m
+++ test/Analysis/retain-release-path-notes.m
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=plist-multi-file %s -o %t
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/retain-release-path-notes.m.plist -
+// RUN: %normalize_plist <%t | diff -u %S/Inputs/expected-plists/retain-release-path-notes.m.plist -
 
 /***
 This file is for testing the path-sensitive notes for retain/release errors.
Index: test/Analysis/plist-output.m
===
--- test/Analysis/plist-output.m
+++ test/Analysis/plist-output.m
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-config eagerly-assume=false %s -analyzer-checker=osx.cocoa.RetainCount,deadcode.DeadStores,core -analyzer-output=plist -o %t.plist
-// RUN: cat %t.plist | %diff_plist %S/Inputs/expected-plists/plist-output.m.plist -
+// RUN: %normalize_plist <%t.plist | diff -u %S/Inputs/expected-plists/plist-output.m.plist -
 
 void test_null_init(void) {
   int *p = 0;
Index: test/Analysis/plist-output-alternate.m
===
--- test/Analysis/plist-output-alternate.m
+++ test/Analysis/plist-output-alternate.m
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core -fblocks -analyzer-output=plist -o %t %s
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/plist-output-alternate.m.plist -
+// RUN: %normalize_plist <%t | diff -u %S/Inputs/expected-plists/plist-output-alternate.m.plist -
 
 void test_null_init(void) {
   int *p = 0;
Index: test/Analysis/plist-macros.cpp
===
--- test/Analysis/plist-macros.cpp
+++ test/Analysis/plist-macros.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -verify %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -analyzer-output=plist-multi-file %s -o %t.plist
-// RUN: cat %t.plist | %diff_plist 

[PATCH] D62950: [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

2019-06-06 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: NoQ, sfertile, xingxue, jasonliu, 
daltenty.
Herald added subscribers: jsji, Charusso, dkrupp, donat.nagy, Szelethus, 
mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
hubert.reinterpretcast added a parent revision: D62949: [analyzer][tests] Add 
normalize_plist to replace diff_plist.

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 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 `cat`.

The changes were applied via a script, except that 
`clang/test/Analysis/NewDelete-path-notes.cpp` and 
`clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted for 
the line-continuation on the relevant `RUN` step.

Note that `grep` expects text files (ending with a newline) as input. The 
`echo` command is used to generate a newline for the test output files, which 
do not have such newlines.


Repository:
  rC Clang

https://reviews.llvm.org/D62950

Files:
  test/Analysis/NewDelete-path-notes.cpp
  test/Analysis/conditional-path-notes.c
  test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
  test/Analysis/copypaste/plist-diagnostics.cpp
  test/Analysis/cxx-for-range.cpp
  test/Analysis/diagnostics/deref-track-symbolic-region.c
  test/Analysis/diagnostics/report-issues-within-main-file.cpp
  test/Analysis/diagnostics/undef-value-caller.c
  test/Analysis/diagnostics/undef-value-param.c
  test/Analysis/diagnostics/undef-value-param.m
  test/Analysis/edges-new.mm
  test/Analysis/generics.m
  test/Analysis/inline-plist.c
  test/Analysis/inline-unique-reports.c
  test/Analysis/inlining/eager-reclamation-path-notes.c
  test/Analysis/inlining/eager-reclamation-path-notes.cpp
  test/Analysis/inlining/path-notes.c
  test/Analysis/inlining/path-notes.cpp
  test/Analysis/inlining/path-notes.m
  test/Analysis/method-call-path-notes.cpp
  test/Analysis/model-file.cpp
  test/Analysis/null-deref-path-notes.m
  test/Analysis/nullability-notes.m
  test/Analysis/objc-arc.m
  test/Analysis/objc-radar17039661.m
  test/Analysis/plist-macros-with-expansion.cpp
  test/Analysis/plist-macros.cpp
  test/Analysis/plist-output-alternate.m
  test/Analysis/plist-output.m
  test/Analysis/retain-release-path-notes.m
  test/Analysis/retain-release.m

Index: test/Analysis/retain-release.m
===
--- test/Analysis/retain-release.m
+++ test/Analysis/retain-release.m
@@ -17,8 +17,8 @@
 // RUN: -Wno-objc-root-class -x objective-c++ -std=gnu++98\
 // RUN: -analyzer-config osx.cocoa.RetainCount:TrackNSCFStartParam=true\
 // RUN: -DTRACK_START_PARAM
-// RUN: cat %t.objcpp.plist | %diff_plist %S/Inputs/expected-plists/retain-release.m.objcpp.plist -
-// RUN: cat %t.objc.plist | %diff_plist %S/Inputs/expected-plists/retain-release.m.objc.plist -
+// RUN: %normalize_plist <%S/Inputs/expected-plists/retain-release.m.objcpp.plist >%t.objcpp.expected.sed.plist && echo >>%t.objcpp.plist && %normalize_plist <%t.objcpp.plist | diff -u %t.objcpp.expected.sed.plist -
+// RUN: %normalize_plist <%S/Inputs/expected-plists/retain-release.m.objc.plist >%t.objc.expected.sed.plist && echo >>%t.objc.plist && %normalize_plist <%t.objc.plist | diff -u %t.objc.expected.sed.plist -
 
 void clang_analyzer_eval(int);
 
Index: test/Analysis/retain-release-path-notes.m
===
--- test/Analysis/retain-release-path-notes.m
+++ test/Analysis/retain-release-path-notes.m
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=plist-multi-file %s -o %t
-// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/retain-release-path-notes.m.plist -
+// RUN: %normalize_plist <%S/Inputs/expected-plists/retain-release-path-notes.m.plist >%t.expected.sed && echo >>%t && %normalize_plist <%t | diff -u %t.expected.sed -
 
 /***
 This file is for testing the path-sensitive notes for retain/release errors.
Index: test/Analysis/plist-output.m
===
--- test/Analysis/plist-output.m
+++ test/Analysis/plist-output.m
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-config eagerly-assume=false %s