1af383ff7SZachary Turner# Module level initialization for the `lldbsuite` module. 2af383ff7SZachary Turner 3af383ff7SZachary Turnerimport inspect 4af383ff7SZachary Turnerimport os 5af383ff7SZachary Turnerimport sys 6af383ff7SZachary Turner 7b9c1b51eSKate Stone 8af383ff7SZachary Turnerdef find_lldb_root(): 9fcb0d816SJordan Rupprecht lldb_root = os.path.realpath( 10*2238dcc3SJonas Devlieghere os.path.dirname(inspect.getfile(inspect.currentframe())) 11*2238dcc3SJonas Devlieghere ) 12af383ff7SZachary Turner while True: 13cf3f100fSJordan Rupprecht parent = os.path.dirname(lldb_root) 14cf3f100fSJordan Rupprecht if parent == lldb_root: # dirname('/') == '/' 15cf3f100fSJordan Rupprecht raise Exception("use_lldb_suite_root.py not found") 16cf3f100fSJordan Rupprecht lldb_root = parent 17af383ff7SZachary Turner 184c152690SZachary Turner test_path = os.path.join(lldb_root, "use_lldb_suite_root.py") 19af383ff7SZachary Turner if os.path.isfile(test_path): 20af383ff7SZachary Turner return lldb_root 21af383ff7SZachary Turner 22*2238dcc3SJonas Devlieghere 23af383ff7SZachary Turner# lldbsuite.lldb_root refers to the root of the git/svn source checkout 24af383ff7SZachary Turnerlldb_root = find_lldb_root() 251d3b5a3aSTodd Fiala 2625675d4eSJordan Rupprecht# lldbsuite.lldb_test_src_root refers to the root of the python test case tree 2725675d4eSJordan Rupprecht# (i.e. the actual unit tests). 2899451b44SJordan Rupprechtlldb_test_root = os.path.join(lldb_root, "test", "API") 29