| 1 | # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: |
| 2 | from lit.llvm.subst import ToolSubst |
| 3 | import site |
| 4 | |
| 5 | # Load the custom analyzer test format, which runs the test again with Z3 if it |
| 6 | # is available. |
| 7 | site.addsitedir(os.path.dirname(__file__)) |
| 8 | import analyzer_test |
| 9 | |
| 10 | config.test_format = analyzer_test.AnalyzerTest( |
| 11 | config.test_format.execute_external, config.use_z3_solver |
| 12 | ) |
| 13 | |
| 14 | # Filtering command used by Clang Analyzer tests (when comparing .plist files |
| 15 | # with reference output) |
| 16 | config.substitutions.append( |
| 17 | ( |
| 18 | "%normalize_plist", |
| 19 | "grep -Ev '%s|%s|%s'" |
| 20 | % ( |
| 21 | "^[[:space:]]*<string>.* version .*</string>[[:space:]]*$", |
| 22 | "^[[:space:]]*<string>/.*</string>[[:space:]]*$", |
| 23 | "^[[:space:]]*<string>.:.*</string>[[:space:]]*$", |
| 24 | ), |
| 25 | ) |
| 26 | ) |
| 27 | |
| 28 | # Filtering command for testing SARIF output against reference output. |
| 29 | config.substitutions.append( |
| 30 | ( |
| 31 | "%normalize_sarif", |
| 32 | "grep -Ev '^[[:space:]]*(%s|%s|%s)[[:space:]]*$'" |
| 33 | % ( |
| 34 | '"uri": "file:.*%basename_t"', |
| 35 | '"version": ".* version .*"', |
| 36 | '"version": "2.1.0"', |
| 37 | ), |
| 38 | ) |
| 39 | ) |
| 40 | |
| 41 | if not config.root.clang_staticanalyzer: |
| 42 | config.unsupported = True |