1 # Test runner infrastructure for Flang. This configures the Flang test trees
2 # for use by Lit, and delegates to LLVM's lit test handlers.
5 llvm_canonicalize_cmake_booleans(
8 LLVM_BYE_LINK_INTO_TOOLS
12 set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)
14 # FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
15 # `configure_lit_site_cfg` leads to a configuration error. This is currently
16 # only required by plugins/examples, which are not supported in out-of-tree
18 if (FLANG_STANDALONE_BUILD)
19 set(PATHS_FOR_PLUGINS "")
21 set(PATHS_FOR_PLUGINS "SHLIBDIR")
24 configure_lit_site_cfg(
25 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
26 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
28 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
33 configure_lit_site_cfg(
34 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
35 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
37 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
40 configure_lit_site_cfg(
41 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.site.cfg.py.in
42 ${CMAKE_CURRENT_BINARY_DIR}/NonGtestUnit/lit.site.cfg.py
44 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.cfg.py
48 flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
50 set(FLANG_TEST_DEPENDS
67 if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
68 list(APPEND FLANG_TEST_DEPENDS Bye)
71 if (FLANG_INCLUDE_TESTS)
72 if (FLANG_GTEST_AVAIL)
73 list(APPEND FLANG_TEST_DEPENDS FlangUnitTests)
77 if (FLANG_BUILD_EXAMPLES)
78 list(APPEND FLANG_TEST_DEPENDS
79 flangPrintFunctionNames
84 add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})
86 add_lit_testsuite(check-flang "Running the Flang regression tests"
87 ${CMAKE_CURRENT_BINARY_DIR}
88 PARAMS ${FLANG_TEST_PARAMS}
89 DEPENDS ${FLANG_TEST_DEPENDS}
91 set_target_properties(check-flang PROPERTIES FOLDER "Tests")
93 # In case of standalone builds.
94 if (FLANG_STANDALONE_BUILD)
95 add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}
96 PARAMS ${FLANG_TEST_PARAMS}
97 DEPENDS ${FLANG_TEST_DEPENDS})
99 add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
100 PARAMS ${FLANG_TEST_PARAMS}
101 DEPENDS ${FLANG_TEST_DEPENDS})
104 # To modify the default target triple for flang tests.
105 if (DEFINED FLANG_TEST_TARGET_TRIPLE)
106 if (NOT DEFINED LLVM_TARGET_TRIPLE_ENV OR LLVM_TARGET_TRIPLE_ENV STREQUAL "")
107 message(FATAL_ERROR "LLVM_TARGET_TRIPLE_ENV must also be defined in order "
108 "to use FLANG_TEST_TARGET_TRIPLE.")