[Cmake-commits] [cmake-commits] king committed CTestUpdateCommon.cmake 1.8 1.9
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Feb 9 13:31:22 EST 2010
Update of /cvsroot/CMake/CMake/Tests
In directory public:/mounts/ram/cvs-serv12843/Tests
Modified Files:
CTestUpdateCommon.cmake
Log Message:
Teach CTest.Update tests to strongly check entries
Previously these tests just checked for matching file names in the
Update.xml files. Now we check the update types (Updated, Modified, or
Conflicting) and reject unexpected extra entries.
Index: CTestUpdateCommon.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CTestUpdateCommon.cmake,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** CTestUpdateCommon.cmake 18 Dec 2009 16:01:23 -0000 1.8
--- CTestUpdateCommon.cmake 9 Feb 2010 18:31:20 -0000 1.9
***************
*** 31,48 ****
# Read entries from the Update.xml file
file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_ENTRIES
! REGEX "FullName"
LIMIT_INPUT 4096
)
! # Verify that expected entries exist
! set(MISSING)
! foreach(f ${ARGN})
! string(REPLACE "/" "[/\\\\]" regex "${f}")
! string(REPLACE "." "\\." regex "${regex}")
! if(NOT "${UPDATE_XML_ENTRIES}" MATCHES "<FullName>${regex}</FullName>")
! list(APPEND MISSING ${f})
! endif()
! endforeach(f)
if(NOT UPDATE_NOT_GLOBAL)
--- 31,48 ----
# Read entries from the Update.xml file
+ set(types "Updated|Modified|Conflicting")
file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_ENTRIES
! REGEX "<(${types}|FullName)>"
LIMIT_INPUT 4096
)
+ string(REGEX REPLACE
+ "[ \t]*<(${types})>[ \t]*;[ \t]*<FullName>([^<]*)</FullName>"
+ "\\1{\\2}" UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}")
! # Compare expected and actual entries
! set(EXTRA "${UPDATE_XML_ENTRIES}")
! list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_MAYBE})
! set(MISSING "${ARGN}")
! list(REMOVE_ITEM MISSING ${UPDATE_XML_ENTRIES})
if(NOT UPDATE_NOT_GLOBAL)
***************
*** 66,76 ****
# Report the result
if(MISSING)
# List the missing entries
! set(MSG "Update.xml is missing an entry for:\n")
foreach(f ${MISSING})
set(MSG "${MSG} ${f}\n")
endforeach(f)
# Provide the log file
file(GLOB UPDATE_LOG_FILE
--- 66,94 ----
# Report the result
+ set(MSG "")
if(MISSING)
# List the missing entries
! set(MSG "${MSG}Update.xml is missing expected entries:\n")
foreach(f ${MISSING})
set(MSG "${MSG} ${f}\n")
endforeach(f)
+ else(MISSING)
+ # Success
+ message(" no entries missing from Update.xml")
+ endif(MISSING)
+
+ # Report the result
+ if(EXTRA)
+ # List the extra entries
+ set(MSG "${MSG}Update.xml has extra unexpected entries:\n")
+ foreach(f ${EXTRA})
+ set(MSG "${MSG} ${f}\n")
+ endforeach(f)
+ else(EXTRA)
+ # Success
+ message(" no extra entries in Update.xml")
+ endif(EXTRA)
+ if(MSG)
# Provide the log file
file(GLOB UPDATE_LOG_FILE
***************
*** 86,93 ****
# Display the error message
message(FATAL_ERROR "${MSG}")
! else(MISSING)
! # Success
! message(" no entries missing from Update.xml")
! endif(MISSING)
endfunction(check_updates)
--- 104,108 ----
# Display the error message
message(FATAL_ERROR "${MSG}")
! endif(MSG)
endfunction(check_updates)
***************
*** 176,181 ****
# Verify the updates reported by CTest.
! check_updates(${bin_dir} foo.txt bar.txt zot.txt CTestConfig.cmake
! subdir/foo.txt subdir/bar.txt)
endfunction(run_dashboard_command_line)
--- 191,203 ----
# Verify the updates reported by CTest.
! set(UPDATE_MAYBE Updated{subdir})
! check_updates(${bin_dir}
! Updated{foo.txt}
! Updated{bar.txt}
! Updated{zot.txt}
! Updated{subdir/foo.txt}
! Updated{subdir/bar.txt}
! Modified{CTestConfig.cmake}
! )
endfunction(run_dashboard_command_line)
***************
*** 189,194 ****
# Verify the updates reported by CTest.
! check_updates(dash-binary foo.txt bar.txt zot.txt
! subdir/foo.txt subdir/bar.txt)
endfunction(run_dashboard_script)
--- 211,222 ----
# Verify the updates reported by CTest.
! set(UPDATE_MAYBE Updated{subdir})
! check_updates(dash-binary
! Updated{foo.txt}
! Updated{bar.txt}
! Updated{zot.txt}
! Updated{subdir/foo.txt}
! Updated{subdir/bar.txt}
! )
endfunction(run_dashboard_script)
More information about the Cmake-commits
mailing list