summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ExternalData/LinkContentMD5.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-25 21:39:57 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-30 15:04:54 (GMT)
commit4befecc77caa97aeb450d9a2b6bcbe0985dc4054 (patch)
tree466fb00e26d9db362d64b530bc7bda952106e3d8 /Tests/RunCMake/ExternalData/LinkContentMD5.cmake
parentbcd25808ac540d279a36a9e0f1b60f152fc0d6bb (diff)
downloadCMake-4befecc77caa97aeb450d9a2b6bcbe0985dc4054.zip
CMake-4befecc77caa97aeb450d9a2b6bcbe0985dc4054.tar.gz
CMake-4befecc77caa97aeb450d9a2b6bcbe0985dc4054.tar.bz2
ExternalData: Add tests covering interfaces and errors
Add a Module.ExternalData test to verify data retrieval and test argument DATA{} references. Add a RunCMake.ExternalData test to verify error handling and automatic transformation of a raw data to a content link and staged object.
Diffstat (limited to 'Tests/RunCMake/ExternalData/LinkContentMD5.cmake')
-rw-r--r--Tests/RunCMake/ExternalData/LinkContentMD5.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalData/LinkContentMD5.cmake b/Tests/RunCMake/ExternalData/LinkContentMD5.cmake
new file mode 100644
index 0000000..41b4dee
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/LinkContentMD5.cmake
@@ -0,0 +1,22 @@
+include(ExternalData)
+set(ExternalData_LINK_CONTENT MD5)
+set(ExternalData_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR})
+set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData)
+set(input ${CMAKE_CURRENT_BINARY_DIR}/ToLink.txt)
+set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/ToLink.txt)
+set(staged "${CMAKE_CURRENT_BINARY_DIR}/.ExternalData_MD5_c18ff9804c8deec9eaeb17063cda8b7b")
+file(REMOVE ${staged})
+file(REMOVE ${input}.md5)
+file(WRITE ${input} "To be transformed into a content link.")
+ExternalData_Expand_Arguments(Data args DATA{${input}})
+if("x${args}" STREQUAL "x${output}")
+ message(STATUS "Raw data correctly transformed to content link!")
+else()
+ message(FATAL_ERROR "Data reference transformed to:\n ${args}\n"
+ "but we expected:\n ${output}")
+endif()
+if(EXISTS "${staged}")
+ message(STATUS "Staged content exists!")
+else()
+ message(FATAL_ERROR "Staged content missing!")
+endif()