[Openmp-commits] [openmp] [openmp] Allow testing OpenMP without a full clang build tree (PR #182470)
Martin Storsjö via Openmp-commits
openmp-commits at lists.llvm.org
Fri Feb 20 02:33:54 PST 2026
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/182470
Having a build tree with "not" and "FileCheck" is still required, but if Clang isn't configured in that build, run the tests with the same compiler CMake uses. This is how testing worked in the standalone build configurations that now have been removed.
>From 62b5c0d77767ff1918a9bfeb086b86747dd88ad2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Fri, 20 Feb 2026 11:21:00 +0200
Subject: [PATCH] [openmp] Allow testing OpenMP without a full clang build tree
Having a build tree with "not" and "FileCheck" is still required,
but if Clang isn't configured in that build, run the tests with
the same compiler CMake uses. This is how testing worked in the
standalone build configurations that now have been removed.
---
openmp/CMakeLists.txt | 17 ++++++++++++-----
openmp/cmake/OpenMPTesting.cmake | 8 ++++++--
openmp/docs/Building.md | 4 ++--
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index e7a26b13a67ff..fbe902f8d4cf0 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -41,12 +41,19 @@ else()
"Path where built OpenMP libraries should be installed.")
endif()
-if (NOT MSVC)
- set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
+if (NOT TARGET "clang")
+ set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
+ "C compiler to use for testing OpenMP runtime libraries.")
+ set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
+ "C++ compiler to use for testing OpenMP runtime libraries.")
else()
- set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
+ if (NOT MSVC)
+ set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
+ else()
+ set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
+ endif()
endif()
# Set fortran test compiler if flang is found
diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index b1ee5bb664e1d..51f1a94d32767 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -127,19 +127,23 @@ function(add_openmp_testsuite target comment)
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
endif()
+ set(CLANG_DEPEND)
+ if (TARGET "clang")
+ set(CLANG_DEPEND clang)
+ endif()
if (ARG_EXCLUDE_FROM_CHECK_ALL)
add_lit_testsuite(${target}
${comment}
${ARG_UNPARSED_ARGUMENTS}
EXCLUDE_FROM_CHECK_ALL
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ DEPENDS ${CLANG_DEPEND} FileCheck not ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
)
else()
add_lit_testsuite(${target}
${comment}
${ARG_UNPARSED_ARGUMENTS}
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ DEPENDS ${CLANG_DEPEND} FileCheck not ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
)
endif()
diff --git a/openmp/docs/Building.md b/openmp/docs/Building.md
index c023a6e6717df..a3b397dff666b 100644
--- a/openmp/docs/Building.md
+++ b/openmp/docs/Building.md
@@ -136,8 +136,8 @@ is expected to have been built from the same Git commit as OpenMP. It will,
however, use the compiler detected by CMake, usually gcc.
To also make it use Clang, add
`-DCMAKE_C_COMPILER=../build/bin/clang -DCMAKE_C_COMPILER=../build/bin/clang++`.
-In any case, it will use Clang from `LLVM_BINARY_DIR` for running the regression
-tests. `LLVM_BINARY_DIR` can also be omitted in which case testing
+It will use Clang from `LLVM_BINARY_DIR` for running the regression tests, if Clang is included in that build.
+`LLVM_BINARY_DIR` can also be omitted in which case testing
(`ninja check-openmp`) is disabled.
The `CMAKE_INSTALL_PREFIX` can be the same, but does not need to. Using the same
More information about the Openmp-commits
mailing list