2013-03-01 07:11:46 +08:00
|
|
|
function(add_python_test_target name test_script args comment)
|
|
|
|
set(PYTHON_TEST_COMMAND
|
|
|
|
${PYTHON_EXECUTABLE}
|
|
|
|
${test_script}
|
|
|
|
${args}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(${name}
|
|
|
|
COMMAND ${PYTHON_TEST_COMMAND} ${ARG_DEFAULT_ARGS}
|
|
|
|
COMMENT "${comment}"
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
2014-07-19 06:46:22 +08:00
|
|
|
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
|
|
|
|
string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
|
|
|
|
endif()
|
2013-03-07 08:50:54 +08:00
|
|
|
|
2014-08-01 05:07:41 +08:00
|
|
|
# The default architecture with which to compile test executables is the default LLVM target
|
|
|
|
# architecture, which itself defaults to the host architecture.
|
|
|
|
string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH)
|
|
|
|
if( LLDB_DEFAULT_TEST_ARCH STREQUAL "host" )
|
|
|
|
string(REGEX MATCH "^[^-]*" LLDB_DEFAULT_TEST_ARCH ${LLVM_HOST_TRIPLE})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Allow the user to override the default by setting LLDB_TEST_ARCH
|
|
|
|
set(LLDB_TEST_ARCH
|
|
|
|
${LLDB_DEFAULT_TEST_ARCH}
|
2014-08-02 00:57:46 +08:00
|
|
|
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64")
|
2014-08-01 05:07:41 +08:00
|
|
|
|
|
|
|
# Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
|
|
|
|
set(LLDB_TEST_USER_ARGS
|
|
|
|
-C ${LLDB_TEST_COMPILER}
|
|
|
|
CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
|
|
|
|
|
|
|
|
set(LLDB_TEST_COMMON_ARGS
|
|
|
|
--arch=${LLDB_TEST_ARCH}
|
2013-03-01 07:11:46 +08:00
|
|
|
--executable
|
2014-06-03 01:49:35 +08:00
|
|
|
${CMAKE_BINARY_DIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}
|
2013-03-01 07:11:46 +08:00
|
|
|
-s
|
2014-08-01 05:07:41 +08:00
|
|
|
${CMAKE_BINARY_DIR}/lldb-test-traces
|
2013-05-14 05:41:35 +08:00
|
|
|
-u CXXFLAGS
|
|
|
|
-u CFLAGS
|
2013-03-01 07:11:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_python_test_target(check-lldb-single
|
|
|
|
${LLDB_SOURCE_DIR}/test/dotest.py
|
2014-08-01 05:07:41 +08:00
|
|
|
"${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
|
|
|
|
"Testing LLDB with args: ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
|
2013-03-01 07:11:46 +08:00
|
|
|
)
|
|
|
|
|
2014-08-01 05:07:41 +08:00
|
|
|
set(LLDB_DOSEP_ARGS -o;\"-q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}\")
|
2013-03-01 07:11:46 +08:00
|
|
|
|
|
|
|
# If tests crash cause LLDB to crash, or things are otherwise unstable, or if machine-parsable
|
|
|
|
# output is desired (i.e. in continuous integration contexts) check-lldb-sep is a better target.
|
|
|
|
add_python_test_target(check-lldb
|
2014-07-22 00:16:31 +08:00
|
|
|
${LLDB_SOURCE_DIR}/test/dosep.py
|
2013-03-01 07:11:46 +08:00
|
|
|
"${LLDB_DOSEP_ARGS}"
|
2013-03-06 05:59:12 +08:00
|
|
|
"Testing LLDB (with a separate subprocess per test)"
|
2013-03-01 07:11:46 +08:00
|
|
|
)
|