2015-08-23 03:40:49 +08:00
|
|
|
==============
|
|
|
|
Testing libc++
|
|
|
|
==============
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
|
|
|
|
Getting Started
|
|
|
|
===============
|
|
|
|
|
2020-03-12 05:03:00 +08:00
|
|
|
libc++ uses LIT to configure and run its tests.
|
2019-09-05 08:38:36 +08:00
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
The primary way to run the libc++ tests is by using ``make check-cxx``.
|
2019-09-05 08:38:36 +08:00
|
|
|
|
|
|
|
However since libc++ can be used in any number of possible
|
|
|
|
configurations it is important to customize the way LIT builds and runs
|
|
|
|
the tests. This guide provides information on how to use LIT directly to
|
|
|
|
test libc++.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Please see the `Lit Command Guide`_ for more information about LIT.
|
|
|
|
|
2020-03-23 05:42:03 +08:00
|
|
|
.. _LIT Command Guide: https://llvm.org/docs/CommandGuide/lit.html
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
Usage
|
|
|
|
-----
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
After building libc++, you can run parts of the libc++ test suite by simply
|
2020-04-16 03:05:14 +08:00
|
|
|
running ``llvm-lit`` on a specified test or directory. If you're unsure
|
|
|
|
whether the required libraries have been built, you can use the
|
|
|
|
`check-cxx-deps` target. For example:
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
$ cd <monorepo-root>
|
2020-04-16 03:05:14 +08:00
|
|
|
$ make -C <build> check-cxx-deps # If you want to make sure the targets get rebuilt
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std/re # Run all of the std::regex tests
|
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test
|
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std/atomics libcxx/test/std/threads # Test std::thread and std::atomic
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
Sometimes you'll want to change the way LIT is running the tests. Custom options
|
|
|
|
can be specified using the `--param=<name>=<val>` flag. The most common option
|
|
|
|
you'll want to change is the standard dialect (ie -std=c++XX). By default the
|
|
|
|
test suite will select the newest C++ dialect supported by the compiler and use
|
|
|
|
that. However if you want to manually specify the option like so:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std/containers # Run the tests with the newest -std
|
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std/containers --param=std=c++03 # Run the tests in C++03
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
Occasionally you'll want to add extra compile or link flags when testing.
|
|
|
|
You can do this as follows:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test --param=compile_flags='-Wcustom-warning'
|
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test --param=link_flags='-L/custom/library/path'
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
Some other common examples include:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# Specify a custom compiler.
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test/std --param=cxx_under_test=/opt/bin/g++
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
# Enable warnings in the test suite
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test --param=enable_warnings=true
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
# Use UBSAN when running the tests.
|
2020-04-08 03:02:37 +08:00
|
|
|
$ <build>/bin/llvm-lit -sv libcxx/test --param=use_sanitizer=Undefined
|
|
|
|
|
|
|
|
Using a custom site configuration
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
By default, the libc++ test suite will use a site configuration that matches
|
|
|
|
the current CMake configuration. It does so by generating a ``lit.site.cfg``
|
|
|
|
file in the build directory from the ``libcxx/test/lit.site.cfg.in`` template,
|
|
|
|
and pointing ``llvm-lit`` (which is a wrapper around ``llvm/utils/lit/lit.py``)
|
|
|
|
to that file. So when you're running ``<build>/bin/llvm-lit``, the generated
|
|
|
|
``lit.site.cfg`` file is always loaded first, followed by the actual config in
|
|
|
|
``libcxx/test/lit.cfg``. However, it is sometimes desirable to use a custom
|
|
|
|
site configuration. To do that, you can use ``--param=libcxx_site_config`` or
|
|
|
|
the ``LIBCXX_SITE_CONFIG`` environment variable to point to the right site
|
|
|
|
configuration file. However, you must stop using ``llvm-lit``, or else the
|
|
|
|
generated ``lit.site.cfg`` will still be preferred:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ LIBCXX_SITE_CONFIG=path/to/your/site/configuration llvm/utils/lit/lit.py -sv ...
|
|
|
|
|
|
|
|
$ llvm/utils/lit/lit.py -sv ... --param=libcxx_site_config=path/to/your/site/configuration
|
2015-10-15 04:44:44 +08:00
|
|
|
|
2020-04-08 03:02:37 +08:00
|
|
|
In both of these cases, your custom site configuration should set up the
|
|
|
|
``config`` object in a way that is compatible with what libc++'s ``config.py``
|
|
|
|
module expects.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
LIT Options
|
|
|
|
===========
|
|
|
|
|
|
|
|
:program:`lit` [*options*...] [*filenames*...]
|
|
|
|
|
|
|
|
Command Line Options
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
To use these options you pass them on the LIT command line as --param NAME or
|
|
|
|
--param NAME=VALUE. Some options have default values specified during CMake's
|
|
|
|
configuration. Passing the option on the command line will override the default.
|
|
|
|
|
|
|
|
.. program:: lit
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: cxx_under_test=<path/to/compiler>
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
Specify the compiler used to build the tests.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: cxx_stdlib_under_test=<stdlib name>
|
|
|
|
|
|
|
|
**Values**: libc++, libstdc++
|
2016-10-12 08:00:37 +08:00
|
|
|
|
|
|
|
Specify the C++ standard library being tested. Unless otherwise specified
|
|
|
|
libc++ is used. This option is intended to allow running the libc++ test
|
|
|
|
suite against other standard library implementations.
|
|
|
|
|
2015-10-15 04:44:44 +08:00
|
|
|
.. option:: std=<standard version>
|
|
|
|
|
2017-11-08 04:26:23 +08:00
|
|
|
**Values**: c++98, c++03, c++11, c++14, c++17, c++2a
|
2015-10-15 04:44:44 +08:00
|
|
|
|
|
|
|
Change the standard version used when building the tests.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: libcxx_site_config=<path/to/lit.site.cfg>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Specify the site configuration to use when running the tests. This option
|
2017-05-10 07:47:20 +08:00
|
|
|
overrides the environment variable LIBCXX_SITE_CONFIG.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: cxx_headers=<path/to/headers>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2016-10-12 08:00:37 +08:00
|
|
|
Specify the c++ standard library headers that are tested. By default the
|
|
|
|
headers in the source tree are used.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: cxx_library_root=<path/to/lib/>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2016-04-20 12:17:39 +08:00
|
|
|
Specify the directory of the libc++ library to be tested. By default the
|
|
|
|
library folder of the build directory is used. This option cannot be used
|
2016-12-24 03:09:14 +08:00
|
|
|
when use_system_cxx_lib is provided.
|
2016-04-20 12:17:39 +08:00
|
|
|
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: cxx_runtime_root=<path/to/lib/>
|
2016-04-20 12:17:39 +08:00
|
|
|
|
|
|
|
Specify the directory of the libc++ library to use at runtime. This directory
|
|
|
|
is not added to the linkers search path. This can be used to compile tests
|
|
|
|
against one version of libc++ and run them using another. The default value
|
2018-12-15 02:19:14 +08:00
|
|
|
for this option is `cxx_library_root`.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
2016-12-24 03:09:14 +08:00
|
|
|
.. option:: use_system_cxx_lib=<bool>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
**Default**: False
|
|
|
|
|
|
|
|
Enable or disable testing against the installed version of libc++ library.
|
|
|
|
Note: This does not use the installed headers.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: use_lit_shell=<bool>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Enable or disable the use of LIT's internal shell in ShTests. If the
|
|
|
|
environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
|
|
|
|
the default value. Otherwise the default value is True on Windows and False
|
|
|
|
on every other platform.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: compile_flags="<list-of-args>"
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Specify additional compile flags as a space delimited string.
|
|
|
|
Note: This options should not be used to change the standard version used.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: link_flags="<list-of-args>"
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Specify additional link flags as a space delimited string.
|
|
|
|
|
2016-10-14 14:15:27 +08:00
|
|
|
.. option:: debug_level=<level>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
**Values**: 0, 1
|
|
|
|
|
|
|
|
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
|
|
|
|
assertions and debugging of iterator misuse.
|
|
|
|
|
|
|
|
.. option:: use_sanitizer=<sanitizer name>
|
|
|
|
|
|
|
|
**Values**: Memory, MemoryWithOrigins, Address, Undefined
|
|
|
|
|
|
|
|
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
|
|
|
|
building libc++ then that sanitizer will be used by default.
|
|
|
|
|
|
|
|
.. option:: color_diagnostics
|
|
|
|
|
|
|
|
Enable the use of colorized compile diagnostics. If the color_diagnostics
|
|
|
|
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
|
|
|
|
present then color diagnostics will be enabled.
|
|
|
|
|
2019-02-06 03:50:47 +08:00
|
|
|
.. option:: llvm_unwinder
|
|
|
|
|
|
|
|
Enable the use of LLVM unwinder instead of libgcc.
|
|
|
|
|
|
|
|
.. option:: builtins_library
|
|
|
|
|
|
|
|
Path to the builtins library to use instead of libgcc.
|
|
|
|
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Environment Variables
|
|
|
|
---------------------
|
|
|
|
|
2016-05-05 16:12:25 +08:00
|
|
|
.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
Specify the site configuration to use when running the tests.
|
2016-09-16 11:47:53 +08:00
|
|
|
Also see `libcxx_site_config`.
|
2015-08-23 03:40:49 +08:00
|
|
|
|
|
|
|
.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
|
|
|
|
|
|
|
|
If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
|
|
|
|
to use color diagnostic outputs from the compiler.
|
2016-09-16 11:47:53 +08:00
|
|
|
Also see `color_diagnostics`.
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
|
2020-04-03 05:14:45 +08:00
|
|
|
Writing Tests
|
|
|
|
-------------
|
|
|
|
|
|
|
|
When writing tests for the libc++ test suite, you should follow a few guidelines.
|
|
|
|
This will ensure that your tests can run on a wide variety of hardware and under
|
|
|
|
a wide variety of configurations. We have several unusual configurations such as
|
|
|
|
building the tests on one host but running them on a different host, which add a
|
|
|
|
few requirements to the test suite. Here's some stuff you should know:
|
|
|
|
|
|
|
|
- All tests are run in a temporary directory that is unique to that test and
|
|
|
|
cleaned up after the test is done.
|
|
|
|
- When a test needs data files as inputs, these data files can be saved in the
|
|
|
|
repository (when reasonable) and referrenced by the test as
|
|
|
|
``// FILE_DEPENDENCIES: <path-to-dependencies>``. Copies of these files or
|
|
|
|
directories will be made available to the test in the temporary directory
|
|
|
|
where it is run.
|
|
|
|
- You should never hardcode a path from the build-host in a test, because that
|
|
|
|
path will not necessarily be available on the host where the tests are run.
|
|
|
|
- You should try to reduce the runtime dependencies of each test to the minimum.
|
|
|
|
For example, requiring Python to run a test is bad, since Python is not
|
|
|
|
necessarily available on all devices we may want to run the tests on (even
|
|
|
|
though supporting Python is probably trivial for the build-host).
|
|
|
|
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
Benchmarks
|
|
|
|
==========
|
|
|
|
|
|
|
|
Libc++ contains benchmark tests separately from the test of the test suite.
|
|
|
|
The benchmarks are written using the `Google Benchmark`_ library, a copy of which
|
|
|
|
is stored in the libc++ repository.
|
|
|
|
|
|
|
|
For more information about using the Google Benchmark library see the
|
|
|
|
`official documentation <https://github.com/google/benchmark>`_.
|
|
|
|
|
|
|
|
.. _`Google Benchmark`: https://github.com/google/benchmark
|
|
|
|
|
|
|
|
Building Benchmarks
|
|
|
|
-------------------
|
|
|
|
|
2016-08-30 03:50:49 +08:00
|
|
|
The benchmark tests are not built by default. The benchmarks can be built using
|
|
|
|
the ``cxx-benchmarks`` target.
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
|
|
|
|
An example build would look like:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ cd build
|
2016-08-30 03:50:49 +08:00
|
|
|
$ cmake [options] <path to libcxx sources>
|
|
|
|
$ make cxx-benchmarks
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
|
|
|
|
This will build all of the benchmarks under ``<libcxx-src>/benchmarks`` to be
|
|
|
|
built against the just-built libc++. The compiled tests are output into
|
|
|
|
``build/benchmarks``.
|
|
|
|
|
|
|
|
The benchmarks can also be built against the platforms native standard library
|
|
|
|
using the ``-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON`` CMake option. This
|
|
|
|
is useful for comparing the performance of libc++ to other standard libraries.
|
|
|
|
The compiled benchmarks are named ``<test>.libcxx.out`` if they test libc++ and
|
|
|
|
``<test>.native.out`` otherwise.
|
|
|
|
|
|
|
|
Also See:
|
|
|
|
|
|
|
|
* :ref:`Building Libc++ <build instructions>`
|
|
|
|
* :ref:`CMake Options`
|
|
|
|
|
|
|
|
Running Benchmarks
|
|
|
|
------------------
|
|
|
|
|
|
|
|
The benchmarks must be run manually by the user. Currently there is no way
|
|
|
|
to run them as part of the build.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ cd build/benchmarks
|
2016-08-30 03:50:49 +08:00
|
|
|
$ make cxx-benchmarks
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
$ ./algorithms.libcxx.out # Runs all the benchmarks
|
|
|
|
$ ./algorithms.libcxx.out --benchmark_filter=BM_Sort.* # Only runs the sort benchmarks
|
|
|
|
|
|
|
|
For more information about running benchmarks see `Google Benchmark`_.
|