ExternalData: Allow local stores without any URL templates

Allow ExternalData_URL_TEMPLATES to be empty if a value for
ExternalData_OBJECT_STORES is provided.  Assume in this use case that
the object stores will already contain all needed objects.  Extend the
Module.ExternalData test to cover this case (all objects in stores).
Extend the RunCMake.ExternalData test to cover the non-failure message
case when stores are provided without URL templates.
This commit is contained in:
Brad King
2013-11-13 10:03:36 -05:00
parent 558a6f1f92
commit 8eb20eeabe
9 changed files with 59 additions and 6 deletions

View File

@@ -42,3 +42,4 @@ ExternalData_Add_Target(Data1)
add_subdirectory(Data2)
add_subdirectory(Data3)
add_subdirectory(Data4)

View File

@@ -0,0 +1,15 @@
set(Store0 ${CMAKE_BINARY_DIR}/ExternalData/Other)
set(Store1 ${CMAKE_BINARY_DIR}/ExternalData/Objects)
set(ExternalData_OBJECT_STORES ${Store0} ${Store1})
unset(ExternalData_URL_TEMPLATES) # All objects already in stores!
ExternalData_Add_Test(Data4
NAME Data4Check
COMMAND ${CMAKE_COMMAND}
-D Data=DATA{Data.dat}
-D Other=DATA{Other.dat}
-D Store0=${Store0}
-D Store1=${Store1}
-P ${CMAKE_CURRENT_SOURCE_DIR}/Data4Check.cmake
)
ExternalData_Add_Target(Data4)
add_dependencies(Data4 Data3)

View File

@@ -0,0 +1 @@
8c018830e3efa5caf3c7415028335a57

View File

@@ -0,0 +1,26 @@
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 found in the
# first store location left from Data3 target downloads. Neither object
# should exist in the opposite 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()

View File

@@ -0,0 +1 @@
aaad162b85f60d1eb57ca71a23e8efd7