[llvm] 56470b7 - [lit] Add `target=<triple>` as a feature keyword

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 05:50:54 PST 2022


Author: Paul Robinson
Date: 2022-11-16T05:50:45-08:00
New Revision: 56470b72f1fc1727d5ee87e2fed96e7dad286230

URL: https://github.com/llvm/llvm-project/commit/56470b72f1fc1727d5ee87e2fed96e7dad286230
DIFF: https://github.com/llvm/llvm-project/commit/56470b72f1fc1727d5ee87e2fed96e7dad286230.diff

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

As proposed first in D107162 and later in discourse at
https://discourse.llvm.org/t/rfc-lits-requires-and-triples/66041

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.

Differential Revision: https://reviews.llvm.org/D137434

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 3dce128ab4307..4be5960cf3125 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -94,6 +94,7 @@ def __init__(self, lit_config, config):
         # 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')
 

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
index 38c3da3d3cd92..799b518180844 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
+++ b/llvm/utils/lit/tests/Inputs/shtest-format/lit.cfg
@@ -5,5 +5,6 @@ config.test_format = lit.formats.ShTest()
 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)))

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt b/llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
index 6470bf4041457..2aedc4566aa3e 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-format/requires-triple.txt
+++ b/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

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt b/llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
index 36760bee435da..ccf683e840587 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
+++ b/llvm/utils/lit/tests/Inputs/shtest-format/xfail-target.txt
@@ -1,2 +1,2 @@
 RUN: false
-XFAIL: x86_64
+XFAIL: target=x86_64{{.*}}

diff  --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
index 363094aad95f6..b41a3f763f384 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/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]+}}"/>
 


        


More information about the llvm-commits mailing list