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 # Check if 128-bit float computations can be done via long double
15 check_cxx_source_compiles(
17 #if LDBL_MANT_DIG != 113
18 #error LDBL_MANT_DIG != 113
20 int main() { return 0; }
22 HAVE_LDBL_MANT_DIG_113)
24 # FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
25 # `configure_lit_site_cfg` leads to a configuration error. This is currently
26 # only required by plugins/examples, which are not supported in out-of-tree
28 if (FLANG_STANDALONE_BUILD)
29 set(PATHS_FOR_PLUGINS "")
31 set(PATHS_FOR_PLUGINS "SHLIBDIR")
34 configure_lit_site_cfg(
35 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
36 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
38 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
43 configure_lit_site_cfg(
44 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
45 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
47 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
50 configure_lit_site_cfg(
51 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.site.cfg.py.in
52 ${CMAKE_CURRENT_BINARY_DIR}/NonGtestUnit/lit.site.cfg.py
54 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.cfg.py
58 flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
60 set(FLANG_TEST_DEPENDS
77 if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
78 list(APPEND FLANG_TEST_DEPENDS Bye)
81 if (FLANG_INCLUDE_TESTS)
82 if (FLANG_GTEST_AVAIL)
83 list(APPEND FLANG_TEST_DEPENDS FlangUnitTests)
87 if (LLVM_BUILD_EXAMPLES)
88 list(APPEND FLANG_TEST_DEPENDS
89 flangPrintFunctionNames
95 add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})
96 set_target_properties(flang-test-depends PROPERTIES FOLDER "Flang/Meta")
98 add_lit_testsuite(check-flang "Running the Flang regression tests"
99 ${CMAKE_CURRENT_BINARY_DIR}
100 PARAMS ${FLANG_TEST_PARAMS}
101 DEPENDS ${FLANG_TEST_DEPENDS}
103 set_target_properties(check-flang PROPERTIES FOLDER "Flang/Meta")
105 # In case of standalone builds.
106 if (FLANG_STANDALONE_BUILD)
107 add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}
108 PARAMS ${FLANG_TEST_PARAMS}
109 DEPENDS ${FLANG_TEST_DEPENDS})
111 add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
112 PARAMS ${FLANG_TEST_PARAMS}
113 DEPENDS ${FLANG_TEST_DEPENDS})
116 # To modify the default target triple for flang tests.
117 if (DEFINED FLANG_TEST_TARGET_TRIPLE)
118 if (NOT DEFINED LLVM_TARGET_TRIPLE_ENV OR LLVM_TARGET_TRIPLE_ENV STREQUAL "")
119 message(FATAL_ERROR "LLVM_TARGET_TRIPLE_ENV must also be defined in order "
120 "to use FLANG_TEST_TARGET_TRIPLE.")