Skip to content

Commit 7a2274a

Browse files
committedAug 2, 2017
Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"
This reverts r309602, check-lit still leaves Output directories in the source directory. llvm-svn: 309833
1 parent 2738ede commit 7a2274a

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed
 

‎llvm/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ if( LLVM_INCLUDE_TESTS )
897897
NO_INSTALL
898898
ALWAYS_CLEAN)
899899
endif()
900-
add_subdirectory(utils/lit/tests)
900+
add_subdirectory(utils/lit)
901901
add_subdirectory(test)
902902
add_subdirectory(unittests)
903903
if( LLVM_INCLUDE_UTILS )

‎llvm/utils/lit/CMakeLists.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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
4+
configure_file("tests/lit.site.cfg.in" "lit.site.cfg" @ONLY)
5+
6+
# Lit's test suite creates output files next to the sources which makes the
7+
# source tree dirty. This is undesirable because we do out of source builds.
8+
# To work around this the tests and the configuration file are copied into the
9+
# build directory just before running them. The tests are not copied over at
10+
# configure time (i.e. `file(COPY ...)`) because this could lead to stale
11+
# tests being run.
12+
add_custom_target(prepare-check-lit
13+
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/tests"
14+
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/tests" "${CMAKE_CURRENT_BINARY_DIR}/tests"
15+
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg" "${CMAKE_CURRENT_BINARY_DIR}/tests"
16+
COMMENT "Preparing lit tests"
17+
)
18+
19+
# Add rules for lit's own test suite
20+
add_lit_testsuite(check-lit "Running lit's tests"
21+
${CMAKE_CURRENT_BINARY_DIR}
22+
DEPENDS "FileCheck" "not" "prepare-check-lit"
23+
)
24+
25+
# For IDEs
26+
set_target_properties(check-lit PROPERTIES FOLDER "Tests")
27+
set_target_properties(prepare-check-lit PROPERTIES FOLDER "Tests")

‎llvm/utils/lit/tests/CMakeLists.txt

-24
This file was deleted.

‎llvm/utils/lit/tests/Inputs/lit.site.cfg.in

-3
This file was deleted.

‎llvm/utils/lit/tests/lit.site.cfg.in

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@"
55
config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
66

77
# Let the main config do the real work.
8-
lit_config.load_config(config, "@LLVM_SOURCE_DIR@/utils/lit/tests/lit.cfg")
9-
config.test_source_root = "@CMAKE_CURRENT_SOURCE_DIR@"
10-
config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
8+
lit_config.load_config(config, "@LLVM_BINARY_DIR@/utils/lit/tests/lit.cfg")

0 commit comments

Comments
 (0)
Please sign in to comment.