summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2013-07-03 20:56:33 +0000
committerRenato Golin <renato.golin@linaro.org>2013-07-03 20:56:33 +0000
commitf0126ea0a1a574b6b45c93a1a56a24d0ce30de87 (patch)
tree7dc5480c71aec3420ac680b79e7f7eae2807e2a9 /docs
parent79c163d6ddeb84ea1743eca0644688951bfc5a97 (diff)
downloadllvm-f0126ea0a1a574b6b45c93a1a56a24d0ce30de87.tar.gz
llvm-f0126ea0a1a574b6b45c93a1a56a24d0ce30de87.tar.bz2
llvm-f0126ea0a1a574b6b45c93a1a56a24d0ce30de87.tar.xz
Add platform specific tests doc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/TestingGuide.rst60
1 files changed, 60 insertions, 0 deletions
diff --git a/docs/TestingGuide.rst b/docs/TestingGuide.rst
index 79cedee764..3cfbb219e6 100644
--- a/docs/TestingGuide.rst
+++ b/docs/TestingGuide.rst
@@ -275,6 +275,66 @@ This test will fail if placed into a ``download`` directory.
To make your tests robust, always use ``opt ... < %s`` in the RUN line.
:program:`opt` does not output a ``ModuleID`` when input comes from stdin.
+Platform-Specific Tests
+-----------------------
+
+Whenever adding tests that require the knowledge of a specific platform,
+either related to code generated, specific output or back-end features,
+you must make sure to isolate the features, so that buildbots that
+run on different architectures (and don't even compile all back-ends),
+don't fail.
+
+The first problem is to check for target-specific output, for example sizes
+of structures, paths and architecture names, for example:
+
+* Tests containing Windows paths will fail on Linux and vice-versa.
+* Tests that check for ``x86_64`` somewhere in the text will fail anywhere else.
+* Tests where the debug information calculates the size of types and structures.
+
+Also, if the test rely on any behaviour that is coded in any back-end, it must
+go in its own directory. So, for instance, code generator tests for ARM go
+into ``test/CodeGen/ARM`` and so on. Those directories contain a special
+``lit`` configuration file that ensure all tests in that directory will
+only run if a specific back-end is compiled and available.
+
+For instance, on ``test/CodeGen/ARM``, the ``lit.local.cfg`` is:
+
+.. code-block:: python
+
+ config.suffixes = ['.ll', '.c', '.cpp', '.test']
+ targets = set(config.root.targets_to_build.split())
+ if not 'ARM' in targets:
+ config.unsupported = True
+
+Other platform-specific tests are those that depend on a specific feature
+of a specific sub-architecture, for example only to Intel chips that support ``AVX2``.
+
+For instance, ``test/CodeGen/X86/psubus.ll`` tests three sub-architecture
+variants:
+
+.. code-block:: llvm
+
+ ; RUN: llc -mcpu=core2 < %s | FileCheck %s -check-prefix=SSE2
+ ; RUN: llc -mcpu=corei7-avx < %s | FileCheck %s -check-prefix=AVX1
+ ; RUN: llc -mcpu=core-avx2 < %s | FileCheck %s -check-prefix=AVX2
+
+And the checks are different:
+
+.. code-block:: llvm
+
+ ; SSE2: @test1
+ ; SSE2: psubusw LCPI0_0(%rip), %xmm0
+ ; AVX1: @test1
+ ; AVX1: vpsubusw LCPI0_0(%rip), %xmm0, %xmm0
+ ; AVX2: @test1
+ ; AVX2: vpsubusw LCPI0_0(%rip), %xmm0, %xmm0
+
+So, if you're testing for a behaviour that you know is platform-specific or
+depends on special features of sub-architectures, you must add the specific
+triple, test with the specific FileCheck and put it into the specific
+directory that will filter out all other architectures.
+
+
Variables and substitutions
---------------------------