Skip to content

[Offload] Add OFFLOAD_INCLUDE_TESTS #143388

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

Merged
merged 1 commit into from
Jun 9, 2025
Merged

Conversation

RossBrunton
Copy link
Contributor

This is a cmake variable which, if set to OFF will disable building of
tests. It defaults to the value of LLVM_INCLUDE_TESTS.

This is a cmake variable which, if set to `OFF` will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
@llvmbot llvmbot added the offload label Jun 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-offload

Author: Ross Brunton (RossBrunton)

Changes

This is a cmake variable which, if set to OFF will disable building of
tests. It defaults to the value of LLVM_INCLUDE_TESTS.


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

1 Files Affected:

  • (modified) offload/CMakeLists.txt (+14-10)
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 09eae0f5d3aea..0a441c3bc5782 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -41,6 +41,8 @@ endif()
 
 set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 
+option(OFFLOAD_INCLUDE_TESTS "Generate and build offload tests." ${LLVM_INCLUDE_TESTS})
+
 # Add path for custom modules
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -376,15 +378,17 @@ add_subdirectory(libomptarget)
 add_subdirectory(liboffload)
 
 # Add tests.
-add_subdirectory(test)
+if(OFFLOAD_INCLUDE_TESTS)
+  add_subdirectory(test)
 
-# Add unit tests if GMock/GTest is present
-if(NOT LLVM_THIRD_PARTY_DIR)
-  set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
-endif()
-if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
-  add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
-endif()
-if(TARGET llvm_gtest)
-  add_subdirectory(unittests)
+  # Add unit tests if GMock/GTest is present
+  if(NOT LLVM_THIRD_PARTY_DIR)
+    set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
+  endif()
+  if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
+    add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
+  endif()
+  if(TARGET llvm_gtest)
+    add_subdirectory(unittests)
+  endif()
 endif()

@jhuber6 jhuber6 merged commit 637df70 into llvm:main Jun 9, 2025
9 checks passed
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
This is a cmake variable which, if set to `OFF` will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
This is a cmake variable which, if set to `OFF` will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
This is a cmake variable which, if set to `OFF` will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
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