[PATCH] D139869: [lit] Document the 'target=<triple>' feature
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 21 06:12:00 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG566e34829fb6: [lit] Document the 'target=<triple>' feature (authored by probinson).
Herald added subscribers: Sanitizers, Enna1.
Herald added a project: Sanitizers.
Changed prior to commit:
https://reviews.llvm.org/D139869?vs=483362&id=484555#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139869/new/
https://reviews.llvm.org/D139869
Files:
compiler-rt/docs/TestingGuide.rst
llvm/docs/TestingGuide.rst
Index: llvm/docs/TestingGuide.rst
===================================================================
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -499,10 +499,10 @@
; This test will be only enabled in the build with asserts.
; REQUIRES: asserts
- ; This test is disabled on Linux.
- ; UNSUPPORTED: -linux-
- ; This test is expected to fail on PowerPC.
- ; XFAIL: powerpc
+ ; This test is disabled when running on Linux.
+ ; UNSUPPORTED: system-linux
+ ; This test is expected to fail when targeting PowerPC.
+ ; XFAIL: target=powerpc{{.*}}
``REQUIRES`` and ``UNSUPPORTED`` and ``XFAIL`` all accept a comma-separated
list of boolean expressions. The values in each expression may be:
@@ -513,7 +513,10 @@
expression is satisfied if any feature matches the regular expression. Regular
expressions can appear inside an identifier, so for example ``he{{l+}}o`` would match
``helo``, ``hello``, ``helllo``, and so on.
-- Substrings of the target triple (``UNSUPPORTED`` and ``XFAIL`` only).
+- The default target triple, preceded by the string ``target=`` (for example,
+ ``target=x86_64-pc-windows-msvc``). Typically regular expressions are used
+ to match parts of the triple (for example, ``target={{.*}}-windows{{.*}}``
+ to match any Windows target triple).
| ``REQUIRES`` enables the test if all expressions are true.
| ``UNSUPPORTED`` disables the test if any expression is true.
@@ -523,11 +526,11 @@
.. code-block:: llvm
- ; This test is disabled on Windows,
- ; and is disabled on Linux, except for Android Linux.
- ; UNSUPPORTED: windows, linux && !android
- ; This test is expected to fail on both PowerPC and ARM.
- ; XFAIL: powerpc || arm
+ ; This test is disabled when running on Windows,
+ ; and is disabled when targeting Linux, except for Android Linux.
+ ; UNSUPPORTED: system-windows, target={{.*linux.*}} && !target={{.*android.*}}
+ ; This test is expected to fail when targeting PowerPC or running on Darwin.
+ ; XFAIL: target=powerpc{{.*}}, system-darwin
Substitutions
Index: compiler-rt/docs/TestingGuide.rst
===================================================================
--- compiler-rt/docs/TestingGuide.rst
+++ compiler-rt/docs/TestingGuide.rst
@@ -31,23 +31,24 @@
Sometimes it is necessary to restrict a test to a specific target or mark it as
an "expected fail" or XFAIL. This is normally achieved using ``REQUIRES:`` or
-``XFAIL:`` with a substring of LLVM's default target triple. Unfortunately, the
+``XFAIL:`` and the ``target=<target-triple>`` feature, typically with a regular
+expression matching an appropriate substring of the triple. Unfortunately, the
behaviour of this is somewhat quirky in compiler-rt. There are two main
pitfalls to avoid.
-The first pitfall is that these directives perform a substring match on the
-triple and as such ``XFAIL: mips`` affects more triples than expected. For
-example, ``mips-linux-gnu``, ``mipsel-linux-gnu``, ``mips64-linux-gnu``, and
-``mips64el-linux-gnu`` will all match a ``XFAIL: mips`` directive. Including a
-trailing ``-`` such as in ``XFAIL: mips-`` can help to mitigate this quirk but
-even that has issues as described below.
+The first pitfall is that these regular expressions may inadvertently match
+more triples than expected. For example, ``XFAIL: target=mips{{.*}}`` matches
+``mips-linux-gnu``, ``mipsel-linux-gnu``, ``mips64-linux-gnu``, and
+``mips64el-linux-gnu``. Including a trailing ``-`` such as in
+``XFAIL: target=mips-{{.*}}`` can help to mitigate this quirk but even that has
+issues as described below.
The second pitfall is that the default target triple is often inappropriate for
compiler-rt tests since compiler-rt tests may be compiled for multiple targets.
For example, a typical build on an ``x86_64-linux-gnu`` host will often run the
-tests for both x86_64 and i386. In this situation ``XFAIL: x86_64`` will mark
-both the x86_64 and i386 tests as an expected failure while ``XFAIL: i386``
-will have no effect at all.
+tests for both x86_64 and i386. In this situation ``XFAIL: target=x86_64{{{.*}}``
+will mark both the x86_64 and i386 tests as an expected failure while
+``XFAIL: target=i386{{.*}}`` will have no effect at all.
To remedy both pitfalls, compiler-rt tests provide a feature string which can
be used to specify a single target. This string is of the form
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139869.484555.patch
Type: text/x-patch
Size: 4428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221221/56de2fc1/attachment.bin>
More information about the llvm-commits
mailing list