| 1 |
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: |
| 2 |
import lit.formats |
| 3 |
|
| 4 |
config.test_format = lit.formats.ShTest(config.test_format.execute_external) |
| 5 |
|
| 6 |
# Filtering command used by Clang Analyzer tests (when comparing .plist files |
| 7 |
# with reference output) |
| 8 |
config.substitutions.append( |
| 9 |
( |
| 10 |
"%normalize_plist", |
| 11 |
"grep -Ev '%s|%s|%s'" |
| 12 |
% ( |
| 13 |
"^[[:space:]]*<string>.* version .*</string>[[:space:]]*$", |
| 14 |
"^[[:space:]]*<string>/.*</string>[[:space:]]*$", |
| 15 |
"^[[:space:]]*<string>.:.*</string>[[:space:]]*$", |
| 16 |
), |
| 17 |
) |
| 18 |
) |
| 19 |
|
| 20 |
sed_cmd = "/opt/freeware/bin/sed" if "system-aix" in config.available_features else "sed" |
| 21 |
|
| 22 |
# Filtering command for testing SARIF output against reference output. |
| 23 |
config.substitutions.append( |
| 24 |
( |
| 25 |
"%normalize_sarif", |
| 26 |
f"{sed_cmd} -r '%s;%s;%s;%s'" |
| 27 |
% ( |
| 28 |
# Replace version strings that are likely to change. |
| 29 |
r's/"version": ".* version .*"/"version": "[clang version]"/', |
| 30 |
r's/"version": "2.1.0"/"version": "[SARIF version]"/', |
| 31 |
# Strip directories from file URIs |
| 32 |
r's/"file:(\/+)([^"\/]+\/)*([^"]+)"/"file:\1[...]\/\3"/', |
| 33 |
# Set "length" to -1 |
| 34 |
r's/"length": [[:digit:]]+/"length": -1/' |
| 35 |
), |
| 36 |
) |
| 37 |
) |
| 38 |
|
| 39 |
if not config.root.clang_staticanalyzer: |
| 40 |
config.unsupported = True |