lit: Allow XFAIL: lines to also refer to "features".
authorDaniel Dunbar <daniel@zuster.org>
Thu, 18 Oct 2012 20:43:04 +0000 (20:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 18 Oct 2012 20:43:04 +0000 (20:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166224 91177308-0d34-0410-b5e6-96231b3b80d8

docs/TestingGuide.html
utils/lit/lit/ExampleTests/xfail-feature.c [new file with mode: 0644]
utils/lit/lit/TestRunner.py

index 1f9c9157306c9a31b8be762d588eda69d2163743..fa3ff2b0398b95cc66fb22e5902475c8db18b100 100644 (file)
@@ -798,14 +798,15 @@ define two separate CHECK lines that match on the same line.
   <p>Sometimes it is necessary to mark a test case as "expected fail" or XFAIL.
   You can easily mark a test as XFAIL just by including <tt>XFAIL: </tt> on a
   line near the top of the file. This signals that the test case should succeed
-  if the test fails. Such test cases are counted separately by the testing tool. To
-  specify an expected fail, use the XFAIL keyword in the comments of the test
-  program followed by a colon and one or more regular expressions (separated by
-  a comma). The regular expressions allow you to XFAIL the test conditionally by
-  host platform. The regular expressions following the : are matched against the
-  target triplet for the host machine. If there is a match, the test is expected
-  to fail. If not, the test is expected to succeed. To XFAIL everywhere just
-  specify <tt>XFAIL: *</tt>. Here is an example of an <tt>XFAIL</tt> line:</p>
+  if the test fails. Such test cases are counted separately by the testing
+  tool. To specify an expected fail, use the XFAIL keyword in the comments of
+  the test program followed by a colon and one or more failure patterns. Each
+  failure pattern can be either '*' (to specify fail everywhere), or a part of a
+  target triple (indicating the test should fail on that platfomr), or the name
+  of a configurable feature (for example, "loadable_module").. If there is a
+  match, the test is expected to fail. If not, the test is expected to
+  succeed. To XFAIL everywhere just specify <tt>XFAIL: *</tt>. Here is an
+  example of an <tt>XFAIL</tt> line:</p>
 
 <div class="doc_code">
 <pre>
diff --git a/utils/lit/lit/ExampleTests/xfail-feature.c b/utils/lit/lit/ExampleTests/xfail-feature.c
new file mode 100644 (file)
index 0000000..3444bf8
--- /dev/null
@@ -0,0 +1,4 @@
+// This test should XPASS.
+
+// RUN: true
+// XFAIL: some-feature-name
index 71882b76f8b95f819eb794630d8ed9313487b32b..62a795671e1c0e7bdd70d0b492ff37ffaf5b8bc8 100644 (file)
@@ -370,10 +370,15 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
 
     return executeCommand(command, cwd=cwd, env=test.config.environment)
 
-def isExpectedFail(xfails, xtargets, target_triple):
-    # Check if any xfail matches this target.
+def isExpectedFail(test, xfails, xtargets):
+    # If the xfail matches an available feature, it always fails.
     for item in xfails:
-        if item == '*' or item in target_triple:
+        if item in test.config.available_features:
+            return True
+
+    # Otherwise, check if any xfail matches this target.
+    for item in xfails:
+        if item == '*' or item in test.suite.config.target_triple:
             break
     else:
         return False
@@ -382,7 +387,7 @@ def isExpectedFail(xfails, xtargets, target_triple):
     #
     # FIXME: Rename XTARGET to something that makes sense, like XPASS.
     for item in xtargets:
-        if item == '*' or item in target_triple:
+        if item == '*' or item in test.suite.config.target_triple:
             return False
 
     return True
@@ -491,7 +496,7 @@ def parseIntegratedTestScript(test, normalize_slashes=False,
         return (Test.UNSUPPORTED,
                 "Test requires the following features: %s" % msg)
 
-    isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
+    isXFail = isExpectedFail(test, xfails, xtargets)
     return script,isXFail,tmpBase,execdir
 
 def formatTestOutput(status, out, err, exitCode, failDueToStderr, script):