summaryrefslogtreecommitdiff
path: root/lldb/cmake
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-03-17 15:14:21 -0700
committerAlex Langford <alangford@apple.com>2023-03-20 10:41:22 -0700
commitc47da7f109468efbe77c27d436fd69fa2b3ad991 (patch)
tree67559f112bbca005ed1f9f4767a5784c8eb7c9e4 /lldb/cmake
parentb9521484ec72142bce8124a171206fc577abfd3f (diff)
downloadllvm-c47da7f109468efbe77c27d436fd69fa2b3ad991.tar.gz
[lldb] Introduce CMake variable LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
The goal of this patch is to add the ability for the CMake configure to fail when some optional test dependencies are not met. LLDB tries to be flexible when test dependencies are not present but there are cases where it would be useful to know that these dependencies are missing before we run the test suite. The intent here is to apply this setting on CI machines and make sure that they have useful optional dependencies installed. We recently hit a case where some CI machines were timing out while running the test suite because a few tests were hanging. With this option, we'll be able to know if the machine does not have psutil installed so we can install it and avoid the timeout scenario altogether. rdar://103194447 Differential Revision: https://reviews.llvm.org/D146335
Diffstat (limited to 'lldb/cmake')
-rw-r--r--lldb/cmake/modules/AddLLDB.cmake19
-rw-r--r--lldb/cmake/modules/LLDBConfig.cmake2
2 files changed, 21 insertions, 0 deletions
diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index 251c2957e2d1..374946fe4908 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -349,6 +349,25 @@ function(lldb_find_system_debugserver path)
endif()
endfunction()
+function(lldb_find_python_module module)
+ set(MODULE_FOUND PY_${module}_FOUND)
+ if (DEFINED ${MODULE_FOUND})
+ return()
+ endif()
+
+ execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import ${module}"
+ RESULT_VARIABLE status
+ ERROR_QUIET)
+
+ if (status)
+ set(${MODULE_FOUND} OFF CACHE BOOL "Failed to find python module '${module}'")
+ message(STATUS "Could NOT find Python module '${module}'")
+ else()
+ set(${MODULE_FOUND} ON CACHE BOOL "Found python module '${module}'")
+ message(STATUS "Found Python module '${module}'")
+ endif()
+endfunction()
+
# Removes all module flags from the current CMAKE_CXX_FLAGS. Used for
# the Objective-C++ code in lldb which we don't want to build with modules.
# Reasons for this are that modules with Objective-C++ would require that
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index ec06ba285f27..1393342dd5cb 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,8 @@ option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries
option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF)
option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when installing lldb." OFF)
+option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
+ "Fail to configure if certain requirements are not met for testing." OFF)
set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
"Path to the global lldbinit directory. Relative paths are resolved relative to the