summaryrefslogtreecommitdiff
path: root/Tests/CMakeTests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-07-24 16:22:33 -0400
committerKyle Edwards <kyle.edwards@kitware.com>2020-07-27 11:26:50 -0400
commitfed7d8f76de3442f4aede00f8e47c3d142f73e94 (patch)
treeaf8c7a0cee11b400b3422cacd4d7654d7796a795 /Tests/CMakeTests
parent1138907a58402f8004a6c6ff163a30b58239ece7 (diff)
downloadcmake-fed7d8f76de3442f4aede00f8e47c3d142f73e94.tar.gz
file(DOWNLOAD): Make file argument optional
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r--Tests/CMakeTests/CMakeLists.txt2
-rw-r--r--Tests/CMakeTests/FileDownloadTest.cmake.in13
-rw-r--r--Tests/CMakeTests/FileTestScript.cmake4
3 files changed, 16 insertions, 3 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index e32d693a73..348e6d05d0 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 76c0000c27..69d9a14c4b 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 145f28a3f6..fc3c28adf2 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)