# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: import lit.formats config.test_format = lit.formats.ShTest(config.test_format.execute_external) # 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:]]*.* version .*[[:space:]]*$", "^[[:space:]]*/.*[[:space:]]*$", "^[[:space:]]*.:.*[[:space:]]*$", ), ) ) sed_cmd = "/opt/freeware/bin/sed" if "system-aix" in config.available_features else "sed" # Filtering command for testing SARIF output against reference output. config.substitutions.append( ( "%normalize_sarif", f"{sed_cmd} -r '%s;%s;%s;%s'" % ( # Replace version strings that are likely to change. r's/"version": ".* version .*"/"version": "[clang version]"/', r's/"version": "2.1.0"/"version": "[SARIF version]"/', # Strip directories from file URIs r's/"file:(\/+)([^"\/]+\/)*([^"]+)"/"file:\1[...]\/\3"/', # Set "length" to -1 r's/"length": [[:digit:]]+/"length": -1/' ), ) ) if not config.root.clang_staticanalyzer: config.unsupported = True