From ae34d68429676d925f6df375b26fd288153135a6 Mon Sep 17 00:00:00 2001 From: Julien Schueller <schueller@phimeca.com> Date: Thu, 2 May 2024 17:37:24 +0200 Subject: [PATCH] CMake: Tests require Nlopt --- distro/rpm/otrobopt.spec | 8 ++------ lib/test/CMakeLists.txt | 3 ++- python/test/CMakeLists.txt | 8 +++++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/distro/rpm/otrobopt.spec b/distro/rpm/otrobopt.spec index 59e1440..cf15c9f 100644 --- a/distro/rpm/otrobopt.spec +++ b/distro/rpm/otrobopt.spec @@ -66,19 +66,15 @@ Python textual interface to OTRobOpt uncertainty library %build %cmake -DINSTALL_DESTDIR:PATH=%{buildroot} \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \ + -DCMAKE_UNITY_BUILD=ON \ -DUSE_SPHINX=OFF . make %{?_smp_mflags} %install -rm -rf %{buildroot} make install DESTDIR=%{buildroot} %check -make tests %{?_smp_mflags} -LD_LIBRARY_PATH=%{buildroot}%{_libdir} ctest %{?_smp_mflags} --output-on-failure - -%clean -rm -rf %{buildroot} +LD_LIBRARY_PATH=%{buildroot}%{_libdir} ctest %{?_smp_mflags} -R pyinstallcheck --output-on-failure --schedule-random %post -n libotrobopt0 -p /sbin/ldconfig %postun -n libotrobopt0 -p /sbin/ldconfig diff --git a/lib/test/CMakeLists.txt b/lib/test/CMakeLists.txt index efe0cce..f6d9d46 100644 --- a/lib/test/CMakeLists.txt +++ b/lib/test/CMakeLists.txt @@ -43,7 +43,8 @@ include_directories ( ${INTERNAL_INCLUDE_DIRS} ) ot_check_test (MeasureEvaluation_std) -if (NOT WIN32) +get_target_property (ot_features OT OPENTURNS_ENABLED_FEATURES) +if (ot_features MATCHES "nlopt" AND NOT WIN32) ot_check_test (SequentialMonteCarloRobustAlgorithm_std) endif() ot_check_test (SubsetInverseSampling_std) diff --git a/python/test/CMakeLists.txt b/python/test/CMakeLists.txt index 9da4da7..8ac9d2a 100644 --- a/python/test/CMakeLists.txt +++ b/python/test/CMakeLists.txt @@ -39,7 +39,11 @@ endmacro () ot_pyinstallcheck_test (MeasureEvaluation_std) ot_pyinstallcheck_test (MeasureFactory_std) ot_pyinstallcheck_test (MeasureFunction_std) -ot_pyinstallcheck_test (SequentialMonteCarloRobustAlgorithm_std) +get_target_property (ot_features OT OPENTURNS_ENABLED_FEATURES) +if (ot_features MATCHES "nlopt") + ot_pyinstallcheck_test (SequentialMonteCarloRobustAlgorithm_std) + ot_pyinstallcheck_test (saveload) +endif () ot_pyinstallcheck_test (SubsetInverseSampling_R-S) ot_pyinstallcheck_test (SubsetInverseSampling_Waarts_system_series) ot_pyinstallcheck_test (InverseFORM_std IGNOREOUT) @@ -56,8 +60,6 @@ if (MATPLOTLIB_FOUND) endforeach () endif () -ot_pyinstallcheck_test (saveload) - add_custom_target ( pyinstallcheck COMMAND ${CMAKE_CTEST_COMMAND} -R "^pyinstallcheck_" COMMENT "Run Python post-installation tests" )