diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/CMakeTests/FileDownloadInput.png | bin | 0 -> 358 bytes | |||
-rw-r--r-- | Tests/CMakeTests/FileDownloadTest.cmake.in | 41 | ||||
-rw-r--r-- | Tests/ExternalProject/CMakeLists.txt | 8 |
4 files changed, 54 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 7a176e9..3e5f08c 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -28,6 +28,11 @@ AddCMakeTest(Math "") AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") +AddCMakeTest(FileDownload "") +set_property(TEST CMake.FileDownload PROPERTY + PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" + ) + if(HAVE_ELF_H) AddCMakeTest(ELF "") endif() diff --git a/Tests/CMakeTests/FileDownloadInput.png b/Tests/CMakeTests/FileDownloadInput.png Binary files differnew file mode 100644 index 0000000..7bbcee4 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadInput.png diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in new file mode 100644 index 0000000..578f510 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -0,0 +1,41 @@ +set(url "file://@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") +set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") + +message(STATUS "FileDownload:1") +file(DOWNLOAD + ${url} + ${dir}/file1.png + TIMEOUT 2 + ) + +message(STATUS "FileDownload:2") +file(DOWNLOAD + ${url} + ${dir}/file2.png + TIMEOUT 2 + SHOW_PROGRESS + ) + +# Two calls in a row, exactly the same arguments. +# Since downloaded file should exist already for 2nd call, +# the 2nd call will short-circuit and return early... +# +if(EXISTS ${dir}/file3.png) + file(REMOVE ${dir}/file3.png) +endif() + +message(STATUS "FileDownload:3") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:4") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + ) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 2f1f49d..99da9c4 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -64,7 +64,9 @@ ExternalProject_Add(${proj} SVN_REPOSITORY "" SVN_REVISION "" TEST_COMMAND "" + TIMEOUT "" URL "" + URL_MD5 "" UPDATE_COMMAND "" ) @@ -95,6 +97,7 @@ endif() set(proj TutorialStep1-LocalTAR) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" + URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 LIST_SEPARATOR :: PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake CMAKE_GENERATOR "${CMAKE_GENERATOR}" @@ -106,6 +109,7 @@ ExternalProject_Add(${proj} set(proj TutorialStep1-LocalNoDirTAR) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" + URL_MD5 d09e3d370c5c908fa035c30939ee438e LIST_SEPARATOR @@ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> -DTEST_LIST:STRING=1@@2@@3 @@ -125,6 +129,7 @@ ExternalProject_Add_Step(${proj} mypatch set(proj TutorialStep1-LocalTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" + URL_MD5 38c648e817339c356f6be00eeed79bd0 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> INSTALL_COMMAND "" ) @@ -132,6 +137,7 @@ ExternalProject_Add(${proj} set(proj TutorialStep1-LocalNoDirTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" + URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78 CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" @@ -210,6 +216,7 @@ if(do_cvs_tests) ExternalProject_Add(${proj} SOURCE_DIR ${local_cvs_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/cvsrepo.tgz + URL_MD5 55fc85825ffdd9ed2597123c68b79f7e BUILD_COMMAND "" CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version INSTALL_COMMAND "" @@ -308,6 +315,7 @@ if(do_svn_tests) ExternalProject_Add(${proj} SOURCE_DIR ${local_svn_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/svnrepo.tgz + URL_MD5 2f468be4ed1fa96377fca0cc830819c4 BUILD_COMMAND "" CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version INSTALL_COMMAND "" |