summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakise-homura <akemi_homura@kurisa.ch>2022-06-23 20:09:33 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-28 15:12:04 (GMT)
commitb05d297964b4352b81f7ed4aab247609b6a4b0b7 (patch)
tree35a4dff1240ed28571907a159b7bf619d3dc4acd
parent2faabab644571b84b485f6fe101d09af0759d3a2 (diff)
downloadCMake-b05d297964b4352b81f7ed4aab247609b6a4b0b7.zip
CMake-b05d297964b4352b81f7ed4aab247609b6a4b0b7.tar.gz
CMake-b05d297964b4352b81f7ed4aab247609b6a4b0b7.tar.bz2
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.
-rw-r--r--Tests/CMakeLists.txt5
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt13
-rw-r--r--Tests/ExternalProject/CMakeLists.txt6
3 files changed, 21 insertions, 3 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ce22363..c25b6e2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -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)
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 49a4041..0907d03 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -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()
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index e4c6c66..81d31e7 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -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}'")