diff options
author | Brad King <brad.king@kitware.com> | 2015-02-25 13:11:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-25 13:28:05 (GMT) |
commit | f7f4ca55bde68b174b7542fe417426a7cbf76fe3 (patch) | |
tree | ae52bbf6b9dd2af24e63661542f736cb7b06886c /Tests/Module | |
parent | ac80f0f95fc7cfbad17c2a5656a87e346b9f298a (diff) | |
download | CMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.zip CMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.tar.gz CMake-f7f4ca55bde68b174b7542fe417426a7cbf76fe3.tar.bz2 |
ExternalData: Add support for custom algorithm-to-URL mapping
Allow URL templates to contain a %(algo:<key>) placeholder that is
replaced by mapping the canonical hash algorithm name through a map
defined by the <key>.
Extend the Module.ExternalData test to cover the behavior.
Extend the RunCMake.ExternalData test to cover error cases.
Diffstat (limited to 'Tests/Module')
6 files changed, 16 insertions, 0 deletions
diff --git a/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 b/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 new file mode 100644 index 0000000..fa0cb1a --- /dev/null +++ b/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 @@ -0,0 +1 @@ +DataAlgoMap
\ No newline at end of file diff --git a/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 b/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 new file mode 100644 index 0000000..fa0cb1a --- /dev/null +++ b/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 @@ -0,0 +1 @@ +DataAlgoMap
\ No newline at end of file diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index f99f6af..6c5e59c 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -10,8 +10,10 @@ if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") endif() set(ExternalData_URL_TEMPLATES "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/Alt/%(algo:MyAlgoMap1)/%(hash)" "ExternalDataCustomScript://MyScript1/%(algo)/%(hash)" ) +set(ExternalData_URL_ALGO_MD5_MyAlgoMap1 MyAlgoMap1-md5) set(ExternalData_CUSTOM_SCRIPT_MyScript1 "${CMAKE_CURRENT_SOURCE_DIR}/MyScript1.cmake") set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData") file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test @@ -26,6 +28,8 @@ ExternalData_Add_Test(Data1 -D Data=DATA{Data.dat} ${Data1CheckSpaces} -D DataScript=DATA{DataScript.dat} + -D DataAlgoMapA=DATA{DataAlgoMapA.dat} + -D DataAlgoMapB=DATA{DataAlgoMapB.dat} -D DataMissing=DATA{DataMissing.dat} -D DataMissingWithAssociated=DATA{DataMissing.dat,Data.dat} -D SeriesA=DATA{SeriesA.dat,:} diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake index a7aa4ae..9845a3b 100644 --- a/Tests/Module/ExternalData/Data1Check.cmake +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -12,6 +12,14 @@ file(STRINGS "${DataScript}" lines LIMIT_INPUT 1024) if(NOT "x${lines}" STREQUAL "xDataScript") message(SEND_ERROR "Input file:\n ${DataScript}\ndoes not have expected content, but [[${lines}]]") endif() +file(STRINGS "${DataAlgoMapA}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xDataAlgoMap") + message(SEND_ERROR "Input file:\n ${DataAlgoMapA}\ndoes not have expected content, but [[${lines}]]") +endif() +file(STRINGS "${DataAlgoMapB}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xDataAlgoMap") + message(SEND_ERROR "Input file:\n ${DataAlgoMapB}\ndoes not have expected content, but [[${lines}]]") +endif() if(DataMissing) if(EXISTS "${DataMissing}") message(SEND_ERROR diff --git a/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 b/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 new file mode 100644 index 0000000..7281481 --- /dev/null +++ b/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 @@ -0,0 +1 @@ +dded55e43cd6529ee35d24113dfc87a3 diff --git a/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 b/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 new file mode 100644 index 0000000..4fd7c06 --- /dev/null +++ b/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 @@ -0,0 +1 @@ +85158f0c1996837976e858c42a9a7634bfe91b93 |