[lldb/tests] Correctly configure the lldb dotest arguments

Summary:
When the generator used for CMake is a multi-configuration generator (such as VS), the arguments passed to dotest are not currently configured correctly. There are a couple of issues:
1) The per-configuration files are all generated for the same configuration since the for loop overwrites the properties
2) Not all of the parameters are configured in the lit cfg, so they end up with %(build_mode)s as configuration and they point to non-existent paths

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, asmith

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74093
This commit is contained in:
Stella Stamenova 2020-02-06 10:27:10 -08:00
parent 65f0785fff
commit d53c8c6af5
3 changed files with 55 additions and 39 deletions

View File

@ -46,6 +46,10 @@ try:
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
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.dotest_args_str = config.dotest_args_str % lit_config.params
except KeyError as e:
key, = e.args

View File

@ -15,33 +15,35 @@ if(LLDB_BUILT_STANDALONE)
foreach(config_type ${config_types})
# In paths to our build-tree, replace CMAKE_CFG_INTDIR with our actual configuration names.
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
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_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
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}")
# Remaining ones must be paths to the provided LLVM build-tree.
if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
# Multi-configuration generator like Xcode (with a matching config).
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
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_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
else()
# Single-configuration generator like Ninja.
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} "." LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
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_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
endif()
configure_file(
@ -51,20 +53,31 @@ if(LLDB_BUILT_STANDALONE)
endforeach()
elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
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_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
configure_file(
lldb-dotest.in
${LLDB_DOTEST_DIR}/lldb-dotest
${LLDB_DOTEST_DIR_CONFIGURED}/lldb-dotest
)
endforeach()
else()
set(LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
set(LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
set(LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
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_LIBS_DIR_CONFIGURED "${LLDB_LIBS_DIR}")
configure_file(
lldb-dotest.in
${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest

View File

@ -2,16 +2,15 @@
import subprocess
import sys
dotest_path = '@LLDB_SOURCE_DIR@/test/API/dotest.py'
build_dir = '@LLDB_TEST_BUILD_DIRECTORY@'
dotest_args_str = '@LLDB_DOTEST_ARGS@'
dotest_path = '@LLDB_SOURCE_DIR_CONFIGURED@/test/API/dotest.py'
build_dir = '@LLDB_TEST_BUILD_DIRECTORY_CONFIGURED@'
dotest_args_str = '@LLDB_DOTEST_ARGS_CONFIGURED@'
arch = '@LLDB_TEST_ARCH@'
executable = '@LLDB_TEST_EXECUTABLE@'
compiler = '@LLDB_TEST_COMPILER@'
dsymutil = '@LLDB_TEST_DSYMUTIL@'
filecheck = '@LLDB_TEST_FILECHECK@'
lldb_libs_dir = "@LLDB_LIBS_DIR@"
executable = '@LLDB_TEST_EXECUTABLE_CONFIGURED@'
compiler = '@LLDB_TEST_COMPILER_CONFIGURED@'
dsymutil = '@LLDB_TEST_DSYMUTIL_CONFIGURED@'
filecheck = '@LLDB_TEST_FILECHECK_CONFIGURED@'
lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
if __name__ == '__main__':
wrapper_args = sys.argv[1:]