[Cmake-commits] [cmake-commits] david.cole committed CheckSourceTreeTest.cmake.in 1.2 1.3

cmake-commits at cmake.org cmake-commits at cmake.org
Sat Jul 25 13:32:09 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/CMakeTests
In directory public:/mounts/ram/cvs-serv12578/Tests/CMakeTests

Modified Files:
	CheckSourceTreeTest.cmake.in 
Log Message:
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.


Index: CheckSourceTreeTest.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CheckSourceTreeTest.cmake.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** CheckSourceTreeTest.cmake.in	24 Jul 2009 21:12:37 -0000	1.2
--- CheckSourceTreeTest.cmake.in	25 Jul 2009 17:32:07 -0000	1.3
***************
*** 1,12 ****
  # Check the CMake source tree and report anything suspicious...
  #
! message(STATUS
!   "=============================================================================")
! message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
! message(STATUS "")
! message(STATUS "CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
! message(STATUS "CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
! message(STATUS "ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
! message(STATUS "")
  
  
--- 1,11 ----
  # Check the CMake source tree and report anything suspicious...
  #
! message("=============================================================================")
! message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
! message("")
! message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
! message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
! message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
! message("")
  
  
***************
*** 14,20 ****
  # CMake source tree:
  #
! message(STATUS "")
! message(STATUS
!   "=============================================================================")
  execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP
    WORKING_DIRECTORY ${CMake_SOURCE_DIR}
--- 13,20 ----
  # CMake source tree:
  #
! message("=============================================================================")
! 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
    WORKING_DIRECTORY ${CMake_SOURCE_DIR}
***************
*** 23,99 ****
    RESULT_VARIABLE rv)
  
  set(additions 0)
  set(conflicts 0)
  set(modifications 0)
  
  if(NOT ov STREQUAL "")
!   string(REPLACE "\\\\;" ";" lines "${ov}")
    string(REPLACE "\n" "E;" lines "${lines}")
  
    foreach(line ${lines})
!     message(STATUS "${line}")
  
!     if(line MATCHES "^\\? ")
!       message(STATUS "locally added file/directory detected...")
!       set(additions 1)
      endif()
  
!     if(line MATCHES "^C ")
!       message(STATUS "conflict detected...")
!       set(conflicts 1)
!     endif()
  
!     if(line MATCHES "^M ")
!       message(STATUS "locally modified file detected...")
!       set(modifications 1)
      endif()
    endforeach()
  endif()
  
! message(STATUS "Results of running '${CVS_EXECUTABLE} -q -n up -dP'")
! message(STATUS "rv='${rv}'")
! message(STATUS "ov='${ov}'")
! message(STATUS "ev='${ev}'")
! message(STATUS "")
! message(STATUS "additions='${additions}'")
! message(STATUS "conflicts='${conflicts}'")
! message(STATUS "modifications='${modifications}'")
  
  
  # Decide if the test passes or fails:
  #
! message(STATUS "")
! message(STATUS
!   "=============================================================================")
  
  if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
  
!   # developers are allowed to have local modifications...
!   message(STATUS "interactive test run")
!   message(STATUS "")
  
  else()
  
!   message(STATUS "dashboard test run")
!   message(STATUS "")
  
-   # but dashboard machines are not allowed to have local modifications...
    if(modifications)
!     message(FATAL_ERROR "test fails: source tree modifications")
    endif()
  
  endif()
  
! # ...and nobody is allowed to have local additions or conflicts...
  # Not even developers.
  #
! if(additions)
!   message(FATAL_ERROR "test fails: source tree additions: use cvs add before committing or remove the files from the source tree")
  endif()
  
  if(conflicts)
!   message(FATAL_ERROR "test fails: source tree conflicts: resolve before committing")
  endif()
  
! message(STATUS "test passes")
! message(STATUS "")
--- 23,136 ----
    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(conflicts 0)
  set(modifications 0)
+ set(nonadditions 0)
  
  if(NOT ov STREQUAL "")
!   string(REPLACE ";" "\\\\;" lines "${ov}")
    string(REPLACE "\n" "E;" lines "${lines}")
  
    foreach(line ${lines})
!     message("'${line}'")
  
!     # But do not consider files that exist just because some user poked around
!     # the file system with Windows Explorer or with the Finder from a Mac...
!     # ('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()
  
!     if(consider)
!       if(line MATCHES "^A ")
!         message("   locally added file/directory detected...")
!         set(additions 1)
!       endif()
  
!       if(line MATCHES "^C ")
!         message("   conflict detected...")
!         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()
    endforeach()
  endif()
  
! message("=============================================================================")
! message("additions='${additions}'")
! message("conflicts='${conflicts}'")
! message("modifications='${modifications}'")
! message("nonadditions='${nonadditions}'")
! message("")
  
  
  # Decide if the test passes or fails:
  #
! message("=============================================================================")
  
  if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
  
!   # developers are allowed to have local additions and modifications...
!   message("interactive test run")
!   message("")
  
  else()
  
!   message("dashboard test run")
!   message("")
! 
!   # but dashboard machines are not allowed to have local additions or modifications...
!   if(additions)
!     message(FATAL_ERROR "test fails: local source tree additions")
!   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()
  
! 
! # ...and nobody is allowed to have local non-additions or conflicts...
  # Not even developers.
  #
! if(nonadditions)
!   message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
  endif()
  
  if(conflicts)
!   message(FATAL_ERROR "test fails: local source tree conflicts: resolve before committing")
  endif()
  
! 
! # Still here? Good then...
! #
! message("test passes")
! message("")



More information about the Cmake-commits mailing list