diff options
author | Brad King <brad.king@kitware.com> | 2013-01-25 21:39:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-30 15:04:54 (GMT) |
commit | 4befecc77caa97aeb450d9a2b6bcbe0985dc4054 (patch) | |
tree | 466fb00e26d9db362d64b530bc7bda952106e3d8 | |
parent | bcd25808ac540d279a36a9e0f1b60f152fc0d6bb (diff) | |
download | CMake-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.
123 files changed, 554 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0c75892..c21922e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -312,6 +312,18 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) + add_test(Module.ExternalData ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Module/ExternalData" + "${CMake_BINARY_DIR}/Tests/Module/ExternalData" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project ExternalDataTest + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") + ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader) if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt new file mode 100644 index 0000000..5532610 --- /dev/null +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 2.8.10.20130115) +project(ExternalDataTest NONE) + +include(CTest) + +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData") +file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test + +ExternalData_Add_Test(Data1 + NAME Data1Check + COMMAND ${CMAKE_COMMAND} + -D Data=DATA{Data.dat} + -D SeriesA=DATA{SeriesA.dat,:} + -D SeriesB=DATA{SeriesB.dat,:} + -D SeriesC=DATA{SeriesC.dat,:} + -D SeriesD=DATA{SeriesD.dat,:} + -D SeriesAn=DATA{SeriesAn1.dat,:} + -D SeriesBn=DATA{SeriesBn_1.dat,:} + -D SeriesCn=DATA{SeriesCn.1.dat,:} + -D SeriesDn=DATA{SeriesDn-1.dat,:} + -D Paired=DATA{PairedA.dat,PairedB.dat} + -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake + ) +ExternalData_Add_Target(Data1) + +add_subdirectory(Data2) +add_subdirectory(Data3) diff --git a/Tests/Module/ExternalData/Data.dat.md5 b/Tests/Module/ExternalData/Data.dat.md5 new file mode 100644 index 0000000..70e39bd --- /dev/null +++ b/Tests/Module/ExternalData/Data.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake new file mode 100644 index 0000000..fd18cdf --- /dev/null +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -0,0 +1,40 @@ +file(STRINGS "${Data}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${Data}\ndoes not have expected content, but [[${lines}]]") +endif() +set(SeriesAn1 "1\\.dat") +set(SeriesBn1 "_1\\.dat") +set(SeriesCn1 "\\.1\\.dat") +set(SeriesDn1 "-1\\.dat") +set(SeriesAl 1 2 3) +set(SeriesBl _1 _2 _3) +set(SeriesCl .1 .2 .3) +set(SeriesDl -1 -2 -3) +foreach(s A B C D) + foreach(n "" ${Series${s}l}) + string(REGEX REPLACE "\\.dat$" "${n}.dat" file "${Series${s}}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() + endforeach() +endforeach() +foreach(s A B C D) + foreach(n ${Series${s}l}) + string(REGEX REPLACE "${Series${s}n1}$" "${n}.dat" file "${Series${s}n}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() + endforeach() +endforeach() +foreach(n A B) + string(REGEX REPLACE "A\\.dat$" "${n}.dat" file "${Paired}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() +foreach(n Top A B C) + string(REGEX REPLACE "Top\\.dat$" "${n}.dat" file "${Meta}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data2.dat.md5 b/Tests/Module/ExternalData/Data2.dat.md5 new file mode 100644 index 0000000..70e39bd --- /dev/null +++ b/Tests/Module/ExternalData/Data2.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data2/CMakeLists.txt b/Tests/Module/ExternalData/Data2/CMakeLists.txt new file mode 100644 index 0000000..f8eedff --- /dev/null +++ b/Tests/Module/ExternalData/Data2/CMakeLists.txt @@ -0,0 +1,10 @@ +set(ExternalData_SERIES_PARSE "([0-9]+)(_\\.my\\.dat)$") +set(ExternalData_SERIES_MATCH "[0-9]+") +ExternalData_Add_Test(Data2 + NAME Data2Check + COMMAND ${CMAKE_COMMAND} + -D Data2=DATA{../Data2.dat} + -D SeriesC=DATA{SeriesC_1_.my.dat,:} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data2Check.cmake + ) +ExternalData_Add_Target(Data2) diff --git a/Tests/Module/ExternalData/Data2/Data2Check.cmake b/Tests/Module/ExternalData/Data2/Data2Check.cmake new file mode 100644 index 0000000..a1dd509 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/Data2Check.cmake @@ -0,0 +1,9 @@ +if(NOT EXISTS "${Data2}") + message(SEND_ERROR "Input file:\n ${Data2}\ndoes not exist!") +endif() +foreach(n 1 2 3) + string(REGEX REPLACE "_1_\\.my\\.dat$" "_${n}_.my.dat" SeriesCFile "${SeriesC}") + if(NOT EXISTS "${SeriesCFile}") + message(SEND_ERROR "Input file:\n ${SeriesCFile}\ndoes not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/Data3/CMakeLists.txt b/Tests/Module/ExternalData/Data3/CMakeLists.txt new file mode 100644 index 0000000..a7c2b6e --- /dev/null +++ b/Tests/Module/ExternalData/Data3/CMakeLists.txt @@ -0,0 +1,14 @@ +set(Store0 ${CMAKE_BINARY_DIR}/ExternalData/Other) +set(Store1 ${CMAKE_BINARY_DIR}/ExternalData/Objects) +set(ExternalData_OBJECT_STORES ${Store0} ${Store1}) +ExternalData_Add_Test(Data3 + NAME Data3Check + COMMAND ${CMAKE_COMMAND} + -D Data=DATA{Data.dat} + -D Other=DATA{Other.dat} + -D Store0=${Store0} + -D Store1=${Store1} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data3Check.cmake + ) +ExternalData_Add_Target(Data3) +add_dependencies(Data3 Data1 Data2) diff --git a/Tests/Module/ExternalData/Data3/Data.dat.md5 b/Tests/Module/ExternalData/Data3/Data.dat.md5 new file mode 100644 index 0000000..70e39bd --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Data.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data3/Data3Check.cmake b/Tests/Module/ExternalData/Data3/Data3Check.cmake new file mode 100644 index 0000000..de98839 --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Data3Check.cmake @@ -0,0 +1,25 @@ +if(NOT EXISTS "${Data}") + message(SEND_ERROR "Input file:\n ${Data}\ndoes not exist!") +endif() +if(NOT EXISTS "${Other}") + message(SEND_ERROR "Input file:\n ${Other}\ndoes not exist!") +endif() +# Verify that the 'Data' object was found in the second store location left +# from Data1 target downloads and that the 'Other' object was downloaded to +# our first store location. Neither object should exist in the other store. +foreach(should_exist + "${Store0}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + "${Store1}/MD5/8c018830e3efa5caf3c7415028335a57" + ) + if(NOT EXISTS ${should_exist}) + message(SEND_ERROR "Store file:\n ${should_exist}\nshould exist!") + endif() +endforeach() +foreach(should_not_exist + "${Store0}/MD5/8c018830e3efa5caf3c7415028335a57" + "${Store1}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + ) + if(EXISTS ${should_not_exist}) + message(SEND_ERROR "Store file:\n ${should_not_exist}\nshould not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data3/Other.dat.md5 b/Tests/Module/ExternalData/Data3/Other.dat.md5 new file mode 100644 index 0000000..5312faa --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Other.dat.md5 @@ -0,0 +1 @@ +aaad162b85f60d1eb57ca71a23e8efd7 diff --git a/Tests/Module/ExternalData/MD5/.gitattributes b/Tests/Module/ExternalData/MD5/.gitattributes new file mode 100644 index 0000000..3e51d39 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 b/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 new file mode 100644 index 0000000..a689e3c --- /dev/null +++ b/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 @@ -0,0 +1 @@ +MetaTop diff --git a/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 b/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 new file mode 100644 index 0000000..5491241 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 @@ -0,0 +1 @@ +Series.3 diff --git a/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b b/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b new file mode 100644 index 0000000..4d0475e --- /dev/null +++ b/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b @@ -0,0 +1 @@ +Series.1 diff --git a/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 b/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 new file mode 100644 index 0000000..9dec116 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 @@ -0,0 +1 @@ +PairedA diff --git a/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 b/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 new file mode 100644 index 0000000..fa701e2 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 @@ -0,0 +1 @@ +Input file already transformed. diff --git a/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 b/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 new file mode 100644 index 0000000..69ba09c --- /dev/null +++ b/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 @@ -0,0 +1 @@ +MetaB diff --git a/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 b/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 new file mode 100644 index 0000000..000e7b2 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 @@ -0,0 +1 @@ +MetaA diff --git a/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 b/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 new file mode 100644 index 0000000..df0510c --- /dev/null +++ b/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 @@ -0,0 +1 @@ +Another input file already transformed. diff --git a/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 b/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 new file mode 100644 index 0000000..3fac5e6 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 @@ -0,0 +1 @@ +MetaC diff --git a/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 b/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 new file mode 100644 index 0000000..8c414f5 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 @@ -0,0 +1 @@ +PairedB diff --git a/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 b/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 new file mode 100644 index 0000000..3503da4 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 @@ -0,0 +1 @@ +Series diff --git a/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 b/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 new file mode 100644 index 0000000..29d727b --- /dev/null +++ b/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 @@ -0,0 +1 @@ +Series.2 diff --git a/Tests/Module/ExternalData/MetaA.dat.md5 b/Tests/Module/ExternalData/MetaA.dat.md5 new file mode 100644 index 0000000..4a78fc7 --- /dev/null +++ b/Tests/Module/ExternalData/MetaA.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/MetaB.dat.md5 b/Tests/Module/ExternalData/MetaB.dat.md5 new file mode 100644 index 0000000..4557a21 --- /dev/null +++ b/Tests/Module/ExternalData/MetaB.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/MetaC.dat.md5 b/Tests/Module/ExternalData/MetaC.dat.md5 new file mode 100644 index 0000000..a7f23dd --- /dev/null +++ b/Tests/Module/ExternalData/MetaC.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/MetaTop.dat.md5 b/Tests/Module/ExternalData/MetaTop.dat.md5 new file mode 100644 index 0000000..1906cbf --- /dev/null +++ b/Tests/Module/ExternalData/MetaTop.dat.md5 @@ -0,0 +1 @@ +08cfcf221f76ace7b906b312284e73d7 diff --git a/Tests/Module/ExternalData/PairedA.dat.md5 b/Tests/Module/ExternalData/PairedA.dat.md5 new file mode 100644 index 0000000..1ffe035 --- /dev/null +++ b/Tests/Module/ExternalData/PairedA.dat.md5 @@ -0,0 +1 @@ +401767f22a456b3522953722090a2c36 diff --git a/Tests/Module/ExternalData/PairedB.dat.md5 b/Tests/Module/ExternalData/PairedB.dat.md5 new file mode 100644 index 0000000..89c942b --- /dev/null +++ b/Tests/Module/ExternalData/PairedB.dat.md5 @@ -0,0 +1 @@ +ecfa1ecd417d4253af81ae04d1bd6581 diff --git a/Tests/Module/ExternalData/SeriesA.dat.md5 b/Tests/Module/ExternalData/SeriesA.dat.md5 new file mode 100644 index 0000000..be2d687 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesA1.dat.md5 b/Tests/Module/ExternalData/SeriesA1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesA2.dat.md5 b/Tests/Module/ExternalData/SeriesA2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesA3.dat.md5 b/Tests/Module/ExternalData/SeriesA3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesAn1.dat.md5 b/Tests/Module/ExternalData/SeriesAn1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesAn2.dat.md5 b/Tests/Module/ExternalData/SeriesAn2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesAn3.dat.md5 b/Tests/Module/ExternalData/SeriesAn3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesB.dat.md5 b/Tests/Module/ExternalData/SeriesB.dat.md5 new file mode 100644 index 0000000..be2d687 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesB_1.dat.md5 b/Tests/Module/ExternalData/SeriesB_1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesB_2.dat.md5 b/Tests/Module/ExternalData/SeriesB_2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesB_3.dat.md5 b/Tests/Module/ExternalData/SeriesB_3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesBn_1.dat.md5 b/Tests/Module/ExternalData/SeriesBn_1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesBn_2.dat.md5 b/Tests/Module/ExternalData/SeriesBn_2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesBn_3.dat.md5 b/Tests/Module/ExternalData/SeriesBn_3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesC.1.dat.md5 b/Tests/Module/ExternalData/SeriesC.1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesC.2.dat.md5 b/Tests/Module/ExternalData/SeriesC.2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesC.3.dat.md5 b/Tests/Module/ExternalData/SeriesC.3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesC.dat.md5 b/Tests/Module/ExternalData/SeriesC.dat.md5 new file mode 100644 index 0000000..be2d687 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesCn.1.dat.md5 b/Tests/Module/ExternalData/SeriesCn.1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesCn.2.dat.md5 b/Tests/Module/ExternalData/SeriesCn.2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesCn.3.dat.md5 b/Tests/Module/ExternalData/SeriesCn.3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesD-1.dat.md5 b/Tests/Module/ExternalData/SeriesD-1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesD-2.dat.md5 b/Tests/Module/ExternalData/SeriesD-2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesD-3.dat.md5 b/Tests/Module/ExternalData/SeriesD-3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesD.dat.md5 b/Tests/Module/ExternalData/SeriesD.dat.md5 new file mode 100644 index 0000000..be2d687 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesDn-1.dat.md5 b/Tests/Module/ExternalData/SeriesDn-1.dat.md5 new file mode 100644 index 0000000..f22e266 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesDn-2.dat.md5 b/Tests/Module/ExternalData/SeriesDn-2.dat.md5 new file mode 100644 index 0000000..2b917e7 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesDn-3.dat.md5 b/Tests/Module/ExternalData/SeriesDn-3.dat.md5 new file mode 100644 index 0000000..b9c9760 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 35b9a43..e55cf69 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -46,6 +46,7 @@ macro(add_RunCMake_test test) endmacro() add_RunCMake_test(CMP0019) +add_RunCMake_test(ExternalData) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt new file mode 100644 index 0000000..f68f0be --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown hash algorithm specified by ExternalData_LINK_CONTENT: + + BAD +Call Stack \(most recent call first\): + .* + BadHashAlgo1.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake b/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake new file mode 100644 index 0000000..19e2e41 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT BAD) +ExternalData_Expand_Arguments(Data args DATA{BadHashAlgo1.txt}) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1.txt new file mode 100644 index 0000000..bfa2818 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1.txt @@ -0,0 +1 @@ +Sample input file that should not be transformed. diff --git a/Tests/RunCMake/ExternalData/BadOption1-result.txt b/Tests/RunCMake/ExternalData/BadOption1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadOption1-stderr.txt b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt new file mode 100644 index 0000000..b63d098 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "Bad/Option" in argument + + DATA{Data.txt,Bad/Option} + +Call Stack \(most recent call first\): + .* + BadOption1.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption1.cmake b/Tests/RunCMake/ExternalData/BadOption1.cmake new file mode 100644 index 0000000..1303d7f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Data.txt,Bad/Option} + ) diff --git a/Tests/RunCMake/ExternalData/BadOption2-result.txt b/Tests/RunCMake/ExternalData/BadOption2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadOption2-stderr.txt b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt new file mode 100644 index 0000000..d114c8a --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "Bad:Option" in argument + + DATA{Data.txt,Bad:Option} + +Call Stack \(most recent call first\): + .* + BadOption2.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption2.cmake b/Tests/RunCMake/ExternalData/BadOption2.cmake new file mode 100644 index 0000000..6269b06 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Data.txt,Bad:Option} + ) diff --git a/Tests/RunCMake/ExternalData/BadSeries1-result.txt b/Tests/RunCMake/ExternalData/BadSeries1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt new file mode 100644 index 0000000..3099be5 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_SERIES_PARSE is set to + + NotASeriesRegex + + which is not of the form + + \(<number>\)\(<suffix>\)\$ + + Fix the regular expression or set variables + + ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any + ExternalData_SERIES_PARSE_NUMBER = <number> regex group number + ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number + +Call Stack \(most recent call first\): + .* + BadSeries1.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries1.cmake b/Tests/RunCMake/ExternalData/BadSeries1.cmake new file mode 100644 index 0000000..7d71210 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_SERIES_PARSE NotASeriesRegex) +ExternalData_Expand_Arguments(Data args DATA{Data.txt,:}) diff --git a/Tests/RunCMake/ExternalData/BadSeries2-result.txt b/Tests/RunCMake/ExternalData/BadSeries2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt new file mode 100644 index 0000000..3a02c25 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt @@ -0,0 +1,16 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Data.txt,:} + + corresponds to path + + Data.txt + + that does not match regular expression + + \(x\)\(y\)\$ +Call Stack \(most recent call first\): + .* + BadSeries2.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries2.cmake b/Tests/RunCMake/ExternalData/BadSeries2.cmake new file mode 100644 index 0000000..e81993b --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_SERIES_PARSE "(x)(y)$") +ExternalData_Expand_Arguments(Data args DATA{Data.txt,:}) diff --git a/Tests/RunCMake/ExternalData/BadSeries3-result.txt b/Tests/RunCMake/ExternalData/BadSeries3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt new file mode 100644 index 0000000..594cb6f6 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Series option ":" not allowed with associated files. +Call Stack \(most recent call first\): + .* + BadSeries3.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries3.cmake b/Tests/RunCMake/ExternalData/BadSeries3.cmake new file mode 100644 index 0000000..b640df8 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{PairA.txt,PairB.txt,:}) diff --git a/Tests/RunCMake/ExternalData/CMakeLists.txt b/Tests/RunCMake/ExternalData/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/ExternalData/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalData/Data.txt.md5 b/Tests/RunCMake/ExternalData/Data.txt.md5 new file mode 100644 index 0000000..93b3485 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Data.txt.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 diff --git a/Tests/RunCMake/ExternalData/Directory1-result.txt b/Tests/RunCMake/ExternalData/Directory1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory1-stderr.txt b/Tests/RunCMake/ExternalData/Directory1-stderr.txt new file mode 100644 index 0000000..85c250f --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Directory1} + + corresponds to source tree path + + Directory1 + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + Directory1.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory1.cmake b/Tests/RunCMake/ExternalData/Directory1.cmake new file mode 100644 index 0000000..68f1b54 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory1} + ) diff --git a/Tests/RunCMake/ExternalData/Directory1/DirData1.txt b/Tests/RunCMake/ExternalData/Directory1/DirData1.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1/DirData1.txt diff --git a/Tests/RunCMake/ExternalData/Directory2-result.txt b/Tests/RunCMake/ExternalData/Directory2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory2-stderr.txt b/Tests/RunCMake/ExternalData/Directory2-stderr.txt new file mode 100644 index 0000000..dc1a59a --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file reference in argument + + DATA{Directory2/} + + may not end in a slash! +Call Stack \(most recent call first\): + .* + Directory2.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory2.cmake b/Tests/RunCMake/ExternalData/Directory2.cmake new file mode 100644 index 0000000..30b992e --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory2/} + ) diff --git a/Tests/RunCMake/ExternalData/Directory2.md5 b/Tests/RunCMake/ExternalData/Directory2.md5 new file mode 100644 index 0000000..93b3485 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 diff --git a/Tests/RunCMake/ExternalData/Directory2/DirData2.txt b/Tests/RunCMake/ExternalData/Directory2/DirData2.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2/DirData2.txt diff --git a/Tests/RunCMake/ExternalData/Directory3-result.txt b/Tests/RunCMake/ExternalData/Directory3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory3-stderr.txt b/Tests/RunCMake/ExternalData/Directory3-stderr.txt new file mode 100644 index 0000000..56a341e --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Directory3/\*} + + corresponds to source tree path + + Directory3/. + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + Directory3.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory3.cmake b/Tests/RunCMake/ExternalData/Directory3.cmake new file mode 100644 index 0000000..55d8be9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory3/*} + ) diff --git a/Tests/RunCMake/ExternalData/Directory3/DirData3.txt b/Tests/RunCMake/ExternalData/Directory3/DirData3.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3/DirData3.txt diff --git a/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt b/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt new file mode 100644 index 0000000..f77fca9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt @@ -0,0 +1,3 @@ +-- Linked ToLink.txt.md5 to ExternalData MD5/c18ff9804c8deec9eaeb17063cda8b7b +-- Raw data correctly transformed to content link! +-- Staged content exists! 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() diff --git a/Tests/RunCMake/ExternalData/MissingData-result.txt b/Tests/RunCMake/ExternalData/MissingData-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/MissingData-stderr.txt b/Tests/RunCMake/ExternalData/MissingData-stderr.txt new file mode 100644 index 0000000..e794f95 --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{MissingData.txt} + + corresponds to source tree path + + MissingData.txt + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + MissingData.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/MissingData.cmake b/Tests/RunCMake/ExternalData/MissingData.cmake new file mode 100644 index 0000000..b3c8a5c --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{MissingData.txt} + ) diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt new file mode 100644 index 0000000..496ad8a --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_LINK_CONTENT cannot be used in-source +Call Stack \(most recent call first\): + .* + NoLinkInSource.cmake:8 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt b/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt new file mode 100644 index 0000000..18946f0 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly not transformed! diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource.cmake b/Tests/RunCMake/ExternalData/NoLinkInSource.cmake new file mode 100644 index 0000000..cbf45eb --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT MD5) +set(ExternalData_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(input ${CMAKE_CURRENT_BINARY_DIR}/ToLink.txt) +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${input}") + message(STATUS "Data reference correctly not transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected no transformation.") +endif() diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt new file mode 100644 index 0000000..ad059d4 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_URL_TEMPLATES is not set! +Call Stack \(most recent call first\): + NoURLTemplates.cmake:2 \(ExternalData_Add_Target\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates.cmake b/Tests/RunCMake/ExternalData/NoURLTemplates.cmake new file mode 100644 index 0000000..8f0e069 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Add_Target(Data) diff --git a/Tests/RunCMake/ExternalData/NormalData1-stdout.txt b/Tests/RunCMake/ExternalData/NormalData1-stdout.txt new file mode 100644 index 0000000..2f2c770 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData1-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData1.cmake b/Tests/RunCMake/ExternalData/NormalData1.cmake new file mode 100644 index 0000000..d6cc384 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData1.cmake @@ -0,0 +1,13 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalData2-stdout.txt b/Tests/RunCMake/ExternalData/NormalData2-stdout.txt new file mode 100644 index 0000000..2f2c770 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData2-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData2.cmake b/Tests/RunCMake/ExternalData/NormalData2.cmake new file mode 100644 index 0000000..c979b48 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData2.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalData3-stdout.txt b/Tests/RunCMake/ExternalData/NormalData3-stdout.txt new file mode 100644 index 0000000..2f2c770 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData3-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData3.cmake b/Tests/RunCMake/ExternalData/NormalData3.cmake new file mode 100644 index 0000000..e991122 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData3.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input ${CMAKE_CURRENT_SOURCE_DIR}/Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt b/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt new file mode 100644 index 0000000..2f2c770 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalDataSub1.cmake b/Tests/RunCMake/ExternalData/NormalDataSub1.cmake new file mode 100644 index 0000000..015e94c --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalDataSub1.cmake @@ -0,0 +1,13 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input SubDirectory1/Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/SubDirectory1/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt b/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt b/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt new file mode 100644 index 0000000..1f2eb1c --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{../NotUnderRoot.txt} + + does not lie under the top-level source directory + + .*/Tests/RunCMake/ExternalData + +Call Stack \(most recent call first\): + .* + NotUnderRoot.cmake:2 \(ExternalData_Add_Test\) diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot.cmake b/Tests/RunCMake/ExternalData/NotUnderRoot.cmake new file mode 100644 index 0000000..c7942d6 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{../NotUnderRoot.txt} + ) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake new file mode 100644 index 0000000..c61527e --- /dev/null +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +run_cmake(BadHashAlgo1) +run_cmake(BadOption1) +run_cmake(BadOption2) +run_cmake(BadSeries1) +run_cmake(BadSeries2) +run_cmake(BadSeries3) +run_cmake(Directory1) +run_cmake(Directory2) +run_cmake(Directory3) +run_cmake(LinkContentMD5) +run_cmake(MissingData) +run_cmake(NoLinkInSource) +run_cmake(NoURLTemplates) +run_cmake(NormalData1) +run_cmake(NormalData2) +run_cmake(NormalData3) +run_cmake(NormalDataSub1) +run_cmake(NotUnderRoot) +run_cmake(SubDirectory1) diff --git a/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt b/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt new file mode 100644 index 0000000..35a8cc1 --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt @@ -0,0 +1,2 @@ +-- Data reference correctly transformed in parent dir! +-- Data reference correctly transformed in current dir! diff --git a/Tests/RunCMake/ExternalData/SubDirectory1.cmake b/Tests/RunCMake/ExternalData/SubDirectory1.cmake new file mode 100644 index 0000000..2989471 --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +add_subdirectory(SubDirectory1) diff --git a/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt b/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt new file mode 100644 index 0000000..0782460 --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt @@ -0,0 +1,19 @@ +set(input ../Data.txt) +set(output ${CMAKE_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed in parent dir!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() + +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed in current dir!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 b/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 new file mode 100644 index 0000000..93b3485 --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 |