2017-04-06 02:56:48 +08:00
|
|
|
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
2021-01-23 02:25:08 +08:00
|
|
|
from lit.llvm.subst import ToolSubst
|
2017-04-06 02:56:48 +08:00
|
|
|
import site
|
2017-03-04 02:02:02 +08:00
|
|
|
|
2017-04-06 02:56:48 +08:00
|
|
|
# Load the custom analyzer test format, which runs the test again with Z3 if it
|
|
|
|
# is available.
|
|
|
|
site.addsitedir(os.path.dirname(__file__))
|
|
|
|
import analyzer_test
|
|
|
|
config.test_format = analyzer_test.AnalyzerTest(
|
2018-08-14 07:12:43 +08:00
|
|
|
config.test_format.execute_external, config.use_z3_solver)
|
2017-03-04 02:02:02 +08:00
|
|
|
|
2019-06-11 22:21:32 +08:00
|
|
|
# Filtering command used by Clang Analyzer tests (when comparing .plist files
|
[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
2019-06-11 06:33:34 +08:00
|
|
|
# with reference output)
|
2019-06-11 22:21:32 +08:00
|
|
|
config.substitutions.append(('%normalize_plist',
|
|
|
|
"grep -Ev '%s|%s|%s'" %
|
|
|
|
('^[[:space:]]*<string>.* version .*</string>[[:space:]]*$',
|
|
|
|
'^[[:space:]]*<string>/.*</string>[[:space:]]*$',
|
|
|
|
'^[[:space:]]*<string>.:.*</string>[[:space:]]*$')))
|
[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
2019-06-11 06:33:34 +08:00
|
|
|
|
[analyzer] SARIF: Add EOF newline; replace diff_sarif
Summary:
This patch applies a change similar to rC363069, but for SARIF files.
The `%diff_sarif` 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.
Additionally, this patch updates the SARIF output to have a newline at
the end of the file. This makes it so that the SARIF file qualifies as a
POSIX text file, which increases the consumability of the generated file
in relation to various tools.
Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty, aaron.ballman
Reviewed By: aaron.ballman
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/D62952
llvm-svn: 363822
2019-06-19 23:27:35 +08:00
|
|
|
# Filtering command for testing SARIF output against reference output.
|
|
|
|
config.substitutions.append(('%normalize_sarif',
|
|
|
|
"grep -Ev '^[[:space:]]*(%s|%s|%s)[[:space:]]*$'" %
|
|
|
|
('"uri": "file:.*%basename_t"',
|
|
|
|
'"version": ".* version .*"',
|
2019-08-27 22:43:54 +08:00
|
|
|
'"version": "2.1.0"')))
|
2018-11-02 02:57:38 +08:00
|
|
|
|
2017-03-03 07:30:53 +08:00
|
|
|
if not config.root.clang_staticanalyzer:
|
|
|
|
config.unsupported = True
|