[lldb][test] Prevent infinite loop while looking for use_lldb_suite_root.py.
authorJordan Rupprecht <rupprecht@google.com>
Wed, 15 Jul 2020 16:16:30 +0000 (09:16 -0700)
committerJordan Rupprecht <rupprecht@google.com>
Wed, 15 Jul 2020 16:16:30 +0000 (09:16 -0700)
commitcf3f100fcbf94af499501140590b322b4985c1a3
tree0974a50c5ff49efb52c1a4a1210b7818eb0f28fc
parent7ebb10d46a8d43af0fdafe0d9766e8bdca4d3ec5
[lldb][test] Prevent infinite loop while looking for use_lldb_suite_root.py.

Several scripts (two copies of use_lldb_suite.py, and an __init__.py) look for use_lldb_suite_root.py by checking parent directories. If for some reason it doesn't exist, it keeps checking parent directories until it finds it.

However, this only breaks when the parent directory is None, but at least on Linux, dirname('/') == '/', so this will never be None.

This changes the lookup to stop if the dirname(lldb_root) is unchanged. This was previously fixed in 67f6d842fab6d3ac8c949721be8e131cf6b17578, but only in one copy of this script.

Additionally, this makes the failure mode more visible -- if the root is not found, it complains loudly instead of silently failing, and having later modules that need lldb_root fail.

Differential Revision: https://reviews.llvm.org/D83840
lldb/packages/Python/lldbsuite/__init__.py
lldb/scripts/use_lldb_suite.py
lldb/test/API/use_lldb_suite.py