Different ways of running lit

What are all the different ways people run lit? I’m doing some refactoring and want to make sure I have all the based covered. Obviously you can use check-llvm. And you can also run llvm-lit.py in your bin directory and point it to your source tree.

What else? Both of the aforementioned methods require running cmake first, is there any use case where someone runs lit without having run cmake first? Or anything else I’m not thinking of?

I often run, from my build tree: “./bin/llvm-lit -v test/DebugInfo/whatever.ll” (where the “test/DebugInfo/whatever.ll” only exists in the source tree, not in the build tree where I’m running the command from)

LNT has some interesting uses of lit.

The lit test suite itself (check-lit) has some interesting ways to invoke lit that might be worth looking at.

I often run, from my build tree: "./bin/llvm-lit -v test/DebugInfo/whatever.ll" (where the "test/DebugInfo/whatever.ll" only exists in the source tree, not in the build tree where I'm running the command from)

I do this a lot too.

@zturner: this is what I was trying to explain on IRC the other day. For whatever reason, this setup is the easier one to get working for a new testsuite, and the `./bin/llvm-lit /abs/path/to/test.ll` one is harder (it can't find the site.cfg for the cases where I've done it).


Maybe tell us what you want to change?

Indeed lit is used in various ways outside of llvm.

libcxx and the llvm test-suite both have a bigger amount of custom python code for their lit tests and break easily when changing lit.

- Matthias

I’m looking at ways of simplifying the lit config files. Currently, almost every lit.cfg and lit.site.cfg.in has a ton of copied code. I kind of understand why this is necessary architecturally now, so now I’m looking at how to break it apart.

For example, every single lit config file has a block of code that looks like this:

Check that the object root is known.

if config.test_exec_root is None:

Otherwise, we haven’t loaded the site specific configuration (the user is

probably trying to run on a test file directly, and either the site

configuration hasn’t been created by the build system, or we are in an

out-of-tree build situation).

Check for ‘lit_site_config’ user parameter, and use that if available.

site_cfg = lit_config.params.get(‘lit_site_config’, None)
if site_cfg and os.path.exists(site_cfg):
lit_config.load_config(config, site_cfg)
raise SystemExit

Try to detect the situation where we are using an out-of-tree build by

looking for ‘llvm-config’.