• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Debug Info tests.  These tests invoke clang to generate programs with
2# various types of debug info, and then run those programs under a debugger
3# such as GDB or LLDB to verify the results.
4
5find_package(Python3 COMPONENTS Interpreter)
6
7add_llvm_executable(check-gdb-llvm-support
8        llvm-prettyprinters/gdb/llvm-support.cpp
9)
10target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
11
12set(DEBUGINFO_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
13set(DEBUGINFO_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
14
15set(DEBUGINFO_TEST_DEPS
16  clang
17  FileCheck
18  count
19  llvm-config
20  llvm-objdump
21  check-gdb-llvm-support
22  not
23  )
24
25if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
26  add_llvm_executable(check-gdb-mlir-support
27        llvm-prettyprinters/gdb/mlir-support.cpp
28  )
29  target_include_directories(check-gdb-mlir-support PRIVATE ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include)
30  target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
31  list(APPEND DEBUGINFO_TEST_DEPS check-gdb-mlir-support)
32  set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})
33endif()
34
35if("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
36  # llgdb-tests/asan.c and other asan* files.
37  if(TARGET asan)
38    list(APPEND DEBUGINFO_TEST_DEPS asan)
39  endif()
40  # llgdb-tests/safestack.c
41  if(TARGET safestack)
42    list(APPEND DEBUGINFO_TEST_DEPS safestack)
43  endif()
44endif()
45# Many dexter tests depend on lldb.
46if("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
47  list(APPEND DEBUGINFO_TEST_DEPS lldb lldb-server)
48endif()
49
50# The Windows builder scripts pass -fuse-ld=lld.
51if (WIN32)
52  set(DEBUGINFO_TEST_DEPS ${DEBUGINFO_TEST_DEPS} lld)
53endif()
54
55if (NOT DEFINED Python3_EXECUTABLE)
56  message(FATAL_ERROR "Cannot run debuginfo-tests without python 3")
57endif()
58
59configure_lit_site_cfg(
60  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
61  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
62  MAIN_CONFIG
63  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
64  )
65
66add_lit_testsuite(check-debuginfo "Running debug info integration tests"
67  ${CMAKE_CURRENT_BINARY_DIR}
68  DEPENDS ${DEBUGINFO_TEST_DEPS}
69  )
70
71# Add check-debuginfo-* targets.
72add_lit_testsuites(DEBUGINFO ${CMAKE_CURRENT_SOURCE_DIR}
73  DEPENDS ${DEBUGINFO_TEST_DEPS}
74  )
75
76set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests")
77