[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4062-g03556af

David Cole dcole at neocisinc.com
Fri Aug 30 10:48:32 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  03556af64277597a98025d2e638b01f54a215bb6 (commit)
       via  b49472264213b2d829e7c6d118660190f5238a14 (commit)
      from  5448723ee0ac88ef1f215e41a12c5d15558978aa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03556af64277597a98025d2e638b01f54a215bb6
commit 03556af64277597a98025d2e638b01f54a215bb6
Merge: 5448723 b494722
Author:     David Cole <dcole at neocisinc.com>
AuthorDate: Fri Aug 30 10:48:25 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Aug 30 10:48:25 2013 -0400

    Merge topic 'add-policy-version-test' into next
    
    b494722 Tests: Verify policies are introduced only in "official" versions


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b49472264213b2d829e7c6d118660190f5238a14
commit b49472264213b2d829e7c6d118660190f5238a14
Author:     David Cole <dcole at neocisinc.com>
AuthorDate: Tue Aug 27 23:47:36 2013 -0400
Commit:     David Cole <dcole at neocisinc.com>
CommitDate: Wed Aug 28 17:22:49 2013 -0400

    Tests: Verify policies are introduced only in "official" versions
    
    Add the CMake.PolicyCheck test.
    
    This test uses "git grep" to look for policies added in a "dated"
    version of CMake. It will fail if a policy is added as of,
    for example, CMake 2.8.11.20130828.
    
    The intent is to prevent such constructs from making it into an
    "official" release. Three instances actually appeared in the first
    attempted release candidate for 2.8.12.
    
    This test may sometimes yield false positives. After all, it's just
    using a regular expression to detect this condition, and something
    in a comment could possibly match it. As of right now, that's not
    true, but it's easy to imagine such a comment being added.
    
    The new test may also not catch all future problems of this sort.
    However, it will catch problems of this sort for all code that follows
    the present layout style in Source/cmPolicies.cxx.

diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 344b772..4c49c6a 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -55,6 +55,15 @@ set(GetPrerequisites_PreArgs
   )
 AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
 
+if(GIT_EXECUTABLE)
+  set(PolicyCheck_PreArgs
+    "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
+    "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
+    "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}"
+    )
+  AddCMakeTest(PolicyCheck "${PolicyCheck_PreArgs}")
+endif()
+
 # Run CheckSourceTree as the very last test in the CMake/CTest/CPack test
 # suite. It detects if any changes have been made to the CMake source tree
 # by any previous configure, build or test steps.
diff --git a/Tests/CMakeTests/PolicyCheckTest.cmake.in b/Tests/CMakeTests/PolicyCheckTest.cmake.in
new file mode 100644
index 0000000..416dc0a
--- /dev/null
+++ b/Tests/CMakeTests/PolicyCheckTest.cmake.in
@@ -0,0 +1,154 @@
+# Check the CMake source tree for suspicious policy introdcutions...
+#
+message("=============================================================================")
+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("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+message("")
+
+
+# If this does not appear to be a git checkout, just pass the test here
+# and now. (Do not let the test fail if it is run in a tree *exported* from a
+# repository or unpacked from a .zip file source installer...)
+#
+set(is_git_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/.git")
+  set(is_git_checkout 1)
+endif()
+
+message("is_git_checkout='${is_git_checkout}'")
+message("")
+
+if(NOT is_git_checkout)
+  message("source tree is not a git checkout... test passes by early return...")
+  return()
+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}" line REGEX "^GITCommand: (.*)$")
+    string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}")
+    if("${line}" MATCHES "^\"")
+      string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+    else()
+      string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+    endif()
+    set(exe "${line}")
+    if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+      set(exe "")
+    endif()
+    if(exe)
+      message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'")
+    endif()
+
+    if(NOT exe)
+      file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$")
+      string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}")
+      if("${line}" MATCHES "^\"")
+        string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+      else()
+        string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+      endif()
+      set(exe "${line}")
+      if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+        set(exe "")
+      endif()
+      if(exe)
+        message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'")
+      endif()
+    endif()
+  else()
+    message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...")
+  endif()
+
+  # If we have still not grokked the exe, look in the Update.xml file to see
+  # if we can parse it from there...
+  #
+  if(NOT exe)
+    file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml")
+    if(update_xml_file)
+      file(STRINGS "${update_xml_file}" line
+        REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1)
+      string(REPLACE "&quot\;" "\"" line "${line}")
+      string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}")
+      if("${line}" MATCHES "^\"")
+        string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+      else()
+        string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+      endif()
+      if(line)
+        set(exe "${line}")
+      endif()
+      if(exe)
+        message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'")
+      endif()
+    else()
+      message("info: no Update.xml file...")
+    endif()
+  endif()
+
+  if(exe)
+    set(GIT_EXECUTABLE "${exe}")
+    message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+    message("")
+
+    if(NOT EXISTS "${GIT_EXECUTABLE}")
+      message(FATAL_ERROR "GIT_EXECUTABLE does not exist...")
+    endif()
+  else()
+    message(FATAL_ERROR "could not determine GIT_EXECUTABLE...")
+  endif()
+endif()
+
+
+if(is_git_checkout AND GIT_EXECUTABLE)
+  # Check with "git grep" if there are any unacceptable cmPolicies additions
+  #
+  message("=============================================================================")
+  message("This is a git checkout, using git grep to verify no unacceptable policies")
+  message("are being introduced....")
+  message("")
+
+  execute_process(COMMAND ${GIT_EXECUTABLE} grep -En "[0-9][0-9][0-9][0-9][0-9].*cmPolicies"
+    WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+    OUTPUT_VARIABLE grep_output
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message("=== output of 'git grep -En \"[0-9][0-9][0-9][0-9][0-9].*cmPolicies\"' ===")
+  message("${grep_output}")
+  message("=== end output ===")
+  message("")
+
+  if(NOT "${grep_output}" STREQUAL "")
+    message(FATAL_ERROR "git grep output is non-empty...
+New CMake policies must be introduced in a non-date-based version number.
+Send email to the cmake-developers list to figure out what the target
+version number for this policy should be...")
+  endif()
+endif()
+
+
+# Still here? Good then...
+#
+message("test passes")
+message("")

-----------------------------------------------------------------------

Summary of changes:
 Tests/CMakeTests/CMakeLists.txt           |    9 ++
 Tests/CMakeTests/PolicyCheckTest.cmake.in |  154 +++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+), 0 deletions(-)
 create mode 100644 Tests/CMakeTests/PolicyCheckTest.cmake.in


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list