File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -404,6 +404,25 @@ function(lldb_find_system_debugserver path)
404
404
endif ()
405
405
endfunction ()
406
406
407
+ function (lldb_find_python_module module )
408
+ set (MODULE_FOUND PY_${module}_FOUND )
409
+ if (DEFINED ${MODULE_FOUND} )
410
+ return ()
411
+ endif ()
412
+
413
+ execute_process (COMMAND "${Python3_EXECUTABLE} " "-c" "import ${module} "
414
+ RESULT_VARIABLE status
415
+ ERROR_QUIET )
416
+
417
+ if (status )
418
+ set (${MODULE_FOUND} OFF CACHE BOOL "Failed to find python module '${module} '" )
419
+ message (STATUS "Could NOT find Python module '${module} '" )
420
+ else ()
421
+ set (${MODULE_FOUND} ON CACHE BOOL "Found python module '${module} '" )
422
+ message (STATUS "Found Python module '${module} '" )
423
+ endif ()
424
+ endfunction ()
425
+
407
426
# Removes all module flags from the current CMAKE_CXX_FLAGS. Used for
408
427
# the Objective-C++ code in lldb which we don't want to build with modules.
409
428
# Reasons for this are that modules with Objective-C++ would require that
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries
82
82
option (LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF )
83
83
option (LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF )
84
84
option (LLDB_SKIP_DSYM "Whether to skip generating a dSYM when installing lldb." OFF )
85
+ option (LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
86
+ "Fail to configure if certain requirements are not met for testing." OFF )
85
87
86
88
# BEGIN SWIFT MOD
87
89
option (LLDB_ENABLE_SWIFT_SUPPORT "Enable swift support" ON )
Original file line number Diff line number Diff line change 1
1
# Test runner infrastructure for LLDB. This configures the LLDB test trees
2
2
# for use by Lit, and delegates to LLVM's lit test handlers.
3
+ # Lit requires a Python3 interpreter, let's be careful and fail early if it's
4
+ # not present.
5
+ if (NOT DEFINED Python3_EXECUTABLE )
6
+ message (FATAL_ERROR
7
+ "LLDB test suite requires a Python3 interpreter but none "
8
+ "was found. Please install Python3 or disable tests with "
9
+ "`LLDB_INCLUDE_TESTS=OFF`." )
10
+ endif ()
11
+
12
+ if (LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS )
13
+ message (STATUS "Enforcing strict test requirements for LLDB" )
14
+ set (useful_python_modules
15
+ psutil # Lit uses psutil to do per-test timeouts.
16
+ )
17
+ foreach (module ${useful_python_modules} )
18
+ lldb_find_python_module (${module} )
19
+ if (NOT PY_${module}_FOUND )
20
+ message (FATAL_ERROR
21
+ "Python module '${module} ' not found. Please install it via pip or via "
22
+ "your operating system's package manager. Alternatively, disable "
23
+ "strict testing requirements with "
24
+ "`LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=OFF`" )
25
+ endif ()
26
+ endforeach ()
27
+ endif ()
3
28
4
29
if (LLDB_BUILT_STANDALONE )
5
30
# In order to run check-lldb-* we need the correct map_config directives in
You can’t perform that action at this time.
0 commit comments