Skip to content

Commit 4cd7126

Browse files
committed
[Documentation] Expand on testing variants.
The testing documentation appears to be from an era when the only kind of tests were the lldbsuite python tests. This patch adds a short description of the unittests and LIT tests and how to run them. Patch by: Lawrence D'Anna Differential revision: https://reviews.llvm.org/D67943 llvm-svn: 372797
1 parent ccf6030 commit 4cd7126

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed

lldb/docs/resources/test.rst

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
Testing
22
=======
33

4-
The LLDB test suite consists of Python scripts located under the test
5-
directory. Each script contains a number of test cases and is usually
6-
accompanied by a C (C++, ObjC, etc.) source file. Each test first compiles the
7-
source file and then uses LLDB to debug the resulting executable. The tests
8-
verify both the LLDB command line interface and the scripting API.
4+
The LLDB test suite consists of three different kinds of test:
5+
6+
* Python scripts located under ``lldb/packages/Python/lldbsuite``.
7+
These are written using python's unittest2 testing framework.
8+
9+
* Unit tests, located under ``lldb/unittests``. These are written in C++,
10+
using googletest.
11+
12+
* LIT tests, located under ``lldb/lit``. These use the LLVM Integrated Tester.
13+
14+
Many of the tests are accompanied by a C (C++, ObjC, etc.) source file. Each test
15+
first compiles the source file and then uses LLDB to debug the resulting executable.
16+
17+
The tests verify both the LLDB command line interface and the scripting API.
918

1019
.. contents::
1120
:local:
@@ -46,8 +55,8 @@ Note that multiple ``-A`` and ``-C`` flags can be specified to
4655
``LLDB_TEST_USER_ARGS``.
4756

4857

49-
Running a Specific Test or Set of Tests
50-
---------------------------------------
58+
Running a Specific Test or Set of Tests: Python
59+
-----------------------------------------------
5160

5261
In addition to running all the LLDB test suites with the ``check-lldb`` CMake
5362
target above, it is possible to run individual LLDB tests. If you have a CMake
@@ -86,6 +95,44 @@ Many more options that are available. To see a list of all of them, run:
8695

8796
> python dotest.py -h
8897

98+
99+
Running a Specific Test or Set of Tests: Unit Tests
100+
---------------------------------------------------
101+
102+
The unit tests are simple executables, located in the build directory under ``tools/lldb/unittests``.
103+
104+
To run them, just run the test binary, for example, to run all the Host tests:
105+
106+
::
107+
108+
> ./tools/lldb/unittests/Host/HostTests
109+
110+
111+
To run a specific test, pass a filter, for example:
112+
113+
::
114+
115+
> ./tools/lldb/unittests/Host/HostTests --gtest_filter=SocketTest.DomainListenConnectAccept
116+
117+
118+
Running a Specific Test or Set of Tests: LIT
119+
--------------------------------------------
120+
121+
LIT automatically scans a directory for tests. To run a subset of the LIT tests, pass it a
122+
subdirectory, for example:
123+
124+
::
125+
126+
> ./bin/llvm-lit -sv tools/lldb/lit/Commands/CommandScriptImmediateOutput
127+
128+
129+
LIT can also filter based on test name.
130+
131+
::
132+
133+
> ./bin/llvm-lit -sv tools/lldb/lit --filter CommandScriptImmediateOutput
134+
135+
89136
Running the Test Suite Remotely
90137
-------------------------------
91138

0 commit comments

Comments
 (0)