Skip to content

Commit dfc34ef

Browse files
committed
[dotest] Don't try to guess the lldb binary & python dir.
Now that all supported build systems create a valid dotest.py invocation, we no longer need to guess the location of the lldb binary and Python directory. Differential revision: https://reviews.llvm.org/D66896 llvm-svn: 370234
1 parent a47db71 commit dfc34ef

File tree

1 file changed

+17
-94
lines changed

1 file changed

+17
-94
lines changed

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 17 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -467,28 +467,6 @@ def parseOptionsAndInitTestdirs():
467467
lldbtest_config.codesign_identity = args.codesign_identity
468468

469469

470-
def getXcodeOutputPaths(lldbRootDirectory):
471-
result = []
472-
473-
# These are for xcode build directories.
474-
xcode3_build_dir = ['build']
475-
xcode4_build_dir = ['build', 'lldb', 'Build', 'Products']
476-
477-
configurations = [
478-
['Debug'],
479-
['DebugClang'],
480-
['Release'],
481-
['BuildAndIntegration']]
482-
xcode_build_dirs = [xcode3_build_dir, xcode4_build_dir]
483-
for configuration in configurations:
484-
for xcode_build_dir in xcode_build_dirs:
485-
outputPath = os.path.join(
486-
lldbRootDirectory, *(xcode_build_dir + configuration))
487-
result.append(outputPath)
488-
489-
return result
490-
491-
492470
def setupTestResults():
493471
"""Sets up test results-related objects based on arg settings."""
494472
# Setup the results formatter configuration.
@@ -515,37 +493,6 @@ def setupTestResults():
515493
atexit.register(formatter_spec.cleanup_func)
516494

517495

518-
def getOutputPaths(lldbRootDirectory):
519-
"""
520-
Returns typical build output paths for the lldb executable
521-
522-
lldbDirectory - path to the root of the lldb svn/git repo
523-
"""
524-
result = []
525-
526-
if sys.platform == 'darwin':
527-
result.extend(getXcodeOutputPaths(lldbRootDirectory))
528-
529-
# cmake builds? look for build or build/host folder next to llvm directory
530-
# lldb is located in llvm/tools/lldb so we need to go up three levels
531-
llvmParentDir = os.path.abspath(
532-
os.path.join(
533-
lldbRootDirectory,
534-
os.pardir,
535-
os.pardir,
536-
os.pardir))
537-
result.append(os.path.join(llvmParentDir, 'build', 'bin'))
538-
result.append(os.path.join(llvmParentDir, 'build', 'host', 'bin'))
539-
540-
# some cmake developers keep their build directory beside their lldb
541-
# directory
542-
lldbParentDir = os.path.abspath(os.path.join(lldbRootDirectory, os.pardir))
543-
result.append(os.path.join(lldbParentDir, 'build', 'bin'))
544-
result.append(os.path.join(lldbParentDir, 'build', 'host', 'bin'))
545-
546-
return result
547-
548-
549496
def setupSysPath():
550497
"""
551498
Add LLDB.framework/Resources/Python to the search paths for modules.
@@ -603,14 +550,6 @@ def setupSysPath():
603550
if "LLDB_EXEC" in os.environ:
604551
lldbtest_config.lldbExec = os.environ["LLDB_EXEC"]
605552

606-
if not lldbtest_config.lldbExec:
607-
outputPaths = getOutputPaths(lldbRootDirectory)
608-
for outputPath in outputPaths:
609-
candidatePath = os.path.join(outputPath, 'lldb')
610-
if is_exe(candidatePath):
611-
lldbtest_config.lldbExec = candidatePath
612-
break
613-
614553
if not lldbtest_config.lldbExec:
615554
# Last, check the path
616555
lldbtest_config.lldbExec = which('lldb')
@@ -696,39 +635,23 @@ def setupSysPath():
696635
lldbPythonDir, '..', '..')
697636

698637
if not lldbPythonDir:
699-
if platform.system() == "Darwin":
700-
python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
701-
outputPaths = getXcodeOutputPaths(lldbRootDirectory)
702-
for outputPath in outputPaths:
703-
candidatePath = os.path.join(
704-
outputPath, *python_resource_dir)
705-
if os.path.isfile(
706-
os.path.join(
707-
candidatePath,
708-
init_in_python_dir)):
709-
lldbPythonDir = candidatePath
710-
break
711-
712-
if not lldbPythonDir:
713-
print("lldb.py is not found, some tests may fail.")
714-
else:
715-
print(
716-
"Unable to load lldb extension module. Possible reasons for this include:")
717-
print(" 1) LLDB was built with LLDB_DISABLE_PYTHON=1")
718-
print(
719-
" 2) PYTHONPATH and PYTHONHOME are not set correctly. PYTHONHOME should refer to")
720-
print(
721-
" the version of Python that LLDB built and linked against, and PYTHONPATH")
722-
print(
723-
" should contain the Lib directory for the same python distro, as well as the")
724-
print(" location of LLDB\'s site-packages folder.")
725-
print(
726-
" 3) A different version of Python than that which was built against is exported in")
727-
print(" the system\'s PATH environment variable, causing conflicts.")
728-
print(
729-
" 4) The executable '%s' could not be found. Please check " %
730-
lldbtest_config.lldbExec)
731-
print(" that it exists and is executable.")
638+
print(
639+
"Unable to load lldb extension module. Possible reasons for this include:")
640+
print(" 1) LLDB was built with LLDB_DISABLE_PYTHON=1")
641+
print(
642+
" 2) PYTHONPATH and PYTHONHOME are not set correctly. PYTHONHOME should refer to")
643+
print(
644+
" the version of Python that LLDB built and linked against, and PYTHONPATH")
645+
print(
646+
" should contain the Lib directory for the same python distro, as well as the")
647+
print(" location of LLDB\'s site-packages folder.")
648+
print(
649+
" 3) A different version of Python than that which was built against is exported in")
650+
print(" the system\'s PATH environment variable, causing conflicts.")
651+
print(
652+
" 4) The executable '%s' could not be found. Please check " %
653+
lldbtest_config.lldbExec)
654+
print(" that it exists and is executable.")
732655

733656
if lldbPythonDir:
734657
lldbPythonDir = os.path.normpath(lldbPythonDir)

0 commit comments

Comments
 (0)