[PATCH] D107162: [lit] Have REQUIRES support the target triple

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 07:15:15 PDT 2021


probinson created this revision.
probinson added reviewers: jdenny, ldionne, yln.
Herald added a subscriber: delcypher.
probinson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently the UNSUPPORTED and XFAIL clauses support specifying
substrings of the target triple; but REQUIRES does not, which can trip
people up or lead to hacking config files to insert substitute feature
names.  Consistency across all three lit clauses seems preferable.


https://reviews.llvm.org/D107162

Files:
  llvm/utils/lit/lit/Test.py
  llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
  llvm/utils/lit/tests/Inputs/xunit-output/lit.cfg
  llvm/utils/lit/tests/shtest-format.py


Index: llvm/utils/lit/tests/shtest-format.py
===================================================================
--- llvm/utils/lit/tests/shtest-format.py
+++ llvm/utils/lit/tests/shtest-format.py
@@ -61,7 +61,7 @@
 # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
 # CHECK: PASS: shtest-format :: requires-present.txt
 # CHECK: UNRESOLVED: shtest-format :: requires-star.txt
-# CHECK: UNSUPPORTED: shtest-format :: requires-triple.txt
+# CHECK: PASS: shtest-format :: requires-triple.txt
 # CHECK: PASS: shtest-format :: unsupported-expr-false.txt
 # CHECK: UNSUPPORTED: shtest-format :: unsupported-expr-true.txt
 # CHECK: UNRESOLVED: shtest-format :: unsupported-star.txt
@@ -88,8 +88,8 @@
 # CHECK: shtest-format :: xpass.txt
 
 # CHECK: Testing Time:
-# CHECK: Unsupported        : 4
-# CHECK: Passed             : 6
+# CHECK: Unsupported        : 3
+# CHECK: Passed             : 7
 # CHECK: Expectedly Failed  : 4
 # CHECK: Unresolved         : 3
 # CHECK: Failed             : 4
@@ -98,7 +98,7 @@
 
 # XUNIT: <?xml version="1.0" encoding="UTF-8"?>
 # XUNIT-NEXT: <testsuites time="{{[0-9.]+}}">
-# XUNIT-NEXT: <testsuite name="shtest-format" tests="22" failures="8" skipped="4">
+# XUNIT-NEXT: <testsuite name="shtest-format" tests="22" failures="8" skipped="3">
 
 # XUNIT: <testcase classname="shtest-format.external_shell" name="fail.txt" time="{{[0-9]+\.[0-9]+}}">
 # XUNIT-NEXT: <failure{{[ ]*}}>
@@ -144,8 +144,7 @@
 # XUNIT-NEXT: </testcase>
 
 
-# XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-triple.txt" time="{{[0-9]+\.[0-9]+}}">
-# XUNIT-NEXT:<skipped message="Missing required feature(s): x86_64"/>
+# XUNIT: <testcase classname="shtest-format.shtest-format" name="requires-triple.txt" time="{{[0-9]+\.[0-9]+}}"/>
 
 # XUNIT: <testcase classname="shtest-format.shtest-format" name="unsupported-expr-false.txt" time="{{[0-9]+\.[0-9]+}}"/>
 
Index: llvm/utils/lit/tests/Inputs/xunit-output/lit.cfg
===================================================================
--- llvm/utils/lit/tests/Inputs/xunit-output/lit.cfg
+++ llvm/utils/lit/tests/Inputs/xunit-output/lit.cfg
@@ -7,4 +7,4 @@
 config.test_format = dummy_format.DummyFormat()
 config.test_source_root = None
 config.test_exec_root = None
-config.target_triple = None
+config.target_triple = ''
Index: llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
===================================================================
--- llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
+++ llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
@@ -1,3 +1,3 @@
-# REQUIRES line that uses target triple, which doesn't work. Test should not run
+# REQUIRES line that uses target triple.
 REQUIRES: x86_64
-RUN: false
+RUN: true
Index: llvm/utils/lit/lit/Test.py
===================================================================
--- llvm/utils/lit/lit/Test.py
+++ llvm/utils/lit/lit/Test.py
@@ -362,9 +362,10 @@
         return True
 
     def getMissingRequiredFeaturesFromList(self, features):
+        triple = getattr(self.suite.config, 'target_triple', "")
         try:
             return [item for item in self.requires
-                    if not BooleanExpression.evaluate(item, features)]
+                    if not BooleanExpression.evaluate(item, features, triple)]
         except ValueError as e:
             raise ValueError('Error in REQUIRES list:\n%s' % str(e))
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107162.363076.patch
Type: text/x-patch
Size: 3419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210730/883b0091/attachment.bin>


More information about the llvm-commits mailing list