Tests: handle a case when hg executable is broken

OS Elbrus 6.0-rc1 to rc3 have hg executable broken
because of python2 and python3 module directories conflict.
Here, we avoid hg related tests if such case is detected.
This commit is contained in:
makise-homura
2022-06-23 23:09:33 +03:00
committed by Brad King
parent 2faabab644
commit b05d297964
3 changed files with 21 additions and 3 deletions

View File

@@ -2673,7 +2673,10 @@ if(BUILD_TESTING)
endif()
if(NOT DEFINED CMake_TEST_CTestUpdate_HG AND HG_EXECUTABLE
AND (UNIX OR NOT "${HG_EXECUTABLE}" MATCHES "cygwin"))
set(CMake_TEST_CTestUpdate_HG 1)
execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
if(HG_RV EQUAL 0)
set(CMake_TEST_CTestUpdate_HG 1)
endif()
endif()
if(CMake_TEST_CTestUpdate_HG)
if(NOT HG_EXECUTABLE)

View File

@@ -56,6 +56,15 @@ macro(check_version_string MODULE_NAME VERSION_VAR)
if (NOT _exclude_pos EQUAL -1)
message(STATUS "excluding check of ${VERSION_VAR}='${${VERSION_VAR}}' due to local configuration")
elseif (${MODULE_NAME}_FOUND)
unset(SKIP_CHECK)
if(${MODULE_NAME} STREQUAL "HG")
execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
if(NOT HG_RV EQUAL 0)
message(WARNING "Broken HG executable detected, skipping")
set(SKIP_CHECK TRUE)
endif()
endif()
if (DEFINED ${VERSION_VAR})
message(STATUS "${VERSION_VAR}='${${VERSION_VAR}}'")
if (NOT ${VERSION_VAR} MATCHES "^[0-9]")
@@ -71,7 +80,9 @@ macro(check_version_string MODULE_NAME VERSION_VAR)
message(SEND_ERROR "unexpected: ${VERSION_VAR} is NOT VERSION_GREATER 0")
endif()
else()
message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED")
if(NOT SKIP_CHECK)
message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED")
endif()
endif()
endif ()
endmacro()

View File

@@ -45,7 +45,11 @@ if(NOT DEFINED EP_TEST_HG OR EP_TEST_HG)
find_package(Hg)
endif()
if(NOT DEFINED EP_TEST_HG AND Hg_FOUND)
set(EP_TEST_HG 1)
# Check if hg executable is working
execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
if(HG_RV EQUAL 0)
set(EP_TEST_HG 1)
endif()
endif()
message(STATUS "EP_TEST_CVS='${EP_TEST_CVS}' CVS_EXECUTABLE='${CVS_EXECUTABLE}'")