[llvm] r271468 - Add "REQUIRES-ANY" feature test
Eric Fiselier via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 18:59:59 PDT 2016
Author: ericwf
Date: Wed Jun 1 20:59:57 2016
New Revision: 271468
URL: http://llvm.org/viewvc/llvm-project?rev=271468&view=rev
Log:
Add "REQUIRES-ANY" feature test
Summary:
This patch adds a "REQUIRES-ANY" feature test that is disjunctive. This marks a test as `UNSUPPORTED` if none of the specified features are available.
Libc++ has the need to write feature test such as `// REQUIRES-ANY: c++98, c++03` when testing of behavior that is specific to older dialects but has since changed.
Reviewers: rnk, ddunbar
Subscribers: ddunbar, probinson, llvm-commits, cfe-commits
Differential Revision: http://reviews.llvm.org/D20757
Added:
llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
Modified:
llvm/trunk/utils/lit/lit/TestRunner.py
llvm/trunk/utils/lit/tests/shtest-format.py
Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=271468&r1=271467&r2=271468&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Wed Jun 1 20:59:57 2016
@@ -616,8 +616,10 @@ def parseIntegratedTestScript(test, requ
sourcepath = test.getSourcePath()
script = []
requires = []
+ requires_any = []
unsupported = []
- keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'UNSUPPORTED:', 'END.']
+ keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'REQUIRES-ANY:',
+ 'UNSUPPORTED:', 'END.']
for line_number, command_type, ln in \
parseIntegratedTestScriptCommands(sourcepath, keywords):
if command_type == 'RUN':
@@ -642,6 +644,8 @@ def parseIntegratedTestScript(test, requ
test.xfails.extend([s.strip() for s in ln.split(',')])
elif command_type == 'REQUIRES':
requires.extend([s.strip() for s in ln.split(',')])
+ elif command_type == 'REQUIRES-ANY':
+ requires_any.extend([s.strip() for s in ln.split(',')])
elif command_type == 'UNSUPPORTED':
unsupported.extend([s.strip() for s in ln.split(',')])
elif command_type == 'END':
@@ -668,6 +672,12 @@ def parseIntegratedTestScript(test, requ
msg = ', '.join(missing_required_features)
return lit.Test.Result(Test.UNSUPPORTED,
"Test requires the following features: %s" % msg)
+ requires_any_features = [f for f in requires_any
+ if f in test.config.available_features]
+ if requires_any and not requires_any_features:
+ msg = ' ,'.join(requires_any)
+ return lit.Test.Result(Test.UNSUPPORTED,
+ "Test requires any of the following features: %s" % msg)
unsupported_features = [f for f in unsupported
if f in test.config.available_features]
if unsupported_features:
Added: llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt?rev=271468&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt Wed Jun 1 20:59:57 2016
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-missing-feature-2
Added: llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt?rev=271468&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt Wed Jun 1 20:59:57 2016
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-present-feature
Modified: llvm/trunk/utils/lit/tests/shtest-format.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/shtest-format.py?rev=271468&r1=271467&r2=271468&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/shtest-format.py (original)
+++ llvm/trunk/utils/lit/tests/shtest-format.py Wed Jun 1 20:59:57 2016
@@ -47,6 +47,8 @@
# CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
# CHECK: PASS: shtest-format :: pass.txt
+# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt
+# CHECK: PASS: shtest-format :: requires-any-present.txt
# CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
# CHECK: PASS: shtest-format :: requires-present.txt
# CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt
@@ -69,9 +71,9 @@
# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
# CHECK: shtest-format :: fail.txt
-# CHECK: Expected Passes : 4
+# CHECK: Expected Passes : 5
# CHECK: Expected Failures : 3
-# CHECK: Unsupported Tests : 2
+# CHECK: Unsupported Tests : 3
# CHECK: Unresolved Tests : 1
# CHECK: Unexpected Passes : 1
# CHECK: Unexpected Failures: 3
More information about the llvm-commits
mailing list