[lldb/Test] Fix missing yaml2obj in Xcode standalone build.

Rather than trying to find the yaml2obj from dotest we should pass it in
like we do for dsymutil and FileCheck.
This commit is contained in:
Jonas Devlieghere 2020-07-10 21:14:06 -07:00
parent 849d4405f5
commit 8ee225744f
9 changed files with 38 additions and 21 deletions

View File

@ -57,6 +57,9 @@ settings = [('target.prefer-dynamic-value', 'no-dynamic-values')]
# Path to the FileCheck testing tool. Not optional.
filecheck = None
# Path to the yaml2obj tool. Not optional.
yaml2obj = None
# The arch might dictate some specific CFLAGS to be passed to the toolchain to build
# the inferior programs. The global variable cflags_extras provides a hook to do
# just that.
@ -163,6 +166,13 @@ def get_filecheck_path():
if filecheck and os.path.lexists(filecheck):
return filecheck
def get_yaml2obj_path():
"""
Get the path to the yaml2obj tool.
"""
if yaml2obj and os.path.lexists(yaml2obj):
return yaml2obj
def is_reproducer_replay():
"""
Returns true when dotest is being replayed from a reproducer. Never use

View File

@ -272,13 +272,17 @@ def parseOptionsAndInitTestdirs():
configuration.dsymutil = seven.get_command_output(
'xcrun -find -toolchain default dsymutil')
# The lldb-dotest script produced by the CMake build passes in a path to a
# working FileCheck and yaml2obj binary. So does one specific Xcode
# project target. However, when invoking dotest.py directly, a valid
# --filecheck and --yaml2obj option needs to be given.
if args.filecheck:
# The lldb-dotest script produced by the CMake build passes in a path
# to a working FileCheck binary. So does one specific Xcode project
# target. However, when invoking dotest.py directly, a valid --filecheck
# option needs to be given.
configuration.filecheck = os.path.abspath(args.filecheck)
if args.yaml2obj:
configuration.yaml2obj = os.path.abspath(args.yaml2obj)
if not configuration.get_filecheck_path():
logging.warning('No valid FileCheck executable; some tests may fail...')
logging.warning('(Double-check the --filecheck argument to dotest.py)')

View File

@ -51,7 +51,7 @@ def create_parser():
suggestions: do not lump the "-A arch1 -A arch2" together such that the -E option applies to only one of the architectures'''))
group.add_argument('--dsymutil', metavar='dsymutil', dest='dsymutil', help=textwrap.dedent('Specify which dsymutil to use.'))
group.add_argument('--yaml2obj', metavar='yaml2obj', dest='yaml2obj', help=textwrap.dedent('Specify which yaml2obj binary to use.'))
group.add_argument('--filecheck', metavar='filecheck', dest='filecheck', help=textwrap.dedent('Specify which FileCheck binary to use.'))
# Test filtering options

View File

@ -1633,20 +1633,6 @@ class Base(unittest2.TestCase):
return os.environ["CC"]
def findYaml2obj(self):
"""
Get the path to the yaml2obj executable, which can be used to create
test object files from easy to write yaml instructions.
Throws an Exception if the executable cannot be found.
"""
# Tries to find yaml2obj at the same folder as clang
clang_dir = os.path.dirname(self.findBuiltClang())
path = distutils.spawn.find_executable("yaml2obj", clang_dir)
if path is not None:
return path
raise Exception("yaml2obj executable not found")
def yaml2obj(self, yaml_path, obj_path):
"""
@ -1654,8 +1640,10 @@ class Base(unittest2.TestCase):
Throws subprocess.CalledProcessError if the object could not be created.
"""
yaml2obj = self.findYaml2obj()
command = [yaml2obj, "-o=%s" % obj_path, yaml_path]
yaml2obj_bin = configuration.get_yaml2obj_path()
if not yaml2obj_bin:
self.assertTrue(False, "No valid FileCheck executable specified")
command = [yaml2obj_bin, "-o=%s" % obj_path, yaml_path]
system([command])
def getBuildFlags(

View File

@ -49,6 +49,7 @@ set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXEC
# Set the paths to default llvm tools.
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
set(LLDB_DEFAULT_TEST_FILECHECK "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
set(LLDB_DEFAULT_TEST_YAML2OBJ "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/yaml2obj${CMAKE_EXECUTABLE_SUFFIX}")
if (TARGET clang)
set(LLDB_DEFAULT_TEST_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
@ -60,6 +61,7 @@ set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb exec
set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH "FileCheck used for testing purposes")
set(LLDB_TEST_YAML2OBJ "${LLDB_DEFAULT_TEST_YAML2OBJ}" CACHE PATH "yaml2obj used for testing purposes")
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
message(FATAL_ERROR "LLDB test compiler not specified. Tests will not run.")
@ -145,6 +147,7 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_YAML2OBJ "${LLDB_TEST_YAML2OBJ}")
# Remaining ones must be paths to the provided LLVM build-tree.
if(LLVM_CONFIGURATION_TYPES)
@ -172,6 +175,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_EXECUTAB
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_YAML2OBJ "${LLDB_TEST_YAML2OBJ}")
# Configure the API test suite.
configure_lit_site_cfg(

View File

@ -182,6 +182,9 @@ if config.dsymutil:
if config.filecheck:
dotest_cmd += ['--filecheck', config.filecheck]
if config.yaml2obj:
dotest_cmd += ['--yaml2obj', config.yaml2obj]
if config.lldb_libs_dir:
dotest_cmd += ['--lldb-libs-dir', config.lldb_libs_dir]

View File

@ -30,6 +30,7 @@ config.test_arch = '@LLDB_TEST_ARCH@'
config.test_compiler = '@LLDB_TEST_COMPILER@'
config.dsymutil = '@LLDB_TEST_DSYMUTIL@'
config.filecheck = '@LLDB_TEST_FILECHECK@'
config.yaml2obj = '@LLDB_TEST_YAML2OBJ@'
# The API tests use their own module caches.
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")

View File

@ -26,6 +26,7 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
# Remaining ones must be paths to the provided LLVM build-tree.
if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
@ -37,6 +38,7 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
else()
# Single-configuration generator like Ninja.
@ -47,6 +49,7 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ_CONFIGURED}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
endif()
@ -65,6 +68,7 @@ elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
configure_file(
@ -80,6 +84,7 @@ else()
set(LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
set(LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
set(LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
set(LLDB_TEST_YAML2OBJ_CONFIGURED "${LLDB_TEST_YAML2OBJ}")
set(LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
configure_file(

View File

@ -10,6 +10,7 @@ executable = '@LLDB_TEST_EXECUTABLE_CONFIGURED@'
compiler = '@LLDB_TEST_COMPILER_CONFIGURED@'
dsymutil = '@LLDB_TEST_DSYMUTIL_CONFIGURED@'
filecheck = '@LLDB_TEST_FILECHECK_CONFIGURED@'
yaml2obj = '@LLDB_TEST_YAML2OBJ_CONFIGURED@'
lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
lldb_build_intel_pt = "@LLDB_BUILD_INTEL_PT@"
@ -24,6 +25,7 @@ if __name__ == '__main__':
cmd.extend(['--executable', executable])
cmd.extend(['--compiler', compiler])
cmd.extend(['--dsymutil', dsymutil])
cmd.extend(['--yaml2obj', yaml2obj])
cmd.extend(['--filecheck', filecheck])
cmd.extend(['--lldb-libs-dir', lldb_libs_dir])
if lldb_build_intel_pt == "1":