[Lldb-commits] [PATCH] D45332: [LIT] Add new LLDB test format

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 5 14:26:18 PDT 2018

zturner added a comment.

I don't think `sys.path` is set up correctly to be able to find the lldbtest package from the `lldb/lit` folder.

These things kind of evolved separately, and the `lldb/lit` folder was created as a place to start iterating on LLVM-style lit / FileCheck tests.  These kind of tests -- by definition -- don't really use the SB API, so no work was ever done to set up paths correctly so that it could write `import lldb` or to re-use any of the other stuff from `packages/Python`.

I'm not sure what the best thing to do is, but usually the canonical structuring is to have the test files in the same tree as the lit configuration.  So perhaps you could put a lit configuration file in `lldb/packages/Python/lldbsuite` and have that be separate from `lldb/lit`, with the goal of eventually (possibly) merging them.  Then have a separate CMake target so you'd still have `check-lldb-lit` which goes into the `lldb/lit` directory, and another one like `check-lldb-lit-dotest` which starts from the `lldb/packages/Python/lldbsuite` directory.

On the other hand, if you want to see how `dotest.py` sets up its `sys.path`, have a look at `lldb/test/dotest.py`  The magic is in this `use_lldb_suite` function, which walks backwards through the tree until it finds the root, then dives into the `lldbsuite` folder to manually add it to `sys.path`.



More information about the lldb-commits mailing list