diff options
author | Brad King <brad.king@kitware.com> | 2014-01-27 18:03:33 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-01-27 18:03:33 (GMT) |
commit | 20263b719fd454f0e0c66b588510e18f0213ab68 (patch) | |
tree | 58d5a9884ff62b1ef77cee925d63e2449152eaa1 /Tests | |
parent | d31e68a26e6f854e90f3eab34d794a766227354d (diff) | |
parent | a432b93b7919d34e37e202b0c992775a029928d3 (diff) | |
download | CMake-20263b719fd454f0e0c66b588510e18f0213ab68.zip CMake-20263b719fd454f0e0c66b588510e18f0213ab68.tar.gz CMake-20263b719fd454f0e0c66b588510e18f0213ab68.tar.bz2 |
Merge topic 'robust-ep-download-verify'
a432b93b file DOWNLOAD: Display the curl result status when a hash mismatch occurs.
1cb9ef81 file DOWNLOAD: Test non-zero return status.
f73f0fb3 file DOWNLOAD: Add test for bad hash.
b5e2265f ExternalProject: Reattempt download when verification fails.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CMakeTests/FileDownloadBadHashTest.cmake.in | 10 | ||||
-rw-r--r-- | Tests/CMakeTests/FileDownloadTest.cmake.in | 13 |
3 files changed, 27 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 41714f6..ce36830 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -38,6 +38,10 @@ AddCMakeTest(FileDownload "") set_property(TEST CMake.FileDownload PROPERTY PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" ) +AddCMakeTest(FileDownloadBadHash "") +set_property(TEST CMake.FileDownloadBadHash PROPERTY + WILL_FAIL TRUE + ) AddCMakeTest(FileUpload "") diff --git a/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in b/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in new file mode 100644 index 0000000..4a47c06 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadBadHashTest.cmake.in @@ -0,0 +1,10 @@ +set(url "file://@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") +set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") + +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA1=5555555555555555555555555555555555555555 + ) diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 91086c6..83ade2b 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -94,3 +94,16 @@ file(DOWNLOAD EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 ) message(STATUS "${status}") + +message(STATUS "FileDownload:11") +file(DOWNLOAD + badhostname.png + ${dir}/file11.png + TIMEOUT 2 + STATUS status + ) +message(STATUS "${status}") +list(GET status 0 status_code) +if(NOT ${status_code} EQUAL 6) + message(SEND_ERROR "error: expected status code 6 for bad host name, got: ${status_code}") +endif() |