diff --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst --- a/llvm/docs/TestingGuide.rst +++ b/llvm/docs/TestingGuide.rst @@ -47,6 +47,9 @@ Unit tests are written using `Google Test `_ and `Google Mock `_ and are located in the ``llvm/unittests`` directory. +In general unit tests are reserved to test targeting the support library and +generic data structure, we prefer relying on regression tests for testing +transformations and analysis on the IR. Regression tests ---------------- @@ -62,6 +65,17 @@ somewhere underneath this directory. For example, it can be a small piece of LLVM IR distilled from an actual application or benchmark. +Testing Analysis +---------------- + +Analysis are passes that are inferring properties on some part of the IR and not +transforming it. They are tested in general using the same infrastructure as the +regression tests, by creating a separate "Printer" pass to consume the analysis +result and print it on the standard output in a textual format suitable for +FileCheck. +See `llvm/test/Analysis/BranchProbabilityInfo/loop.ll `_ +for an example of such test. + ``test-suite`` -------------- @@ -184,7 +198,7 @@ ---------------------------- The regression test structure is very simple, but does require some -information to be set. This information is gathered via ``configure`` +information to be set. This information is gathered via ``cmake`` and is written to a file, ``test/lit.site.cfg`` in the build directory. The ``llvm/test`` Makefile does this work for you.