[llvm] r375195 - [lit] Move resolving of XFAIL result codes out of Test.setResult
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 17:50:37 PDT 2019
Author: yln
Date: Thu Oct 17 17:50:37 2019
New Revision: 375195
URL: http://llvm.org/viewvc/llvm-project?rev=375195&view=rev
Log:
[lit] Move resolving of XFAIL result codes out of Test.setResult
This will allow us to serialize just the result object instead of the
whole lit.Test object back from the worker to the main lit process.
Modified:
llvm/trunk/utils/lit/lit/Test.py
llvm/trunk/utils/lit/lit/worker.py
Modified: llvm/trunk/utils/lit/lit/Test.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Test.py?rev=375195&r1=375194&r2=375195&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Test.py (original)
+++ llvm/trunk/utils/lit/lit/Test.py Thu Oct 17 17:50:37 2019
@@ -231,18 +231,6 @@ class Test:
self.result = result
- # Apply the XFAIL handling to resolve the result exit code.
- try:
- if self.isExpectedToFail():
- if self.result.code == PASS:
- self.result.code = XPASS
- elif self.result.code == FAIL:
- self.result.code = XFAIL
- except ValueError as e:
- # Syntax error in an XFAIL line.
- self.result.code = UNRESOLVED
- self.result.output = str(e)
-
def getFullName(self):
return self.suite.config.name + ' :: ' + '/'.join(self.path_in_suite)
Modified: llvm/trunk/utils/lit/lit/worker.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/worker.py?rev=375195&r1=375194&r2=375195&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/worker.py (original)
+++ llvm/trunk/utils/lit/lit/worker.py Thu Oct 17 17:50:37 2019
@@ -64,9 +64,30 @@ def _execute_test(test, lit_config):
end = time.time()
result.elapsed = end - start
+ resolve_result_code(result, test)
+
test.setResult(result)
+# TODO(yln): is this the right place to deal with this?
+# isExpectedToFail() only works after the test has been executed.
+def resolve_result_code(result, test):
+ try:
+ expected_to_fail = test.isExpectedToFail()
+ except ValueError as e:
+ # Syntax error in an XFAIL line.
+ result.code = lit.Test.UNRESOLVED
+ result.output = str(e)
+ else:
+ if expected_to_fail:
+ # pass -> unexpected pass
+ if result.code is lit.Test.PASS:
+ result.code = lit.Test.XPASS
+ # fail -> expected fail
+ if result.code is lit.Test.FAIL:
+ result.code = lit.Test.XFAIL
+
+
def _execute_test_handle_errors(test, lit_config):
try:
return _adapt_result(test.config.test_format.execute(test, lit_config))
More information about the llvm-commits
mailing list