[Lldb-commits] [lldb] r331463 - [CMake] Unify and relayer testing
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu May 3 09:54:10 PDT 2018
Author: jdevlieghere
Date: Thu May 3 09:54:10 2018
New Revision: 331463
URL: http://llvm.org/viewvc/llvm-project?rev=331463&view=rev
Log:
[CMake] Unify and relayer testing
This patch restructures part of LLDB's testing configuration:
1. I moved the test dependencies up the chain so every dotest dependency
becomes a lit dependency as well. It wouldn't make sense for dotest to
have other dependencies when it's being run by lit. Lit on the other
hand can still specify extra dependencies.
2. I replaced as much generator expressions with variables as possible.
This is consistent with the rest of LLVM and doesn't break generators
that support multiple targets (MSVC, Xcode). This wasn't a problem
before, but now we need to expand the dotest arguments in the lit
configuration and there's only one test suite even with multiple
targets.
3. I moved lldb-dotest into it's own directory under utils since there's
no need anymore for it to located under `test/`.
Differential revision: https://reviews.llvm.org/D46334
Added:
lldb/trunk/utils/lldb-dotest/
lldb/trunk/utils/lldb-dotest/CMakeLists.txt
lldb/trunk/utils/lldb-dotest/lldb-dotest.in
- copied, changed from r331458, lldb/trunk/test/lldb-dotest.in
Removed:
lldb/trunk/test/lldb-dotest.in
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/Suite/lit.site.cfg.in
lldb/trunk/test/CMakeLists.txt
lldb/trunk/tools/debugserver/source/CMakeLists.txt
Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=331463&r1=331462&r2=331463&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu May 3 09:54:10 2018
@@ -85,9 +85,43 @@ if(LLDB_INCLUDE_TESTS)
message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run")
endif()
+ set(LLDB_TEST_DEPS lldb)
+
+ # darwin-debug is an hard dependency for the testsuite.
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ list(APPEND LLDB_TEST_DEPS darwin-debug)
+ endif()
+
+ if(TARGET lldb-server)
+ list(APPEND LLDB_TEST_DEPS lldb-server)
+ endif()
+
+ if(TARGET debugserver)
+ if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY)
+ list(APPEND LLDB_TEST_DEPS debugserver)
+ endif()
+ endif()
+
+ if(TARGET lldb-mi)
+ list(APPEND LLDB_TEST_DEPS lldb-mi)
+ endif()
+
+ if(NOT LLDB_BUILT_STANDALONE)
+ list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil)
+ endif()
+
+ if(TARGET liblldb)
+ list(APPEND LLDB_TEST_DEPS liblldb)
+ endif()
+
+ if(TARGET clang)
+ list(APPEND LLDB_TEST_DEPS clang)
+ endif()
+
add_subdirectory(test)
add_subdirectory(unittests)
add_subdirectory(lit)
+ add_subdirectory(utils/lldb-dotest)
endif()
if (NOT LLDB_DISABLE_PYTHON)
Modified: lldb/trunk/lit/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=331463&r1=331462&r2=331463&view=diff
==============================================================================
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Thu May 3 09:54:10 2018
@@ -15,10 +15,13 @@ if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILE
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_CXX_COMPILER ${LLDB_TEST_CXX_COMPILER})
endif ()
+get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-set(LLDB_TEST_DEPS
+list(APPEND LLDB_TEST_DEPS
LLDBUnitTests
dsymutil
lldb
@@ -35,7 +38,6 @@ else()
set(LLDB_HAVE_LLD 0)
endif()
-
if(BUILD_SHARED_LIBS)
set(ENABLE_SHARED 1)
else()
@@ -51,24 +53,16 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
- )
+ ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
+configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg)
if(NOT LLDB_BUILT_STANDALONE)
- list(APPEND LLDB_TEST_DEPS FileCheck not yaml2obj)
-endif()
-
-# lldb-server is not built on every platform.
-if (TARGET lldb-server)
- list(APPEND LLDB_TEST_DEPS lldb-server)
-endif()
-
-if(APPLE)
- list(APPEND LLDB_TEST_DEPS debugserver)
-endif()
-
-if(TARGET clang)
- list(APPEND LLDB_TEST_DEPS clang)
+ list(APPEND LLDB_TEST_DEPS
+ FileCheck
+ not
+ )
endif()
set(LLDB_TEST_PARAMS
Modified: lldb/trunk/lit/Suite/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=331463&r1=331462&r2=331463&view=diff
==============================================================================
--- lldb/trunk/lit/Suite/lit.site.cfg.in (original)
+++ lldb/trunk/lit/Suite/lit.site.cfg.in Thu May 3 09:54:10 2018
@@ -12,7 +12,7 @@ config.lldb_src_root = "@LLDB_SOURCE_DIR
config.target_triple = "@TARGET_TRIPLE@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py"
-config.dotest_args_str = "@LLDB_DOTEST_ARGS_STR@"
+config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=331463&r1=331462&r2=331463&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu May 3 09:54:10 2018
@@ -13,35 +13,6 @@ function(add_python_test_target name tes
)
endfunction()
-set(LLDB_TEST_DEPS lldb)
-
-# darwin-debug is an hard dependency for the testsuite.
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
- list(APPEND LLDB_TEST_DEPS darwin-debug)
-endif()
-
-if(TARGET lldb-server)
- list(APPEND LLDB_TEST_DEPS lldb-server)
-endif()
-
-if(TARGET debugserver)
- if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY)
- list(APPEND LLDB_TEST_DEPS debugserver)
- endif()
-endif()
-
-if(TARGET lldb-mi)
- list(APPEND LLDB_TEST_DEPS lldb-mi)
-endif()
-
-if(NOT LLDB_BUILT_STANDALONE)
- list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil)
-endif()
-
-if(TARGET liblldb)
- list(APPEND LLDB_TEST_DEPS liblldb)
-endif()
-
# 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)
@@ -75,28 +46,12 @@ set(LLDB_TEST_COMMON_ARGS
-u CFLAGS
)
-# We need two properties here, because they are used for different purposes. When we are generating
-# one file per configuration for lldb-dotest, we want the paths to be configuration specific. However,
-# when we are generating a single lit file, the file itself should not be per configuration and the paths
-# contained inside should be generic also.
-set(LLDB_EXECUTABLE_PATH_ARGS
- --executable $<TARGET_FILE:lldb>
- --dsymutil $<TARGET_FILE:dsymutil>
- )
-set(LLDB_EXECUTABLE_PATH_ARGS_STR
+list(APPEND LLDB_TEST_COMMON_ARGS
--executable ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}
--dsymutil ${LLVM_RUNTIME_OUTPUT_INTDIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}
-C ${LLDB_TEST_C_COMPILER}
)
-# There's an additional complication which is that when the compiler is NOT a custom compiler, we need to
-# make sure to get the configuration specific path as well
-if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
- list(APPEND LLDB_EXECUTABLE_PATH_ARGS -C $<TARGET_FILE:clang>)
-else()
- list(APPEND LLDB_EXECUTABLE_PATH_ARGS -C ${LLDB_TEST_C_COMPILER})
-endif()
-
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
# All tests are currently flaky on Windows, so rerun them all once when they fail.
set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --rerun-all-issues)
@@ -122,11 +77,8 @@ if(LLDB_CODESIGN_IDENTITY)
list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
endif()
-# The framework path is passed to the test arguments as $<TARGET_FILE_DIR:liblldb>. This won't work in the
-# LLDB_DOTEST_ARGS_STR when using a generator that supports multiple configurations such as Visual Studio,
-# but since the framework is currently confined to Darwin/Apple, we can leave it as is.
if(LLDB_BUILD_FRAMEWORK)
- list(APPEND LLDB_TEST_COMMON_ARGS --framework $<TARGET_FILE_DIR:liblldb>)
+ list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLVM_LIBRARY_OUTPUT_INTDIR})
endif()
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
@@ -134,9 +86,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi
--env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
endif()
-# In some cases, DEBUGSERVER_PATH is expressed as $<TARGET_FILE:debugserver>. This won't work in the
-# LLDB_DOTEST_ARGS_STR when using a generator that supports multiple configurations such as Visual Studio,
-# but since debugserver is currently confined to Darwin/Apple, we can leave it as is.
if(CMAKE_HOST_APPLE)
list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
endif()
@@ -145,8 +94,8 @@ if(SKIP_DEBUGSERVER)
list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
endif()
-set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_EXECUTABLE_PATH_ARGS};${LLDB_TEST_USER_ARGS})
-set(LLDB_DOTEST_ARGS_STR ${LLDB_TEST_COMMON_ARGS};${LLDB_EXECUTABLE_PATH_ARGS_STR};${LLDB_TEST_USER_ARGS})
+set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
+set_property(GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY ${LLDB_DOTEST_ARGS})
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
@@ -158,38 +107,6 @@ add_python_test_target(check-lldb-single
# output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target.
add_custom_target(check-lldb)
-# Generate a wrapper for dotest.py in the bin directory.
-# We need configure_file to substitute variables.
-configure_file(
- lldb-dotest.in
- ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
- )
-# We need this to expand the generator expressions. TARGET_FILE_DIR is OK here because we want to
-# generate a copy of lldb-dotest per configuration.
-file(GENERATE
- OUTPUT
- $<TARGET_FILE_DIR:lldb>/lldb-dotest
- INPUT
- ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
- )
-# Make this a custom target.
-add_custom_target(lldb-dotest)
-add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
-
-if (CMAKE_CFG_INTDIR STREQUAL ".")
- set(LLVM_BUILD_MODE ".")
-else ()
- set(LLVM_BUILD_MODE "%(build_mode)s")
-endif ()
-
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS_STR "${LLDB_DOTEST_ARGS_STR}")
-
-configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/../lit/Suite/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/../lit/Suite/lit.site.cfg)
-
# If we're building with an in-tree clang, then list clang as a dependency
# to run tests.
if (TARGET clang)
Removed: lldb/trunk/test/lldb-dotest.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb-dotest.in?rev=331462&view=auto
==============================================================================
--- lldb/trunk/test/lldb-dotest.in (original)
+++ lldb/trunk/test/lldb-dotest.in (removed)
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-import subprocess
-import sys
-
-dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args_str = '@LLDB_DOTEST_ARGS@'
-
-if __name__ == '__main__':
- wrapper_args = sys.argv[1:]
- dotest_args = dotest_args_str.split(';')
- # Build dotest.py command.
- cmd = [dotest_path, '-q']
- cmd.extend(dotest_args)
- cmd.extend(wrapper_args)
- # Invoke dotest.py and return exit code.
- sys.exit(subprocess.call(cmd))
Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=331463&r1=331462&r2=331463&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Thu May 3 09:54:10 2018
@@ -77,7 +77,7 @@ set(lldbDebugserverCommonSources
RNBSocket.cpp
SysSignal.cpp
TTYState.cpp
-
+
MacOSX/CFBundle.cpp
MacOSX/CFString.cpp
MacOSX/Genealogy.cpp
@@ -99,7 +99,7 @@ set(LLDB_CODESIGN_IDENTITY "lldb_codesig
CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.")
if(NOT LLDB_CODESIGN_IDENTITY STREQUAL "")
- set(DEBUGSERVER_PATH $<TARGET_FILE:debugserver> CACHE PATH "Path to debugserver.")
+ set(DEBUGSERVER_PATH ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver${CMAKE_EXECUTABLE_SUFFIX} CACHE PATH "Path to debugserver.")
set(SKIP_DEBUGSERVER OFF CACHE BOOL "Skip building the in-tree debug server")
else()
execute_process(
Added: lldb/trunk/utils/lldb-dotest/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lldb-dotest/CMakeLists.txt?rev=331463&view=auto
==============================================================================
--- lldb/trunk/utils/lldb-dotest/CMakeLists.txt (added)
+++ lldb/trunk/utils/lldb-dotest/CMakeLists.txt Thu May 3 09:54:10 2018
@@ -0,0 +1,22 @@
+# Make lldb-dotest a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
+
+get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+
+# Generate wrapper for each build mode.
+if(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}")
+ configure_file(
+ lldb-dotest.in
+ ${LLDB_DOTEST_DIR}/lldb-dotest
+ )
+ endforeach()
+else()
+ configure_file(
+ lldb-dotest.in
+ ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest
+ )
+endif()
Copied: lldb/trunk/utils/lldb-dotest/lldb-dotest.in (from r331458, lldb/trunk/test/lldb-dotest.in)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lldb-dotest/lldb-dotest.in?p2=lldb/trunk/utils/lldb-dotest/lldb-dotest.in&p1=lldb/trunk/test/lldb-dotest.in&r1=331458&r2=331463&rev=331463&view=diff
==============================================================================
(empty)
More information about the lldb-commits
mailing list