[Lldb-commits] [lldb] 98d9f2d - [lldb/test] Reduce API test tools configuration boilerplate
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 5 00:01:47 PST 2021
Author: Pavel Labath
Date: 2021-02-05T08:44:08+01:00
New Revision: 98d9f2dcaca0c9fe64616fcca882e45473cf6dd1
URL: https://github.com/llvm/llvm-project/commit/98d9f2dcaca0c9fe64616fcca882e45473cf6dd1
DIFF: https://github.com/llvm/llvm-project/commit/98d9f2dcaca0c9fe64616fcca882e45473cf6dd1.diff
LOG: [lldb/test] Reduce API test tools configuration boilerplate
Replace the dotest command line options and various cmake variables,
which are used for passing the locations of llvm tools to the API tests
with a single variable, which points to the directory these tools are
placed in. Besides reducing repetition, this also makes things more
similar to how "normal" llvm tests are configured.
Differential Revision: https://reviews.llvm.org/D95261
Added:
Modified:
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/dotest_args.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/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index b8bfbab7b1f0..62508a144972 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -29,6 +29,7 @@
import os
import platform
import re
+import shutil
import signal
import subprocess
import sys
@@ -272,21 +273,13 @@ def parseOptionsAndInitTestdirs():
elif platform_system == 'Darwin':
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:
- configuration.filecheck = os.path.abspath(args.filecheck)
-
- if args.yaml2obj:
- configuration.yaml2obj = os.path.abspath(args.yaml2obj)
+ if args.llvm_tools_dir:
+ configuration.filecheck = shutil.which("FileCheck", path=args.llvm_tools_dir)
+ configuration.yaml2obj = shutil.which("yaml2obj", path=args.llvm_tools_dir)
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)')
+ logging.warning('(Double-check the --llvm-tools-dir argument to dotest.py)')
if args.channels:
lldbtest_config.channels = args.channels
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index c77f4c2fb140..4774ce352fc2 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -51,8 +51,8 @@ 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.'))
+ group.add_argument('--llvm-tools-dir', metavar='dir', dest='llvm_tools_dir',
+ help=textwrap.dedent('The location of llvm tools used for testing (yaml2obj, FileCheck, etc.).'))
# Test filtering options
group = parser.add_argument_group('Test filtering options')
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 2f2ced1edf6b..9d39a7cc21ee 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -43,10 +43,7 @@ set(LLDB_TEST_COMMON_ARGS
# Set the path to the default lldb test executable.
set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}")
-# 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}")
@@ -57,8 +54,6 @@ endif()
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
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.")
@@ -141,8 +136,6 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
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}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_SERVER "${LLDB_TEST_SERVER}")
# Remaining ones must be paths to the provided LLVM build-tree.
@@ -170,8 +163,6 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_BUILD_DI
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
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}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_TEST_SERVER "${LLDB_TEST_SERVER}")
# Configure the API test suite.
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index aa631926e6b1..08e2dcc1ef80 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -208,11 +208,8 @@ def delete_module_cache(path):
if is_configured('dsymutil'):
dotest_cmd += ['--dsymutil', config.dsymutil]
-if is_configured('filecheck'):
- dotest_cmd += ['--filecheck', config.filecheck]
-
-if is_configured('yaml2obj'):
- dotest_cmd += ['--yaml2obj', config.yaml2obj]
+if is_configured('llvm_tools_dir'):
+ dotest_cmd += ['--llvm-tools-dir', config.llvm_tools_dir]
if is_configured('server'):
dotest_cmd += ['--server', config.server]
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index 86f135b39ed0..5c014b52d3fa 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -29,8 +29,6 @@ config.lldb_executable = '@LLDB_TEST_EXECUTABLE@'
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@'
config.server = '@LLDB_TEST_SERVER@'
# The API tests use their own module caches.
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
@@ -57,9 +55,6 @@ try:
config.lldb_executable = config.lldb_executable % lit_config.params
config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params
config.test_compiler = config.test_compiler % lit_config.params
- config.dsymutil = config.dsymutil % lit_config.params
- config.filecheck = config.filecheck % lit_config.params
- config.yaml2obj = config.yaml2obj % lit_config.params
config.server = config.server % lit_config.params
config.lldb_framework_dir = config.lldb_framework_dir % lit_config.params
config.dotest_args_str = config.dotest_args_str % lit_config.params
diff --git a/lldb/utils/lldb-dotest/CMakeLists.txt b/lldb/utils/lldb-dotest/CMakeLists.txt
index 1001fbf04ebe..6a5b3993d780 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -26,8 +26,6 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
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}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_SERVER_CONFIGURED "${LLDB_TEST_SERVER}")
# Remaining ones must be paths to the provided LLVM build-tree.
@@ -40,10 +38,9 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
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_TEST_SERVER_CONFIGURED "${LLDB_TEST_SERVER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
+ string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLVM_TOOLS_DIR_CONFIGURED "${LLVM_TOOLS_BINARY_DIR}")
else()
# Single-configuration generator like Ninja.
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
@@ -53,10 +50,9 @@ if(LLDB_BUILT_STANDALONE)
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
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}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_SERVER_CONFIGURED "${LLDB_TEST_SERVER}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
+ string(REPLACE ${CMAKE_CFG_INTDIR} "." LLVM_TOOLS_DIR_CONFIGURED "${LLVM_TOOLS_BINARY_DIR}")
endif()
configure_file(
@@ -74,10 +70,9 @@ elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
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_TEST_SERVER_CONFIGURED "${LLDB_TEST_SERVER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
+ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_TOOLS_DIR_CONFIGURED "${LLVM_TOOLS_BINARY_DIR}")
configure_file(
lldb-dotest.in
@@ -92,10 +87,9 @@ else()
set(LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
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_TEST_SERVER_CONFIGURED "${LLDB_TEST_SERVER}")
set(LLDB_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
+ set(LLVM_TOOLS_DIR_CONFIGURED "${LLVM_TOOLS_BINARY_DIR}")
configure_file(
lldb-dotest.in
diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in b/lldb/utils/lldb-dotest/lldb-dotest.in
index 8d4e27be6faf..580b97af2a23 100755
--- a/lldb/utils/lldb-dotest/lldb-dotest.in
+++ b/lldb/utils/lldb-dotest/lldb-dotest.in
@@ -8,13 +8,12 @@ arch = '@LLDB_TEST_ARCH@'
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@'
server = '@LLDB_TEST_SERVER_CONFIGURED@'
lldb_build_dir = '@LLDB_TEST_BUILD_DIRECTORY_CONFIGURED@'
lldb_build_intel_pt = "@LLDB_BUILD_INTEL_PT@"
lldb_framework_dir = "@LLDB_FRAMEWORK_DIR_CONFIGURED@"
lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
+llvm_tools_dir = "@LLVM_TOOLS_DIR_CONFIGURED@"
if __name__ == '__main__':
wrapper_args = sys.argv[1:]
@@ -27,9 +26,8 @@ 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])
+ cmd.extend(['--llvm-tools-dir', llvm_tools_dir])
if server:
cmd.extend(['--server', server])
if lldb_framework_dir:
More information about the lldb-commits
mailing list