diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-08-21 22:26:42 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-08-21 22:26:42 +0000 |
commit | f72bc792264941d1cdffe99775ce5e28bcdc51a4 (patch) | |
tree | b54685122f86ef547bba14b73d0bbeabfc794cc8 /utils/lit/lit/Test.py | |
parent | d3bf8a2c0aefe36cb4bfc6f41983aa09caae2acb (diff) | |
download | llvm-f72bc792264941d1cdffe99775ce5e28bcdc51a4.tar.gz llvm-f72bc792264941d1cdffe99775ce5e28bcdc51a4.tar.bz2 llvm-f72bc792264941d1cdffe99775ce5e28bcdc51a4.tar.xz |
[lit] Lift XFAIL handling to core infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit/lit/Test.py')
-rw-r--r-- | utils/lit/lit/Test.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py index c1bacb3d86..59ca6943e7 100644 --- a/utils/lit/lit/Test.py +++ b/utils/lit/lit/Test.py @@ -59,6 +59,10 @@ class Test: self.suite = suite self.path_in_suite = path_in_suite self.config = config + # A list of conditions under which this test is expected to fail. These + # can optionally be provided by test format handlers, and will be + # honored when the test result is supplied. + self.xfails = [] # The test result, once complete. self.result = None @@ -70,6 +74,13 @@ class Test: self.result = result + # Apply the XFAIL handling to resolve the result exit code. + if self.isExpectedToFail(): + if self.result.code == PASS: + self.result.code = XPASS + elif self.result.code == FAIL: + self.result.code = XFAIL + def getFullName(self): return self.suite.config.name + ' :: ' + '/'.join(self.path_in_suite) @@ -78,3 +89,29 @@ class Test: def getExecPath(self): return self.suite.getExecPath(self.path_in_suite) + + def isExpectedToFail(self): + """ + isExpectedToFail() -> bool + + Check whether this test is expected to fail in the current + configuration. This check relies on the test xfails property which by + some test formats may not be computed until the test has first been + executed. + """ + + # Check if any of the xfails match an available feature or the target. + for item in self.xfails: + # If this is the wildcard, it always fails. + if item == '*': + return True + + # If this is an exact match for one of the features, it fails. + if item in self.config.available_features: + return True + + # If this is a part of the target triple, it fails. + if item in self.suite.config.target_triple: + return True + + return False |