Skip to content

[lit] Detect lldb by checking both for lldb_build_root and that that root contains an lldb exec. #32643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def get_simulator_command(run_os, run_cpu, sdk_path):

def get_lldb_python_path(lldb_build_root):
lldb_path = os.path.join(lldb_build_root, 'bin', 'lldb')
if not os.access(lldb_path, os.F_OK):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this is preferable compared to something like os.path.exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I just did it this way out of habit.

return None
return subprocess.check_output([lldb_path, "-P"]).rstrip()

###
Expand Down Expand Up @@ -1918,9 +1920,14 @@ config.substitutions.append(('%raw-FileCheck', pipes.quote(config.filecheck)))
config.substitutions.append(('%import-libdispatch', getattr(config, 'import_libdispatch', '')))

if config.lldb_build_root != "":
config.available_features.add('lldb')
lldb_python_path = get_lldb_python_path(config.lldb_build_root)
config.substitutions.append(('%lldb-python-path', lldb_python_path))
if lldb_python_path == None:
lit_config.warning("""
Specified lldb_build_root, but could not find lldb in that build root
""")
else:
config.available_features.add('lldb')
config.substitutions.append(('%lldb-python-path', lldb_python_path))

# Disable randomized hash seeding by default. Tests need to manually opt in to
# random seeds by unsetting the SWIFT_DETERMINISTIC_HASHING environment
Expand Down