[PATCH] D83816: Document the -analyze opt flag in the LLVM testing guide (NFC)

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 14:44:06 PDT 2020


mehdi_amini created this revision.
mehdi_amini added a reviewer: lattner.
Herald added subscribers: llvm-commits, aaron.ballman.
Herald added a project: LLVM.

This came up in a recent review, @mtrofin was wondering were was
this all documented and I couldn't find a reference to provide.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83816

Files:
  llvm/docs/TestingGuide.rst


Index: llvm/docs/TestingGuide.rst
===================================================================
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -47,6 +47,9 @@
 Unit tests are written using `Google Test <https://github.com/google/googletest/blob/master/googletest/docs/primer.md>`_
 and `Google Mock <https://github.com/google/googletest/blob/master/googlemock/docs/for_dummies.md>`_
 and are located in the ``llvm/unittests`` directory.
+In general unit tests are reserved to test targeting support library and generic
+data structure, we prefer the regression tests for testing transformations and
+analysis on the IR.
 
 Regression tests
 ----------------
@@ -62,6 +65,18 @@
 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. When writing an Analysis pass, overloading the virtual
+`print <WritingAnLLVMPass.html#the-print-method>`_ method from the `Pass` class
+and printing the result of the analysis allow to write FileCheck tests on the
+output of `opt -<analysis name> -analyze`.
+See `llvm/test/Analysis/ScalarEvolution/trip-count.ll <https://github.com/llvm/llvm-project/blob/master/llvm/test/Analysis/ScalarEvolution/trip-count.ll>`_
+for an example of such test.
+
 ``test-suite``
 --------------
 
@@ -184,7 +199,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.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83816.277981.patch
Type: text/x-patch
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200714/ccaeec09/attachment.bin>


More information about the llvm-commits mailing list