blob: 906b943d1a48ca62143829476ba5e7f032f50912 [file] [log] [blame]
Eric Fiselierd720d1f2015-08-22 19:40:49 +00001==============
2Testing libc++
3==============
4
5.. contents::
6 :local:
7
8Getting Started
9===============
10
11libc++ uses LIT to configure and run its tests. The primary way to run the
12libc++ tests is by using make check-libcxx. However since libc++ can be used
13in any number of possible configurations it is important to customize the way
14LIT builds and runs the tests. This guide provides information on how to use
15LIT directly to test libc++.
16
17Please see the `Lit Command Guide`_ for more information about LIT.
18
19.. _LIT Command Guide: http://llvm.org/docs/CommandGuide/lit.html
20
21
22Setting up the Environment
23--------------------------
24
25After building libc++ you must setup your environment to test libc++ using
26LIT.
27
28#. Create a shortcut to the actual lit executable so that you can invoke it
29 easily from the command line.
30
31 .. code-block:: bash
32
33 $ alias lit='python path/to/llvm/utils/lit/lit.py'
34
35#. Tell LIT where to find your build configuration.
36
37 .. code-block:: bash
38
39 $ export LIBCXX_SITE_CONFIG=path/to/build-libcxx/test/lit.site.cfg
40
41
42LIT Options
43===========
44
45:program:`lit` [*options*...] [*filenames*...]
46
47Command Line Options
48--------------------
49
50To use these options you pass them on the LIT command line as --param NAME or
51--param NAME=VALUE. Some options have default values specified during CMake's
52configuration. Passing the option on the command line will override the default.
53
54.. program:: lit
55
56.. option:: libcxx_site_config=<path/to/lit.site.cfg>
57
58 Specify the site configuration to use when running the tests. This option
59 overrides the enviroment variable LIBCXX_SITE_CONFIG.
60
61.. option:: libcxx_headers=<path/to/headers>
62
63 Specify the libc++ headers that are tested. By default the headers in the
64 source tree are used.
65
66.. option:: libcxx_library=<path/to/libc++.so>
67
68 Specify the libc++ library that is tested. By default the library in the
69 build directory is used. This option cannot be used when use_system_lib is
70 provided.
71
72.. option:: use_system_lib=<bool>
73
74 **Default**: False
75
76 Enable or disable testing against the installed version of libc++ library.
77 Note: This does not use the installed headers.
78
79.. option:: use_lit_shell=<bool>
80
81 Enable or disable the use of LIT's internal shell in ShTests. If the
82 environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
83 the default value. Otherwise the default value is True on Windows and False
84 on every other platform.
85
86.. option:: no_default_flags=<bool>
87
88 **Default**: False
89
90 Disable all default compile and link flags from being added. When this
91 option is used only flags specified using the compile_flags and link_flags
92 will be used.
93
94.. option:: compile_flags="<list-of-args>"
95
96 Specify additional compile flags as a space delimited string.
97 Note: This options should not be used to change the standard version used.
98
99.. option:: link_flags="<list-of-args>"
100
101 Specify additional link flags as a space delimited string.
102
103.. option:: std=<standard version>
104
105 **Values**: c++98, c++03, c++11, c++14, c++1z
106
107 Change the standard version used when building the tests.
108
109.. option:: debug_level=<level>
110
111 **Values**: 0, 1
112
113 Enable the use of debug mode. Level 0 enables assertions and level 1 enables
114 assertions and debugging of iterator misuse.
115
116.. option:: use_sanitizer=<sanitizer name>
117
118 **Values**: Memory, MemoryWithOrigins, Address, Undefined
119
120 Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
121 building libc++ then that sanitizer will be used by default.
122
123.. option:: color_diagnostics
124
125 Enable the use of colorized compile diagnostics. If the color_diagnostics
126 option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
127 present then color diagnostics will be enabled.
128
129
130Environment Variables
131---------------------
132
133.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
134
135 Specify the site configuration to use when running the tests.
136 Also see :option:`libcxx_site_config`.
137
138.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
139
140 If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
141 to use color diagnostic outputs from the compiler.
142 Also see :option:`color_diagnostics`.