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.
4 llvm_canonicalize_cmake_booleans(
10 set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)
12 # FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
13 # `configure_lit_site_cfg` leads to a configuration error. This is currently
14 # only required by plugins/examples, which are not supported in out-of-tree
16 if (FLANG_STANDALONE_BUILD)
17 set(PATHS_FOR_PLUGINS "")
19 set(PATHS_FOR_PLUGINS "SHLIBDIR")
22 configure_lit_site_cfg(
23 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
24 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
26 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
31 configure_lit_site_cfg(
32 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
33 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
35 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
38 configure_lit_site_cfg(
39 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.site.cfg.py.in
40 ${CMAKE_CURRENT_BINARY_DIR}/NonGtestUnit/lit.site.cfg.py
42 ${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.cfg.py
46 flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
48 set(FLANG_TEST_DEPENDS
49 flang-new llvm-config FileCheck count not module_files fir-opt tco bbc llvm-objdump
52 if (FLANG_INCLUDE_TESTS)
53 if (FLANG_GTEST_AVAIL)
54 list(APPEND FLANG_TEST_DEPENDS FlangUnitTests)
58 if (FLANG_BUILD_EXAMPLES)
59 list(APPEND FLANG_TEST_DEPENDS
60 flangPrintFunctionNames
65 add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})
67 add_lit_testsuite(check-flang "Running the Flang regression tests"
68 ${CMAKE_CURRENT_BINARY_DIR}
69 PARAMS ${FLANG_TEST_PARAMS}
70 DEPENDS ${FLANG_TEST_DEPENDS}
72 set_target_properties(check-flang PROPERTIES FOLDER "Tests")
74 # In case of standalone builds.
75 if (FLANG_STANDALONE_BUILD)
76 add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}
77 PARAMS ${FLANG_TEST_PARAMS}
78 DEPENDS ${FLANG_TEST_DEPENDS})
80 add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
81 PARAMS ${FLANG_TEST_PARAMS}
82 DEPENDS ${FLANG_TEST_DEPENDS})