xref: /openbsd-src/gnu/llvm/lldb/packages/Python/lldbsuite/__init__.py (revision 24bb5fcea3ed904bc467217bdaadb5dfc618d5bf)
1# Module level initialization for the `lldbsuite` module.
2
3import inspect
4import os
5import sys
6
7
8def find_lldb_root():
9    lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
10    while True:
11        lldb_root = os.path.dirname(lldb_root)
12        if lldb_root is None:
13            return None
14
15        test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
16        if os.path.isfile(test_path):
17            return lldb_root
18    return None
19
20# lldbsuite.lldb_root refers to the root of the git/svn source checkout
21lldb_root = find_lldb_root()
22
23# lldbsuite.lldb_test_src_root refers to the root of the python test case tree
24# (i.e. the actual unit tests).
25lldb_test_root = os.path.join(lldb_root, "test", "API")
26