diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-07-24 20:22:33 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-07-27 15:26:50 (GMT) |
commit | fed7d8f76de3442f4aede00f8e47c3d142f73e94 (patch) | |
tree | af8c7a0cee11b400b3422cacd4d7654d7796a795 /Tests/CMakeTests | |
parent | 1138907a58402f8004a6c6ff163a30b58239ece7 (diff) | |
download | CMake-fed7d8f76de3442f4aede00f8e47c3d142f73e94.zip CMake-fed7d8f76de3442f4aede00f8e47c3d142f73e94.tar.gz CMake-fed7d8f76de3442f4aede00f8e47c3d142f73e94.tar.bz2 |
file(DOWNLOAD): Make file argument optional
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/FileDownloadTest.cmake.in | 13 | ||||
-rw-r--r-- | Tests/CMakeTests/FileTestScript.cmake | 4 |
3 files changed, 16 insertions, 3 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index e32d693..348e6d0 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -35,7 +35,7 @@ AddCMakeTest(CMakeHostSystemInformation "") AddCMakeTest(FileDownload "") set_tests_properties(CMake.FileDownload PROPERTIES PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" - FAIL_REGULAR_EXPRESSION "Unexpected status" + FAIL_REGULAR_EXPRESSION "Unexpected status|incorrectly interpreted" ) AddCMakeTest(FileDownloadBadHash "") set_property(TEST CMake.FileDownloadBadHash PROPERTY diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 76c0000..69d9a14 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -163,3 +163,16 @@ __reportIfWrongStatus("${status}" 0) if(NOT EXISTS file12.png) message(SEND_ERROR "file12.png not downloaded: ${status}") endif() + +message(STATUS "FileDownload:13") +file(DOWNLOAD + ${url} + TIMEOUT ${timeout} + STATUS status + ) +__reportIfWrongStatus("${status}" 0) +if(EXISTS TIMEOUT) + file(REMOVE TIMEOUT) + message(SEND_ERROR "TIMEOUT argument was incorrectly interpreted as a filename") +endif() +message(STATUS "${status}") diff --git a/Tests/CMakeTests/FileTestScript.cmake b/Tests/CMakeTests/FileTestScript.cmake index 145f28a..fc3c28a 100644 --- a/Tests/CMakeTests/FileTestScript.cmake +++ b/Tests/CMakeTests/FileTestScript.cmake @@ -10,7 +10,7 @@ elseif(testname STREQUAL different_not_enough_args) # fail file(DIFFERENT ffff) elseif(testname STREQUAL download_not_enough_args) # fail - file(DOWNLOAD ffff) + file(DOWNLOAD) elseif(testname STREQUAL read_not_enough_args) # fail file(READ ffff) @@ -181,7 +181,7 @@ elseif(testname STREQUAL to_native_path) # pass message("v='${v}'") elseif(testname STREQUAL download_wrong_number_of_args) # fail - file(DOWNLOAD zzzz://bogus/ffff) + file(DOWNLOAD) elseif(testname STREQUAL download_file_with_no_path) # pass file(DOWNLOAD zzzz://bogus/ffff ffff) |