[flang-commits] [flang] fa5d416 - [flang]Fix individual tests with lit when building out of tree

via flang-commits flang-commits at lists.llvm.org
Sun Jun 21 22:08:14 PDT 2020


Author: sameeran joshi
Date: 2020-06-22T10:30:33+05:30
New Revision: fa5d416efdcbdba766c0c9bd0797bd4b8bbe0273

URL: https://github.com/llvm/llvm-project/commit/fa5d416efdcbdba766c0c9bd0797bd4b8bbe0273
DIFF: https://github.com/llvm/llvm-project/commit/fa5d416efdcbdba766c0c9bd0797bd4b8bbe0273.diff

LOG: [flang]Fix individual tests with lit when building out of tree

Summary:

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

This commit extends @CarolineConcatto previous patch[D81002]

Reviewers: DavidTruby, sscalpone, tskeith, CarolineConcatto, jdoerfert

Reviewed By: DavidTruby

Subscribers: flang-commits, llvm-commits, CarolineConcatto

Tags: #flang, #llvm

Differential Revision: https://reviews.llvm.org/D82120

Added: 
    

Modified: 
    flang/CMakeLists.txt
    flang/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 5c4aad9bd65d..feb9544209bf 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -50,6 +50,7 @@ option(FLANG_ENABLE_WERROR "Fail and stop building flang if a warning is trigger
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   message("Building Flang as a standalone project.")
   project(Flang)
+  set(FLANG_STANDALONE_BUILD ON)
 
   set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
   if (NOT MSVC_IDE)
@@ -179,6 +180,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   endif()
 
 else()
+  set(FLANG_STANDALONE_BUILD OFF)
   option(FLANG_INCLUDE_TESTS
          "Generate build targets for the Flang unit tests."
          ${LLVM_INCLUDE_TESTS})

diff  --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index 6f47d67aa53e..ad47fff8c425 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -45,7 +45,13 @@ add_lit_testsuite(check-flang "Running the Flang regression tests"
 )
 set_target_properties(check-flang PROPERTIES FOLDER "Tests")
 
-add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
-  PARAMS ${FLANG_TEST_PARAMS}
-  DEPENDS ${FLANG_TEST_DEPENDS})
-
+# In case of standalone builds.
+if (FLANG_STANDALONE_BUILD)
+  add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}
+    PARAMS ${FLANG_TEST_PARAMS}
+    DEPENDS ${FLANG_TEST_DEPENDS})
+else()
+  add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
+    PARAMS ${FLANG_TEST_PARAMS}
+    DEPENDS ${FLANG_TEST_DEPENDS})
+endif()


        


More information about the flang-commits mailing list