[Cmake-commits] [cmake-commits] david.cole committed CMakeLists.txt 1.15 1.16 CheckSourceTreeTest.cmake.in 1.3 1.4

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jul 27 12:04:06 EDT 2009


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

Modified Files:
	CMakeLists.txt CheckSourceTreeTest.cmake.in 
Log Message:
ENH: Make the CheckSourceTree test emit a warning (but pass instead of fail) when there is an in-source build on a dashboard machine.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CMakeLists.txt,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** CMakeLists.txt	24 Jul 2009 21:28:54 -0000	1.15
--- CMakeLists.txt	27 Jul 2009 16:04:02 -0000	1.16
***************
*** 33,36 ****
--- 33,37 ----
  if(do_cvs_tests)
    set(CheckSourceTree_PreArgs
+     "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
      "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
      "-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}"

Index: CheckSourceTreeTest.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CheckSourceTreeTest.cmake.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** CheckSourceTreeTest.cmake.in	25 Jul 2009 17:32:07 -0000	1.3
--- CheckSourceTreeTest.cmake.in	27 Jul 2009 16:04:03 -0000	1.4
***************
*** 4,7 ****
--- 4,8 ----
  message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
  message("")
+ message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
  message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
  message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
***************
*** 10,13 ****
--- 11,44 ----
  
  
+ # Is the build directory the same as or underneath the source directory?
+ # (i.e. - is it an "in source" build?)
+ #
+ set(in_source_build 0)
+ 
+ if(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
+   message("build dir *is* source dir")
+   set(in_source_build 1)
+ else()
+   string(LENGTH "${CMake_SOURCE_DIR}" src_len)
+   string(LENGTH "${CMake_BINARY_DIR}" bin_len)
+ 
+   if(bin_len GREATER src_len)
+     math(EXPR substr_len "${src_len}+1")
+     string(SUBSTRING "${CMake_BINARY_DIR}" 0 ${substr_len} bin_dir)
+     if(bin_dir STREQUAL "${CMake_SOURCE_DIR}/")
+       message("build dir is under source dir")
+       set(in_source_build 1)
+     endif()
+   endif()
+ endif()
+ 
+ message("src_len='${src_len}'")
+ message("bin_len='${bin_len}'")
+ message("substr_len='${substr_len}'")
+ message("bin_dir='${bin_dir}'")
+ message("in_source_build='${in_source_build}'")
+ message("")
+ 
+ 
  # Check with "cvs -q -n up -dP" if there are any local modifications to the
  # CMake source tree:
***************
*** 93,96 ****
--- 124,128 ----
  
    # developers are allowed to have local additions and modifications...
+   set(is_dashboard 0)
    message("interactive test run")
    message("")
***************
*** 98,101 ****
--- 130,134 ----
  else()
  
+   set(is_dashboard 1)
    message("dashboard test run")
    message("")
***************
*** 111,117 ****
  
    #
!   # 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.
    #
  
--- 144,151 ----
  
    #
!   # 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 sets the DASHBOARD_TEST_FROM_CTEST
!   # env var.
    #
  
***************
*** 123,127 ****
  #
  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()
  
--- 157,173 ----
  #
  if(nonadditions)
!   if(in_source_build AND is_dashboard)
!     message("
! warning: test results confounded because this is an 'in-source' build - cannot
! distinguish between non-added files that are in-source build products and
! non-added source files that somebody forgot to 'cvs add'... - this is only ok
! if this is intentionally an in-source dashboard build... Developers should
! use out-of-source builds to verify a clean source tree with this test...
! 
! Allowing test to pass despite the warning message...
! ")
!   else()
!     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()
  



More information about the Cmake-commits mailing list