From 2314aeb88420768de0ef16ce4928590560e1204a Mon Sep 17 00:00:00 2001 From: Valentin Volkl Date: Fri, 22 Mar 2024 04:34:43 +0100 Subject: [PATCH] py-cmake: only run test suite when run_tests (#43246) As the cmake build is triggered by scikit build, the usual spack option for enabling tests had no effect and the heavy test suite ran all the time. Used https://github.com/scikit-build/cmake-python-distributions/issues/172#issuecomment-890322263 to implement how to pass options to the actual `cmake` build. I also excluded some tests that failed for me on alma9 (gcc 11.4.1), so the rest of the test suite can be run. --- .../repos/builtin/packages/py-cmake/package.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-cmake/package.py b/var/spack/repos/builtin/packages/py-cmake/package.py index db15cd82591..c97016e15a2 100644 --- a/var/spack/repos/builtin/packages/py-cmake/package.py +++ b/var/spack/repos/builtin/packages/py-cmake/package.py @@ -53,3 +53,16 @@ class PyCmake(PythonPackage): def install_options(self, spec, prefix): return ["-DBUILD_CMAKE_FROM_SOURCE=ON", "-DCMakeProject_SOURCE_DIR=cmake-src"] + + def setup_build_environment(self, env): + if self.run_tests: + env.set( + "SKBUILD_CONFIGURE_OPTIONS", + # BootstrapTest is already exlcude upstream, + # The rest are (non-understood) known failures, disabled to get test suite working + # todo: investigate test failures / check if still needed in newer versions + "-DRUN_CMAKE_TEST=ON -DRUN_CMAKE_TEST_EXCLUDE=BootstrapTest|CompileWarningAsError" + "|GET_RUNTIME_DEPENDENCIES", + ) + else: + env.set("SKBUILD_CONFIGURE_OPTIONS", "-DRUN_CMAKE_TEST=OFF")