summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2019-06-10 22:33:34 +0000
committerHubert Tong <hubert.reinterpretcast@gmail.com>2019-06-10 22:33:34 +0000
commitc867b9221716da3b48555b30839a680da0e1414e (patch)
treee4fb7e18fd6140591402fae3bef0cf47c4d4e202 /clang/test
parent1d322ccaacf3e20c119ffb074f2306375ef0ec80 (diff)
downloadbcm5719-llvm-c867b9221716da3b48555b30839a680da0e1414e.tar.gz
bcm5719-llvm-c867b9221716da3b48555b30839a680da0e1414e.zip
[analyzer][tests] Add normalize_plist to replace diff_plist
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 to the specific case shown in the list message. Mechanical changes to the other affected files will follow in later patches. Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty Reviewed By: NoQ 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/D62949 llvm-svn: 362994
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/lit.local.cfg8
-rw-r--r--clang/test/Analysis/unix-fns.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Analysis/lit.local.cfg b/clang/test/Analysis/lit.local.cfg
index 84f7569152c..936c2520f61 100644
--- a/clang/test/Analysis/lit.local.cfg
+++ b/clang/test/Analysis/lit.local.cfg
@@ -14,6 +14,14 @@ config.test_format = analyzer_test.AnalyzerTest(
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',
+ "grep -Ev '%s|%s|%s'" %
+ ('^[[:space:]]*<string>.* version .*</string>$',
+ '^[[:space:]]*<string>/.*</string>$',
+ '^[[:space:]]*<string>.:.*</string>$')))
+
# Diff command for testing SARIF output to reference output.
config.substitutions.append(('%diff_sarif',
'''diff -U1 -w -I ".*file:.*%basename_t" -I '"version":' -I "2\.0\.0\-csd\.[0-9]*\.beta\."'''))
diff --git a/clang/test/Analysis/unix-fns.c b/clang/test/Analysis/unix-fns.c
index 96e5d1d4453..2f59dc6458d 100644
--- a/clang/test/Analysis/unix-fns.c
+++ b/clang/test/Analysis/unix-fns.c
@@ -1,5 +1,5 @@
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,unix.API,osx.API,optin.portability %s -analyzer-store=region -analyzer-output=plist -analyzer-config faux-bodies=true -fblocks -verify -o %t.plist
-// RUN: cat %t.plist | %diff_plist %S/Inputs/expected-plists/unix-fns.c.plist -
+// RUN: %normalize_plist <%t.plist | diff -u %S/Inputs/expected-plists/unix-fns.c.plist -
// RUN: mkdir -p %t.dir
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.API,osx.API,optin.portability -analyzer-output=html -analyzer-config faux-bodies=true -fblocks -o %t.dir %s
// RUN: rm -fR %t.dir
OpenPOWER on IntegriCloud