[Lldb-commits] [lldb] 8ee2257 - [lldb/Test] Fix missing yaml2obj in Xcode standalone build.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 10 21:35:03 PDT 2020
Author: Jonas Devlieghere
Date: 2020-07-10T21:34:56-07:00
New Revision: 8ee225744f109b19e7d2412cbc50d4586991d8cf
URL: https://github.com/llvm/llvm-project/commit/8ee225744f109b19e7d2412cbc50d4586991d8cf
DIFF: https://github.com/llvm/llvm-project/commit/8ee225744f109b19e7d2412cbc50d4586991d8cf.diff
LOG: [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.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/dotest_args.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/test/API/CMakeLists.txt
lldb/test/API/lit.cfg.py
lldb/test/API/lit.site.cfg.py.in
lldb/utils/lldb-dotest/CMakeLists.txt
lldb/utils/lldb-dotest/lldb-dotest.in
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index f05152253c75..ca2786446300 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -57,6 +57,9 @@
# 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
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index f9975b27c475..8238168d0fb6 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -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)')
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index ff2ac5a47ea5..d6f59efdf28b 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -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
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index ddb79de0ab32..29561d4794be 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1633,20 +1633,6 @@ def findBuiltClang(self):
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 @@ def yaml2obj(self, yaml_path, obj_path):
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(
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 9aad9fc750ca..34f3522c8dfe 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -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(
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 632d883e0da9..57e7509a9f7e 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -182,6 +182,9 @@ def find_python_interpreter():
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]
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index e97f867b265b..866dc1675e7c 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -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")
diff --git a/lldb/utils/lldb-dotest/CMakeLists.txt b/lldb/utils/lldb-dotest/CMakeLists.txt
index 0278c370f7fe..0ef60c142761 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -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(
diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in b/lldb/utils/lldb-dotest/lldb-dotest.in
index 36d5fd38cc6d..ee0ea6dff748 100755
--- a/lldb/utils/lldb-dotest/lldb-dotest.in
+++ b/lldb/utils/lldb-dotest/lldb-dotest.in
@@ -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":
More information about the lldb-commits
mailing list