LLVM lit testing: is it possible to configure number of threads via `lit.cfg`?

Multi tool use
LLVM lit testing: is it possible to configure number of threads via `lit.cfg`?
I wonder if it's possible to configure the number of threads for testing in a lit.cfg
file.
lit.cfg
lit
offers a command-line flag for specifying the number of threads:
llvm/utils/lit/lit.py -j1 <test directory>
lit
llvm/utils/lit/lit.py -j1 <test directory>
However, I'm not sure how to do this in a lit.cfg
file. I want to force all tests in a subdirectory to be run with -j1
- not sure if this is possible.
lit.cfg
-j1
Edit: for reference, I'm working on the Swift codebase which has a large test suite (4000+ tests) with multiple test subdirectories.
I want to run just one subdirectory with -j1
and the rest with the default number of threads (-j12
for my machine).
-j1
-j12
1 Answer
1
I was wondering about that too a while back, but I don't think there is one because of this line here. Usually, the main project compilation times dwarf the lit
tests execution time.
lit
It is easy to change, but I'd suggest using your build configuration to this (e.g. make
or cmake
). So, make test
could execute something like lit -j $(nproc)
underneath.
make
cmake
make test
lit -j $(nproc)
Edit (after OP update):
I haven't worked with the swift
repo, but maybe you could hack your way around. One thing I could see is that you could influence the LIT_ARGS
cmake
variable with the options you want by appending to it.
swift
LIT_ARGS
cmake
Now to force a single process execution for a specific directory, you may add a lit.local.cfg
that sets the singleProcess flag. This seems to override multi-thread execution:
lit.local.cfg
config.singleProcess = True
nproc
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thanks for the reply! I added some more contextual information to the OP. I'm looking for a way to configure # of threads for a specific test subdirectory. Not sure how to do that cleanly with
nproc
.– Dan Zheng
Jul 3 at 8:41