- Checkout the LLVM sources somewhere persistent, for example /opt/llvm-src.
git clone https://llvm.org/git/llvm.git /opt/llvm-src
-
Create an permanent alias to the LIT test driver. This alias will be how you invoke the tests.
# In ~/.bashrc or similar alias lit="python /opt/llvm-src/utils/lit/lit.py"
-
Checkout the libc++ sources to where you want to test from:
git clone https://llvm.org/git/libcxx.git ~/workspace/libcxx
-
Copy the attached
lit.site.cfg
file to ~/workspace/libcxx/test/lit.site.cfg. -
Edit the lit.site.cfg to your liking. The example i've provided is setup to test a gcc installation under /opt/gcc-tot, so you'll need to change that as appropriate.
-
Run the tests! To do this simply invoke lit passing the test directory or file you want to run. For example:
lit -sv ~/workspace/libcxx/test/std/utilities
As a side note a couple of common LIT options you'll probably want to use:
-
--param=cxx_under_test=<compiler-to-test>
Change the compiler your testing against.
-
--param=std=<std_version>
Change the dialect used during testing, and disable/enable the approprate tests for that dialect.
<std_version>
is one of c++03, c++11, c++14, or c++1z. -
--param=compile_flags=<flags>
Add a list of additional compile flags when running the tests. Hopefully you won't need this.
-
--param=link_flags=<flags>
Add a list of additional link flags when running the tests. Hopefully you won't need this.