llvm.org GIT mirror llvm / 44a83f0
lit: Allow XFAIL: lines to also refer to "features". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166224 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 8 years ago
3 changed file(s) with 23 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
797797

Sometimes it is necessary to mark a test case as "expected fail" or XFAIL.

798798 You can easily mark a test as XFAIL just by including XFAIL: on a
799799 line near the top of the file. This signals that the test case should succeed
800 if the test fails. Such test cases are counted separately by the testing tool. To
801 specify an expected fail, use the XFAIL keyword in the comments of the test
802 program followed by a colon and one or more regular expressions (separated by
803 a comma). The regular expressions allow you to XFAIL the test conditionally by
804 host platform. The regular expressions following the : are matched against the
805 target triplet for the host machine. If there is a match, the test is expected
806 to fail. If not, the test is expected to succeed. To XFAIL everywhere just
807 specify XFAIL: *. Here is an example of an XFAIL line:

800 if the test fails. Such test cases are counted separately by the testing
801 tool. To specify an expected fail, use the XFAIL keyword in the comments of
802 the test program followed by a colon and one or more failure patterns. Each
803 failure pattern can be either '*' (to specify fail everywhere), or a part of a
804 target triple (indicating the test should fail on that platfomr), or the name
805 of a configurable feature (for example, "loadable_module").. If there is a
806 match, the test is expected to fail. If not, the test is expected to
807 succeed. To XFAIL everywhere just specify XFAIL: *. Here is an
808 example of an XFAIL line:

808809
809810
810811

                  
                
0 // This test should XPASS.
1
2 // RUN: true
3 // XFAIL: some-feature-name
369369
370370 return executeCommand(command, cwd=cwd, env=test.config.environment)
371371
372 def isExpectedFail(xfails, xtargets, target_triple):
373 # Check if any xfail matches this target.
372 def isExpectedFail(test, xfails, xtargets):
373 # If the xfail matches an available feature, it always fails.
374374 for item in xfails:
375 if item == '*' or item in target_triple:
375 if item in test.config.available_features:
376 return True
377
378 # Otherwise, check if any xfail matches this target.
379 for item in xfails:
380 if item == '*' or item in test.suite.config.target_triple:
376381 break
377382 else:
378383 return False
381386 #
382387 # FIXME: Rename XTARGET to something that makes sense, like XPASS.
383388 for item in xtargets:
384 if item == '*' or item in target_triple:
389 if item == '*' or item in test.suite.config.target_triple:
385390 return False
386391
387392 return True
490495 return (Test.UNSUPPORTED,
491496 "Test requires the following features: %s" % msg)
492497
493 isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
498 isXFail = isExpectedFail(test, xfails, xtargets)
494499 return script,isXFail,tmpBase,execdir
495500
496501 def formatTestOutput(status, out, err, exitCode, failDueToStderr, script):