[lit] Update LitTestCase to support lit.Test.Result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2013-08-29 00:40:59 +00:00
parent e54726a87a
commit 8a1d9b207a

View File

@ -23,10 +23,18 @@ class LitTestCase(unittest.TestCase):
return self._test.getFullName() return self._test.getFullName()
def runTest(self): def runTest(self):
tr, output = self._test.config.test_format.execute( result = self._test.config.test_format.execute(
self._test, self._lit_config) self._test, self._lit_config)
if tr is lit.Test.UNRESOLVED: # Support deprecated result from execute() which returned the result
raise UnresolvedError(output) # code and additional output as a tuple.
elif tr.isFailure: if isinstance(result, tuple):
self.fail(output) code, output = result
result = lit.Test.Result(code, output)
elif not isinstance(result, lit.Test.Result):
raise ValueError("unexpected result from test execution")
if result.code is lit.Test.UNRESOLVED:
raise UnresolvedError(result.output)
elif result.code.isFailure:
self.fail(result.output)