diff options
author | Brad King <brad.king@kitware.com> | 2010-06-07 18:26:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-07 18:26:24 (GMT) |
commit | 0d07e4379eba849bd438cc605fc09d76a8dc5408 (patch) | |
tree | 765507b8b637b535742888f7e9401373c89c4bfb /Tests/CMakeTests | |
parent | a03e85f13c1e1e649eae7db62c500b7ec0b692ae (diff) | |
parent | ef491f78218e255339278656bf6dc26073fef264 (diff) | |
download | CMake-0d07e4379eba849bd438cc605fc09d76a8dc5408.zip CMake-0d07e4379eba849bd438cc605fc09d76a8dc5408.tar.gz CMake-0d07e4379eba849bd438cc605fc09d76a8dc5408.tar.bz2 |
Merge branch 'improve-file-download'
Conflicts:
Modules/ExternalProject.cmake
Diffstat (limited to 'Tests/CMakeTests')
-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 |
3 files changed, 46 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 + ) |