summaryrefslogtreecommitdiff
path: root/test/Analysis/lit.local.cfg
blob: acae2bdcd4f084cbc07f252b9f73e7dd3f7aa8f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import lit.TestRunner
import sys

# Custom format class for static analyzer tests
class AnalyzerTest(lit.formats.ShTest, object):

    def execute(self, test, litConfig):
        result = self.executeWithAnalyzeSubstitution(test, litConfig, '-analyzer-constraints=range')

        if result.code == lit.Test.FAIL:
            return result

        return result

    def executeWithAnalyzeSubstitution(self, test, litConfig, substitution):
        saved_substitutions = list(test.config.substitutions)
        test.config.substitutions.append(('%analyze', substitution))
        result = lit.TestRunner.executeShTest(test, litConfig, self.execute_external)
        test.config.substitutions = saved_substitutions

        return result

# This results in a pickling-related failure on Windows
if (not sys.platform in ['win32']):
    config.test_format = AnalyzerTest(config.test_format.execute_external)
else:
    config.substitutions.append(('%analyze', '-analyzer-constraints=range'))

if not config.root.clang_staticanalyzer:
    config.unsupported = True