Reid Kleckner | 7a2274a | 2017-08-02 17:16:25 +0000 | [diff] [blame] | 1 | # The configured file is not placed in the correct location |
| 2 | # until the tests are run as we need to copy it into |
| 3 | # a copy of the tests folder |
Zachary Turner | 71deeee | 2017-09-21 16:18:28 +0000 | [diff] [blame] | 4 | configure_lit_site_cfg( |
| 5 | "${CMAKE_CURRENT_SOURCE_DIR}/tests/lit.site.cfg.in" |
| 6 | "${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg" |
| 7 | OUTPUT_MAPPING |
| 8 | "${CMAKE_CURRENT_BINARY_DIR}/tests/lit.site.cfg" |
| 9 | ) |
Reid Kleckner | 7a2274a | 2017-08-02 17:16:25 +0000 | [diff] [blame] | 10 | |
| 11 | # Lit's test suite creates output files next to the sources which makes the |
| 12 | # source tree dirty. This is undesirable because we do out of source builds. |
| 13 | # To work around this the tests and the configuration file are copied into the |
| 14 | # build directory just before running them. The tests are not copied over at |
| 15 | # configure time (i.e. `file(COPY ...)`) because this could lead to stale |
| 16 | # tests being run. |
| 17 | add_custom_target(prepare-check-lit |
| 18 | COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/tests" |
| 19 | COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/tests" "${CMAKE_CURRENT_BINARY_DIR}/tests" |
| 20 | COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg" "${CMAKE_CURRENT_BINARY_DIR}/tests" |
| 21 | COMMENT "Preparing lit tests" |
| 22 | ) |
| 23 | |
| 24 | # Add rules for lit's own test suite |
| 25 | add_lit_testsuite(check-lit "Running lit's tests" |
| 26 | ${CMAKE_CURRENT_BINARY_DIR} |
| 27 | DEPENDS "FileCheck" "not" "prepare-check-lit" |
| 28 | ) |
| 29 | |
| 30 | # For IDEs |
| 31 | set_target_properties(check-lit PROPERTIES FOLDER "Tests") |
| 32 | set_target_properties(prepare-check-lit PROPERTIES FOLDER "Tests") |