summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-06-21 14:46:30 -0400
committerDavid Cole <david.cole@kitware.com>2010-06-21 14:46:30 -0400
commit4ee426b057186fd2f85301e71d65f3dfecace828 (patch)
treecaf8a626870e9bf01ff4a1730f461308813d5653
parente45a600a0fae6d8fe0de6bba10e3a6fab5204bb4 (diff)
downloadcmake-4ee426b057186fd2f85301e71d65f3dfecace828.tar.gz
Look in the ctest ini file for GitCommand.
If GIT_EXECUTABLE is not passed into the test, but the source tree is a git checkout, then use GitCommand or UpdateCommand from the ctest ini file to set its value. Presumably, a dashboard running the test suite had to have set this properly in order to do the ctest_update step.
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in54
1 files changed, 54 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index 39289f0a12..9150aef5bd 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -128,6 +128,51 @@ if(is_cvs_checkout AND CVS_EXECUTABLE)
endif()
+# If no GIT_EXECUTABLE, see if we can figure out which git was used
+# for the ctest_update step on this dashboard...
+#
+if(is_git_checkout AND NOT GIT_EXECUTABLE)
+ set(ctest_ini_file "")
+ set(exe "")
+
+ # Use the old name:
+ if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl")
+ set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl")
+ endif()
+
+ # But if it exists, prefer the new name:
+ if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini")
+ set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini")
+ endif()
+
+ # If there is a ctest ini file, read the update command or git command
+ # from it:
+ #
+ if(ctest_ini_file)
+ file(STRINGS "${ctest_ini_file}" lines REGEX "^GITCommand: (.*)$")
+ string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" exe "${lines}")
+ if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+ set(exe "")
+ endif()
+
+ if(NOT exe)
+ file(STRINGS "${ctest_ini_file}" lines REGEX "^UpdateCommand: (.*)$")
+ string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" exe "${lines}")
+ if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+ set(exe "")
+ endif()
+ endif()
+ endif()
+
+ if(exe)
+ set(GIT_EXECUTABLE "${exe}")
+ message("info: set GIT_EXECUTABLE to '${GIT_EXECUTABLE}' based on '${ctest_ini_file}'")
+ else()
+ message(FATAL_ERROR "could not determine GIT_EXECUTABLE based on '${ctest_ini_file}'...")
+ endif()
+endif()
+
+
if(is_git_checkout AND GIT_EXECUTABLE)
# Check with "git status" if there are any local modifications to the
# CMake source tree:
@@ -154,6 +199,15 @@ if(is_git_checkout AND GIT_EXECUTABLE)
message("=== end output ===")
message("")
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -1
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE git_log_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("=== output of 'git log -1' ===")
+ message("${git_log_output}")
+ message("=== end output ===")
+ message("")
+
message("Copy/paste this command to reproduce:")
message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status")
message("")