This is an archive of the discontinued LLVM Phabricator instance.

Fix individual tests with lit when building out of tree
AbandonedPublic

Authored by CarolineConcatto on Jun 2 2020, 6:47 AM.

Details

Summary

Fix individual check tests with lit when building out-of-tree
check-flang-<folder> was not working.
The CMakeLists.txt was looking for the lit tests in the source directory
instead of the build directory.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript

I applied this to the current LLVM head (81bf1e29aa) and got this cmake error (and more) when doing an in-tree build:

CMake Error at /Users/tsk/llvm/llvm2/llvm/cmake/modules/AddLLVM.cmake:1717 (add_custom_target):
  The target name "check-flang-evaluate-%flang" is reserved or not valid for
  certain CMake features, such as generator expressions, and may result in
  undefined behavior.
Call Stack (most recent call first):
  /Users/tsk/llvm/llvm2/llvm/cmake/modules/AddLLVM.cmake:1781 (add_lit_target)
  /Users/tsk/llvm/llvm2/flang/test/CMakeLists.txt:35 (add_lit_testsuites)
CarolineConcatto added a comment.EditedJun 2 2020, 10:50 AM

It looks like that for in tree the lit needs to be like this:
add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
and out of tree like this:
add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}

I have created another revision, as I tried updating the current revision but couldn't.
https://reviews.llvm.org/D82120
@CarolineConcatto thanks for pointing the issue and working on it.