Home | History | Annotate | Download | only in test
      1 # Test runner infrastructure for Clang. This configures the Clang test trees
      2 # for use by Lit, and delegates to LLVM's lit test handlers.
      3 
      4 if (CMAKE_CFG_INTDIR STREQUAL ".")
      5   set(LLVM_BUILD_MODE ".")
      6 else ()
      7   set(LLVM_BUILD_MODE "%(build_mode)s")
      8 endif ()
      9 
     10 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
     11 
     12 configure_lit_site_cfg(
     13   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
     14   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     15   )
     16 
     17 configure_lit_site_cfg(
     18   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
     19   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
     20   )
     21 
     22 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
     23 if(CLANG_TEST_USE_VG)
     24   set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
     25 endif ()
     26 
     27 list(APPEND CLANG_TEST_DEPS
     28   clang clang-headers
     29   clang-check clang-format
     30   c-index-test diagtool
     31   clang-tblgen
     32   )
     33 
     34 if (CLANG_ENABLE_ARCMT)
     35   list(APPEND CLANG_TEST_DEPS
     36     arcmt-test
     37     c-arcmt-test
     38   )
     39 endif ()
     40 
     41 if (ENABLE_CLANG_EXAMPLES)
     42   list(APPEND CLANG_TEST_DEPS
     43     clang-interpreter
     44     PrintFunctionNames
     45     )
     46 endif ()
     47 
     48 if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES)
     49   list(APPEND CLANG_TEST_DEPS
     50     SampleAnalyzerPlugin
     51     )
     52 endif ()
     53 
     54 set(CLANG_TEST_PARAMS
     55   clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     56   )
     57 
     58 if( NOT CLANG_BUILT_STANDALONE )
     59   list(APPEND CLANG_TEST_DEPS
     60     llvm-config
     61     FileCheck count not
     62     llc
     63     llvm-bcanalyzer
     64     llvm-lto
     65     llvm-objdump
     66     llvm-profdata
     67     llvm-readobj
     68     llvm-symbolizer
     69     LTO
     70     opt
     71     )
     72 endif()
     73 
     74 add_lit_testsuite(check-clang "Running the Clang regression tests"
     75   ${CMAKE_CURRENT_BINARY_DIR}
     76   #LIT ${LLVM_LIT}
     77   PARAMS ${CLANG_TEST_PARAMS}
     78   DEPENDS ${CLANG_TEST_DEPS}
     79   ARGS ${CLANG_TEST_EXTRA_ARGS}
     80   )
     81 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
     82 
     83 # Add a legacy target spelling: clang-test
     84 add_custom_target(clang-test)
     85 add_dependencies(clang-test check-clang)
     86 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
     87