From fcdef9a8fff16a1e541fa86467d6a79f56c95a52 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Fri, 26 Nov 2021 11:48:55 +0100 Subject: [PATCH] Add new test stage in CTest configuration Installl CbmRoot and remove part of the source directory Add code which tests if the installtion of CbmRoot works and if the installed version is functional. Test the "make install" target and run some macros from teh installation directory. To be able to test the CbmRoot installation it is necessary that no header files are accessible in the source directory since this is the fallback for ROOT when compiling a macro. To achieve this the directories containing any headers are removed from the source directory. This is a dangerous operation when executed in a source directory used for active development. The installation test should only be used when running the CI/CD workflow. --- CbmRoot_test.cmake | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CbmRoot_test.cmake b/CbmRoot_test.cmake index ca07daddf7..1365c1865b 100644 --- a/CbmRoot_test.cmake +++ b/CbmRoot_test.cmake @@ -130,8 +130,27 @@ If(NOT _RETVAL) EndIf() EndIf() + If(EXTRA_FLAGS MATCHES "INSTALL_PREFIX" AND EXTRA_FLAGS MATCHES "CBM_TEST_INSTALL" AND NOT _ctest_test_ret_val) + Message("Testing Installation") + execute_process(COMMAND ${BUILD_COMMAND} install -j$ENV{number_of_processors} WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULTS_VARIABLE _install_ret_value + ) + if (NOT _install_ret_value) + execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E rm -R MQ algo analysis core external fles mvd reco sim + WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY} + ) + message("executing test suite in ${CTEST_BINARY_DIRECTORY}/install") + execute_process(COMMAND ${CTEST_SOURCE_DIRECTORY}/cmake/scripts/execute_installation_test.sh ${CTEST_BINARY_DIRECTORY}/install + RESULTS_VARIABLE _install_ret_value + ) + endif() + Else() + # if installation isn't tested the return value should be 0 + set(_install_ret_value false) + EndIf() + # Pipeline should fail also in case of failed tests - if (_ctest_test_ret_val) + if (_ctest_test_ret_val OR _install_ret_value) If(${CMAKE_VERSION} VERSION_LESS 3.14.0) Else() message(STATUS " ") -- GitLab