Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] [test] Fix unittests in standalone builds #120910

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Dec 22, 2024

Fix the logic used to run unit tests to account for llvm_gtest targets being installed, since 91b3ca3. This involves removing a rule that would cause a duplicate llvm_gtest target being created, and updates the method for determining whether unittests can be run to checking whether the target is present, rather than the source directory (that is no longer actually necessary).

Fix the logic used to run unit tests to account for `llvm_gtest` targets
being installed, since 91b3ca3.  This
involves removing a rule that would cause a duplicate `llvm_gtest`
target being created, and updates the method for determining whether
unittests can be run to checking whether the target is present, rather
than the source directory (that is no longer actually necessary).
@llvmbot
Copy link
Member

llvmbot commented Dec 22, 2024

@llvm/pr-subscribers-mlir

Author: Michał Górny (mgorny)

Changes

Fix the logic used to run unit tests to account for llvm_gtest targets being installed, since 91b3ca3. This involves removing a rule that would cause a duplicate llvm_gtest target being created, and updates the method for determining whether unittests can be run to checking whether the target is present, rather than the source directory (that is no longer actually necessary).


Full diff: https://github.com/llvm/llvm-project/pull/120910.diff

1 Files Affected:

  • (modified) mlir/CMakeLists.txt (+1-6)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 0608eef15c5a4b..3291e40f3fadb7 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -27,11 +27,6 @@ if(MLIR_STANDALONE_BUILD)
 
   include_directories(${LLVM_INCLUDE_DIRS})
 
-  set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
-  if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
-    add_subdirectory(${UNITTEST_DIR} third-party/unittest)
-  endif()
-
   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
     "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
@@ -218,7 +213,7 @@ if (MLIR_INCLUDE_TESTS)
   add_definitions(-DMLIR_INCLUDE_TESTS)
   add_custom_target(MLIRUnitTests)
   set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR/Tests")
-  if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
+  if (TARGET llvm_gtest)
     add_subdirectory(unittests)
   else()
     message(WARNING "gtest not found, unittests will not be available")

@mgorny mgorny merged commit 6b471b3 into llvm:main Dec 25, 2024
10 checks passed
@mgorny mgorny deleted the mlir-standalone-unittest branch December 25, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants