[PATCH] D137434: [lit] Add `target=<triple>` as a feature keyword

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 08:48:22 PDT 2022


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

Modified a couple of lit's own tests to use this; left others as-is,
because for now triple substrings still work in UNSUPPORTED/XFAIL.


https://reviews.llvm.org/D137434

Files:
  llvm/utils/lit/lit/llvm/config.py
  llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
  llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
  llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
  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
@@ -59,7 +59,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
@@ -86,8 +86,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
@@ -96,7 +96,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{{[ ]*}}>
@@ -141,9 +141,7 @@
 # XUNIT: </failure>
 # 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/shtest-format/xfail-target.txt
===================================================================
--- llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
+++ llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
@@ -1,2 +1,2 @@
 RUN: false
-XFAIL: x86_64
+XFAIL: target=x86_64{{.*}}
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: x86_64
-RUN: false
+# REQUIRES line that uses target triple, which now works. Test should run
+REQUIRES: target=x86_64{{.*}}
+RUN: true
Index: llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
===================================================================
--- llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
+++ llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
@@ -5,5 +5,6 @@
 config.test_source_root = None
 config.test_exec_root = None
 config.target_triple = 'x86_64-unknown-unknown'
+config.available_features.add('target=%s' % config.target_triple)
 config.available_features.add('a-present-feature')
 config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
Index: llvm/utils/lit/lit/llvm/config.py
===================================================================
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -94,6 +94,7 @@
         # part of the standard header.  But currently they aren't)
         host_triple = getattr(config, 'host_triple', None)
         target_triple = getattr(config, 'target_triple', None)
+        features.add('target=%s' % target_triple)
         if host_triple and host_triple == target_triple:
             features.add('native')
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137434.473253.patch
Type: text/x-patch
Size: 3856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221104/0a2ecb7a/attachment-0001.bin>


More information about the llvm-commits mailing list