[libcxx] r188960 - [tests] Update to use lit's now-integrated XFAIL handling.
Daniel Dunbar
daniel at zuster.org
Wed Aug 21 16:06:32 PDT 2013
Author: ddunbar
Date: Wed Aug 21 18:06:32 2013
New Revision: 188960
URL: http://llvm.org/viewvc/llvm-project?rev=188960&view=rev
Log:
[tests] Update to use lit's now-integrated XFAIL handling.
Modified:
libcxx/trunk/test/lit.cfg
Modified: libcxx/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=188960&r1=188959&r2=188960&view=diff
==============================================================================
--- libcxx/trunk/test/lit.cfg (original)
+++ libcxx/trunk/test/lit.cfg Wed Aug 21 18:06:32 2013
@@ -16,27 +16,6 @@ import lit.Test
import lit.formats
import lit.util
-# FIXME: For now, this is cribbed from lit.TestRunner, to avoid introducing a
-# dependency there. What we more ideally would like to do is lift the "xfail"
-# and "requires" handling to be a core lit framework feature.
-def isExpectedFail(test, xfails):
- # Check if any of the xfails match an available feature or the target.
- for item in xfails:
- # If this is the wildcard, it always fails.
- if item == '*':
- return True
-
- # If this is a part of any of the features, it fails.
- for feature in test.config.available_features:
- if item in feature:
- return True
-
- # If this is a part of the target triple, it fails.
- if item in test.suite.config.target_triple:
- return True
-
- return False
-
class LibcxxTestFormat(lit.formats.FileBasedTest):
"""
Custom test format handler for use with the test format use by libc++.
@@ -82,13 +61,12 @@ class LibcxxTestFormat(lit.formats.FileB
def _execute(self, test, lit_config):
# Extract test metadata from the test file.
- xfails = []
requires = []
with open(test.getSourcePath()) as f:
for ln in f:
if 'XFAIL:' in ln:
items = ln[ln.index('XFAIL:') + 6:].split(',')
- xfails.extend([s.strip() for s in items])
+ test.xfails.extend([s.strip() for s in items])
elif 'REQUIRES:' in ln:
items = ln[ln.index('REQUIRES:') + 9:].split(',')
requires.extend([s.strip() for s in items])
@@ -101,8 +79,7 @@ class LibcxxTestFormat(lit.formats.FileB
#
# FIXME: For now, this is cribbed from lit.TestRunner, to avoid
# introducing a dependency there. What we more ideally would like to do
- # is lift the "xfail" and "requires" handling to be a core lit
- # framework feature.
+ # is lift the "requires" handling to be a core lit framework feature.
missing_required_features = [f for f in requires
if f not in test.config.available_features]
if missing_required_features:
@@ -110,21 +87,8 @@ class LibcxxTestFormat(lit.formats.FileB
"Test requires the following features: %s" % (
', '.join(missing_required_features),))
- # Determine if this test is an expected failure.
- isXFail = isExpectedFail(test, xfails)
-
# Evaluate the test.
- result, report = self._evaluate_test(test, lit_config)
-
- # Convert the test result based on whether this is an expected failure.
- if isXFail:
- if result != lit.Test.FAIL:
- report += "\n\nTest was expected to FAIL, but did not.\n"
- result = lit.Test.XPASS
- else:
- result = lit.Test.XFAIL
-
- return result, report
+ return self._evaluate_test(test, lit_config)
def _evaluate_test(self, test, lit_config):
name = test.path_in_suite[-1]
More information about the cfe-commits
mailing list