| 1 |
# Module level initialization for the `lldbsuite` module. |
| 2 |
|
| 3 |
import inspect |
| 4 |
import os |
| 5 |
import sys |
| 6 |
|
| 7 |
|
| 8 |
def find_lldb_root(): |
| 9 |
lldb_root = os.path.realpath( |
| 10 |
os.path.dirname(inspect.getfile(inspect.currentframe())) |
| 11 |
) |
| 12 |
while True: |
| 13 |
parent = os.path.dirname(lldb_root) |
| 14 |
if parent == lldb_root: # dirname('/') == '/' |
| 15 |
raise Exception("use_lldb_suite_root.py not found") |
| 16 |
lldb_root = parent |
| 17 |
|
| 18 |
test_path = os.path.join(lldb_root, "use_lldb_suite_root.py") |
| 19 |
if os.path.isfile(test_path): |
| 20 |
return lldb_root |
| 21 |
|
| 22 |
|
| 23 |
# lldbsuite.lldb_root refers to the root of the git/svn source checkout |
| 24 |
lldb_root = find_lldb_root() |
| 25 |
|
| 26 |
# lldbsuite.lldb_test_src_root refers to the root of the python test case tree |
| 27 |
# (i.e. the actual unit tests). |
| 28 |
lldb_test_root = os.path.join(lldb_root, "test", "API") |