1061da546Spatrick# Module level initialization for the `lldbsuite` module. 2061da546Spatrick 3061da546Spatrickimport inspect 4061da546Spatrickimport os 5061da546Spatrickimport sys 6061da546Spatrick 7061da546Spatrick 8061da546Spatrickdef find_lldb_root(): 9*be691f3bSpatrick lldb_root = os.path.realpath( 10*be691f3bSpatrick os.path.dirname(inspect.getfile(inspect.currentframe()))) 11061da546Spatrick while True: 12*be691f3bSpatrick parent = os.path.dirname(lldb_root) 13*be691f3bSpatrick if parent == lldb_root: # dirname('/') == '/' 14*be691f3bSpatrick raise Exception("use_lldb_suite_root.py not found") 15*be691f3bSpatrick lldb_root = parent 16061da546Spatrick 17061da546Spatrick test_path = os.path.join(lldb_root, "use_lldb_suite_root.py") 18061da546Spatrick if os.path.isfile(test_path): 19061da546Spatrick return lldb_root 20061da546Spatrick 21061da546Spatrick# lldbsuite.lldb_root refers to the root of the git/svn source checkout 22061da546Spatricklldb_root = find_lldb_root() 23061da546Spatrick 24dda28197Spatrick# lldbsuite.lldb_test_src_root refers to the root of the python test case tree 25dda28197Spatrick# (i.e. the actual unit tests). 26dda28197Spatricklldb_test_root = os.path.join(lldb_root, "test", "API") 27