JDevlieghere updated this revision to Diff 145033.
JDevlieghere added a comment.
Herald added a reviewer: alexshap.

update diff pro forma


https://reviews.llvm.org/D46334

Files:
  CMakeLists.txt
  lit/CMakeLists.txt
  lit/Suite/lit.site.cfg.in
  test/CMakeLists.txt
  test/lldb-dotest.in
  tools/debugserver/source/CMakeLists.txt
  utils/lldb-dotest/CMakeLists.txt
  utils/lldb-dotest/lldb-dotest.in

Index: utils/lldb-dotest/CMakeLists.txt
===================================================================
--- /dev/null
+++ utils/lldb-dotest/CMakeLists.txt
@@ -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()
Index: tools/debugserver/source/CMakeLists.txt
===================================================================
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -77,7 +77,7 @@
   RNBSocket.cpp
   SysSignal.cpp
   TTYState.cpp
-  
+
   MacOSX/CFBundle.cpp
   MacOSX/CFString.cpp
   MacOSX/Genealogy.cpp
@@ -99,7 +99,7 @@
   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(
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -13,35 +13,6 @@
     )
 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 @@
   -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,31 +77,25 @@
   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")
   list(APPEND LLDB_TEST_COMMON_ARGS
     --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()
 
 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 @@
 # 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)
Index: lit/Suite/lit.site.cfg.in
===================================================================
--- lit/Suite/lit.site.cfg.in
+++ lit/Suite/lit.site.cfg.in
@@ -12,7 +12,7 @@
 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.
Index: lit/CMakeLists.txt
===================================================================
--- lit/CMakeLists.txt
+++ lit/CMakeLists.txt
@@ -15,8 +15,11 @@
   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
   LLDBUnitTests
@@ -51,24 +54,24 @@
   ${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)
+
+list(APPEND LLDB_TEST_DEPS
+  LLDBUnitTests
+  lldb-test
+  llvm-config
+  llvm-mc
+  llvm-objcopy
   )
 
 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
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -85,9 +85,43 @@
     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)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to