ENH: Improvements to the new CheckSourceTree test: ignore Thumbs.db and .DS_Store files. Force all output to stderr by not using STATUS with message. Better error text.
This commit is contained in:
parent
55718eb869
commit
32be77df8c
|
@ -1,99 +1,136 @@
|
||||||
# Check the CMake source tree and report anything suspicious...
|
# Check the CMake source tree and report anything suspicious...
|
||||||
#
|
#
|
||||||
message(STATUS
|
message("=============================================================================")
|
||||||
"=============================================================================")
|
message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
|
||||||
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
|
message("")
|
||||||
message(STATUS "")
|
message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
|
||||||
message(STATUS "CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
|
message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
|
||||||
message(STATUS "CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
|
message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
|
||||||
message(STATUS "ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
|
message("")
|
||||||
message(STATUS "")
|
|
||||||
|
|
||||||
|
|
||||||
# Check with "cvs -q -n up -dP" if there are any local modifications to the
|
# Check with "cvs -q -n up -dP" if there are any local modifications to the
|
||||||
# CMake source tree:
|
# CMake source tree:
|
||||||
#
|
#
|
||||||
message(STATUS "")
|
message("=============================================================================")
|
||||||
message(STATUS
|
message("Copy/paste this command to reproduce:")
|
||||||
"=============================================================================")
|
message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP")
|
||||||
|
message("")
|
||||||
execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP
|
execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP
|
||||||
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE ov
|
OUTPUT_VARIABLE ov
|
||||||
ERROR_VARIABLE ev
|
ERROR_VARIABLE ev
|
||||||
RESULT_VARIABLE rv)
|
RESULT_VARIABLE rv)
|
||||||
|
|
||||||
|
message("Results of running '${CVS_EXECUTABLE} -q -n up -dP'")
|
||||||
|
message("rv='${rv}'")
|
||||||
|
message("ov='${ov}'")
|
||||||
|
message("ev='${ev}'")
|
||||||
|
message("")
|
||||||
|
|
||||||
|
# Analyze cvs output:
|
||||||
|
#
|
||||||
set(additions 0)
|
set(additions 0)
|
||||||
set(conflicts 0)
|
set(conflicts 0)
|
||||||
set(modifications 0)
|
set(modifications 0)
|
||||||
|
set(nonadditions 0)
|
||||||
|
|
||||||
if(NOT ov STREQUAL "")
|
if(NOT ov STREQUAL "")
|
||||||
string(REPLACE "\\\\;" ";" lines "${ov}")
|
string(REPLACE ";" "\\\\;" lines "${ov}")
|
||||||
string(REPLACE "\n" "E;" lines "${lines}")
|
string(REPLACE "\n" "E;" lines "${lines}")
|
||||||
|
|
||||||
foreach(line ${lines})
|
foreach(line ${lines})
|
||||||
message(STATUS "${line}")
|
message("'${line}'")
|
||||||
|
|
||||||
if(line MATCHES "^\\? ")
|
# But do not consider files that exist just because some user poked around
|
||||||
message(STATUS "locally added file/directory detected...")
|
# the file system with Windows Explorer or with the Finder from a Mac...
|
||||||
set(additions 1)
|
# ('Thumbs.db' and '.DS_Store' files...)
|
||||||
|
#
|
||||||
|
set(consider 1)
|
||||||
|
set(ignore_files_regex "^(. |.*(/|\\\\))(\\.DS_Store|Thumbs.db)E$")
|
||||||
|
if(line MATCHES "${ignore_files_regex}")
|
||||||
|
message(" line matches '${ignore_files_regex}' -- not considered")
|
||||||
|
set(consider 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(line MATCHES "^C ")
|
if(consider)
|
||||||
message(STATUS "conflict detected...")
|
if(line MATCHES "^A ")
|
||||||
set(conflicts 1)
|
message(" locally added file/directory detected...")
|
||||||
endif()
|
set(additions 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(line MATCHES "^M ")
|
if(line MATCHES "^C ")
|
||||||
message(STATUS "locally modified file detected...")
|
message(" conflict detected...")
|
||||||
set(modifications 1)
|
set(conflicts 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(line MATCHES "^M ")
|
||||||
|
message(" locally modified file detected...")
|
||||||
|
set(modifications 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(line MATCHES "^\\? ")
|
||||||
|
message(" locally non-added file/directory detected...")
|
||||||
|
set(nonadditions 1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Results of running '${CVS_EXECUTABLE} -q -n up -dP'")
|
message("=============================================================================")
|
||||||
message(STATUS "rv='${rv}'")
|
message("additions='${additions}'")
|
||||||
message(STATUS "ov='${ov}'")
|
message("conflicts='${conflicts}'")
|
||||||
message(STATUS "ev='${ev}'")
|
message("modifications='${modifications}'")
|
||||||
message(STATUS "")
|
message("nonadditions='${nonadditions}'")
|
||||||
message(STATUS "additions='${additions}'")
|
message("")
|
||||||
message(STATUS "conflicts='${conflicts}'")
|
|
||||||
message(STATUS "modifications='${modifications}'")
|
|
||||||
|
|
||||||
|
|
||||||
# Decide if the test passes or fails:
|
# Decide if the test passes or fails:
|
||||||
#
|
#
|
||||||
message(STATUS "")
|
message("=============================================================================")
|
||||||
message(STATUS
|
|
||||||
"=============================================================================")
|
|
||||||
|
|
||||||
if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
|
if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
|
||||||
|
|
||||||
# developers are allowed to have local modifications...
|
# developers are allowed to have local additions and modifications...
|
||||||
message(STATUS "interactive test run")
|
message("interactive test run")
|
||||||
message(STATUS "")
|
message("")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
message(STATUS "dashboard test run")
|
message("dashboard test run")
|
||||||
message(STATUS "")
|
message("")
|
||||||
|
|
||||||
# but dashboard machines are not allowed to have local modifications...
|
# but dashboard machines are not allowed to have local additions or modifications...
|
||||||
if(modifications)
|
if(additions)
|
||||||
message(FATAL_ERROR "test fails: source tree modifications")
|
message(FATAL_ERROR "test fails: local source tree additions")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(modifications)
|
||||||
|
message(FATAL_ERROR "test fails: local source tree modifications")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# It's a dashboard run if ctest was run with '-D ExperimentalTest' or some other
|
||||||
|
# -D arg on its command line or if ctest is running a -S script to run a dashboard...
|
||||||
|
# Running ctest like that causes the DASHBOARD_TEST_FROM_CTEST env var to be set.
|
||||||
|
#
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ...and nobody is allowed to have local additions or conflicts...
|
|
||||||
|
# ...and nobody is allowed to have local non-additions or conflicts...
|
||||||
# Not even developers.
|
# Not even developers.
|
||||||
#
|
#
|
||||||
if(additions)
|
if(nonadditions)
|
||||||
message(FATAL_ERROR "test fails: source tree additions: use cvs add before committing or remove the files from the source tree")
|
message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(conflicts)
|
if(conflicts)
|
||||||
message(FATAL_ERROR "test fails: source tree conflicts: resolve before committing")
|
message(FATAL_ERROR "test fails: local source tree conflicts: resolve before committing")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "test passes")
|
|
||||||
message(STATUS "")
|
# Still here? Good then...
|
||||||
|
#
|
||||||
|
message("test passes")
|
||||||
|
message("")
|
||||||
|
|
Loading…
Reference in New Issue