[clang] [clang][python] Add CLANG_DISABLE_RUN_PYTHON_TESTS CMake option to disable clang python bindings tests (PR #111367)
Alex Bradbury via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 05:24:43 PDT 2024
https://github.com/asb created https://github.com/llvm/llvm-project/pull/111367
We already have hard-coded logic to disable adding these tests to the `check-all` target in various cases. It's handy to have a CMake option to disable if in an environment where the tests don't work and you want `check-all` to work as expected.
---
By my understanding there's no ability to treat CMake options as tri-state, where I'd be able to tell if it was explicitly st to ON, explicitly set to OFF, or left to the default. So the new option is just "force disable" rather than allowing a force enable/
CC also @linux4life798 as another contributor I can see from the commit logs.
>From bf7022f71a95313e8ebdd34e5ea7cb7bca90a24d Mon Sep 17 00:00:00 2001
From: Alex Bradbury <asb at igalia.com>
Date: Mon, 7 Oct 2024 13:19:08 +0100
Subject: [PATCH] [clang][python] Add CLANG_DISABLE_RUN_PYTHON_TESTS CMake
option to disable clang python bindings tests
We already have hard-coded logic to disable adding these tests to the
`check-all` target in various cases. It's handy to have a CMake option
to disable if in an environment where the tests don't work and you want
`check-all` to work as expected.
---
clang/bindings/python/tests/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt
index 2543cf739463d9..b97195c24d62b1 100644
--- a/clang/bindings/python/tests/CMakeLists.txt
+++ b/clang/bindings/python/tests/CMakeLists.txt
@@ -47,6 +47,12 @@ if(${LLVM_NATIVE_ARCH} MATCHES "^(AArch64|Hexagon|Sparc|SystemZ)$")
set(RUN_PYTHON_TESTS FALSE)
endif()
+# Allow user to explicitly disable these tests.
+option(CLANG_DISABLE_RUN_PYTHON_TESTS "Do not run Clang Python bindings tests" OFF)
+if(CLANG_DISABLE_RUN_PYTHON_TESTS)
+ set(RUN_PYTHON_TESTS FALSE)
+endif()
+
if(RUN_PYTHON_TESTS)
set_property(GLOBAL APPEND PROPERTY
LLVM_ALL_ADDITIONAL_TEST_TARGETS check-clang-python)
More information about the cfe-commits
mailing list