Running individual test cases for LLDB gives error

Hi!
I’m trying to run individual test cases for LLDB commands using:

./bin/llvm-lit ../LLDB/lldb/test/Shell/Commands/command-target-modules-lookup.test -a

But I’m getting the following error:

llvm-lit: /home/talha/Documents/GitHub/LLDB/llvm/utils/lit/lit/TestingConfig.py:151: fatal: unable to parse config file '/home/talha/Documents/GitHub/LLDB/lldb/test/Shell/lit.cfg.py', traceback: Traceback (most recent call last):
  File "/home/talha/Documents/GitHub/LLDB/llvm/utils/lit/lit/TestingConfig.py", line 139, in load_from_path
    exec(compile(data, path, "exec"), cfg_globals, None)
  File "/home/talha/Documents/GitHub/LLDB/lldb/test/Shell/lit.cfg.py", line 23, in <module>
    config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
AttributeError: 'NoneType' object has no attribute 'use_lit_shell'

I’ve no idea why I’m getting this one. Can anyone please guide me weather there’s an issue with my build or it’s something else. Screenshot also attached for reference:

In case, I’ve also tried rebuilding llvm but the issue is same. I’ve used the following flags:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=lld -DLLVM_BUILD_TESTS=true /home/talha/llvm-latest/llvm-project-main/llvm

This does work for me locally.

Can you post the full CMake command you used? Sometimes this happens because there is something wrong with the lit config file in the build dir, and it being None may mean it simply does not exist.

Check if you can do ninja check-lldb-shell as well, sometimes tests will run ok from ninja but not lit. In my experience the Shell tests should work with either.

Another thing to do is remove any pip installed lit you may have. ./bin/llvm-lit should not be picking any of that up, but it’s always a possibility.

1 Like