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.
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 to the specific case shown in the list message. Mechanical changes to the other affected files will follow in later patches. 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/D62949 Files: test/Analysis/lit.local.cfg test/Analysis/unix-fns.c Index: test/Analysis/unix-fns.c =================================================================== --- test/Analysis/unix-fns.c +++ 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 <%S/Inputs/expected-plists/unix-fns.c.plist >%t.expected.sed.plist && echo >>%t.plist && %normalize_plist <%t.plist | diff -u %t.expected.sed.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 Index: test/Analysis/lit.local.cfg =================================================================== --- test/Analysis/lit.local.cfg +++ test/Analysis/lit.local.cfg @@ -14,6 +14,14 @@ 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\."'''))
Index: test/Analysis/unix-fns.c =================================================================== --- test/Analysis/unix-fns.c +++ 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 <%S/Inputs/expected-plists/unix-fns.c.plist >%t.expected.sed.plist && echo >>%t.plist && %normalize_plist <%t.plist | diff -u %t.expected.sed.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 Index: test/Analysis/lit.local.cfg =================================================================== --- test/Analysis/lit.local.cfg +++ test/Analysis/lit.local.cfg @@ -14,6 +14,14 @@ 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\."'''))
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits