From 6998d48ffc99fc9d0f016fba92c532bba6496bd9 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 30 Oct 2013 18:43:12 +0000 Subject: [PATCH] Also support "git-svn" in run_testsuite.cmake git-svn-id: https://svn.dealii.org/trunk@31488 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/scripts/run_testsuite.cmake | 88 +++++++++++++++++------ 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/deal.II/cmake/scripts/run_testsuite.cmake b/deal.II/cmake/scripts/run_testsuite.cmake index 87ae30a70c..7f07851263 100644 --- a/deal.II/cmake/scripts/run_testsuite.cmake +++ b/deal.II/cmake/scripts/run_testsuite.cmake @@ -227,8 +227,13 @@ MESSAGE("-- CTEST_CMAKE_GENERATOR: ${CTEST_CMAKE_GENERATOR}") # FIND_PROGRAM(HOSTNAME_COMMAND NAMES hostname) -EXEC_PROGRAM(${HOSTNAME_COMMAND} OUTPUT_VARIABLE _hostname) -SET(CTEST_SITE "${_hostname}") +IF(NOT "${HOSTNAME_COMMAND}" MATCHES "-NOTFOUND") + EXEC_PROGRAM(${HOSTNAME_COMMAND} OUTPUT_VARIABLE _hostname) + SET(CTEST_SITE "${_hostname}") +ELSE() + # Well, no hostname available. What about: + SET(CTEST_SITE "BobMorane") +ENDIF() MESSAGE("-- CTEST_SITE: ${CTEST_SITE}") @@ -308,34 +313,61 @@ IF(EXISTS ${CTEST_BINARY_DIRECTORY}/detailed.log) ENDIF() # -# Append subversion branch to CTEST_BUILD_NAME: +# Query subversion information: # + +# First try native subversion: FIND_PACKAGE(Subversion QUIET) -EXECUTE_PROCESS( - COMMAND ${Subversion_SVN_EXECUTABLE} info ${CTEST_SOURCE_DIRECTORY} - OUTPUT_QUIET ERROR_QUIET - RESULT_VARIABLE _result - ) +SET(_result 1) +IF(SUBVERSION_FOUND) + EXECUTE_PROCESS( + COMMAND ${Subversion_SVN_EXECUTABLE} info ${CTEST_SOURCE_DIRECTORY} + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE _result + ) +ENDIF() + IF(${_result} EQUAL 0) Subversion_WC_INFO(${CTEST_SOURCE_DIRECTORY} _svn) + +ELSE() + + # Umm, no valid subversion info was found, try again with git-svn: + FIND_PACKAGE(Git QUIET) + IF(GIT_FOUND) + EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} svn info + WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY} + OUTPUT_VARIABLE _svn_WC_INFO + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + IF(${_result} EQUAL 0) + STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" + "\\2" _svn_WC_URL "${_svn_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" + "\\2" _svn_WC_ROOT "${_svn_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" + "\\2" _svn_WC_REVISION "${_svn_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" + "\\2" _svn_WC_LAST_CHANGED_DATE "${_svn_WC_INFO}") + ELSE() + SET(_svn_WC_INFO) + ENDIF() + ENDIF() +ENDIF() + +# If we have a valid (git) svn info use it: +IF(${_result} EQUAL 0) + STRING(REGEX REPLACE "^${_svn_WC_ROOT}/" "" _branch ${_svn_WC_URL}) STRING(REGEX REPLACE "^branches/" "" _branch ${_branch}) STRING(REGEX REPLACE "/deal.II$" "" _branch ${_branch}) - SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}") -ENDIF() -# -# Append config file name to CTEST_BUILD_NAME: -# - -IF(NOT "${CONFIG_FILE}" STREQUAL "") - GET_FILENAME_COMPONENT(_conf ${CONFIG_FILE} NAME_WE) - STRING(REGEX REPLACE "#.*$" "" _conf ${_conf}) - SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_conf}") + SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}") ENDIF() -MESSAGE("-- CTEST_BUILD_NAME: ${CTEST_BUILD_NAME}") - # # We require valid svn information for build tests: # @@ -346,7 +378,7 @@ IF( "${TRACK}" STREQUAL "Build Tests" TRACK was set to \"Build Tests\" which requires the source directory to be under Subversion version control. " - ) + ) ENDIF() # @@ -374,6 +406,18 @@ ELSE() ) ENDIF() +# +# Append config file name to CTEST_BUILD_NAME: +# + +IF(NOT "${CONFIG_FILE}" STREQUAL "") + GET_FILENAME_COMPONENT(_conf ${CONFIG_FILE} NAME_WE) + STRING(REGEX REPLACE "#.*$" "" _conf ${_conf}) + SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_conf}") +ENDIF() + +MESSAGE("-- CTEST_BUILD_NAME: ${CTEST_BUILD_NAME}") + # # Declare files that should be submitted as notes: # @@ -388,6 +432,7 @@ SET(CTEST_NOTES_FILES # # Setup coverage: # + IF(COVERAGE) IF(NOT TRACK MATCHES "Experimental") MESSAGE(FATAL_ERROR " @@ -398,7 +443,6 @@ COVERAGE=TRUE. ENDIF() FIND_PROGRAM(GCOV_COMMAND NAMES gcov) - IF(GCOV_COMMAND MATCHES "-NOTFOUND") MESSAGE(FATAL_ERROR " Coverage enabled but could not find the gcov executable. Please install -- 2.39.5