summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file-DOWNLOAD
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/file-DOWNLOAD')
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt8
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake13
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt2
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake3
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake9
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/basic.cmake3
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/common.cmake15
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake10
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt11
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake8
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/input.pngbin0 -> 194 bytes
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt19
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake15
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt0
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake11
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-file.cmake11
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt5
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake5
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt0
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/range-stdout.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/range.cmake15
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt0
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt6
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake3
45 files changed, 236 insertions, 0 deletions
diff --git a/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt b/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt
new file mode 100644
index 0000000..9a66cde
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.13)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt
new file mode 100644
index 0000000..bd1727a
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH-stdout.txt
@@ -0,0 +1,8 @@
+-- status='0;"No error"'
+-- status='0;"skipping download as file already exists with expected MD5 sum"'
+-- status='0;"skipping download as file already exists with expected MD5 hash"'
+-- status='0;"skipping download as file already exists with expected SHA1 hash"'
+-- status='0;"skipping download as file already exists with expected SHA224 hash"'
+-- status='0;"skipping download as file already exists with expected SHA256 hash"'
+-- status='0;"skipping download as file already exists with expected SHA384 hash"'
+-- status='0;"skipping download as file already exists with expected SHA512 hash"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake
new file mode 100644
index 0000000..dc7f8ff
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/EXPECTED_HASH.cmake
@@ -0,0 +1,13 @@
+include(common.cmake)
+
+# Actually download the file and verify its hash.
+file_download(EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92)
+
+# Verify that the local file already exists with expected hash.
+file_download(EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92)
+file_download(EXPECTED_HASH MD5=dbd330d52f4dbd60115d4191904ded92)
+file_download(EXPECTED_HASH SHA1=67eee17f79d9ac557284fc0b8ad19f25723fb578)
+file_download(EXPECTED_HASH SHA224=ba283726bbb602776818b463943189afd91836cb7ee5dd6e2c7b5ae4)
+file_download(EXPECTED_HASH SHA256=cf3334b1275071e1da6e8c396ccb72cf1b2388d8c937526f3af26230affb9423)
+file_download(EXPECTED_HASH SHA384=43a5d13978d97c660db44481aee0604cb4ff6ca0775cd5c2cd68cd8000e107e507c4caf6c228941231041e282ffb8950)
+file_download(EXPECTED_HASH SHA512=6984e0909a1018030ccaa418e3be1654223cdccff0fe6adc745f9aea7e377f178be53b9fc7d54a6f81c2b62ef9ddcd38ba1978fedf4c5e7139baaf355eefad5b)
diff --git a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
new file mode 100644
index 0000000..565f440
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
@@ -0,0 +1,26 @@
+include(RunCMake)
+
+# We do not contact any real URLs, but do try a bogus one.
+# Remove any proxy configuration that may change behavior.
+unset(ENV{http_proxy})
+unset(ENV{https_proxy})
+
+run_cmake(hash-mismatch)
+run_cmake(unused-argument)
+run_cmake(httpheader-not-set)
+run_cmake(netrc-bad)
+run_cmake(tls-cainfo-not-set)
+run_cmake(tls-verify-not-set)
+run_cmake(pass-not-set)
+run_cmake(no-save-hash)
+
+run_cmake(basic)
+run_cmake(EXPECTED_HASH)
+run_cmake(file-without-path)
+run_cmake(no-file)
+run_cmake(range)
+run_cmake(SHOW_PROGRESS)
+
+if(NOT CMake_TEST_NO_NETWORK)
+ run_cmake(bad-hostname)
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt
new file mode 100644
index 0000000..e0a4982
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS-stdout.txt
@@ -0,0 +1,2 @@
+-- \[download 100% complete\]
+-- status='0;"No error"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake
new file mode 100644
index 0000000..ccabced
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/SHOW_PROGRESS.cmake
@@ -0,0 +1,3 @@
+include(common.cmake)
+
+file_download(SHOW_PROGRESS)
diff --git a/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt
new file mode 100644
index 0000000..12278e0
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/bad-hostname-stdout.txt
@@ -0,0 +1 @@
+-- status='6;"Couldn't resolve host name"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake b/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake
new file mode 100644
index 0000000..d3b7a28
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/bad-hostname.cmake
@@ -0,0 +1,9 @@
+include(common.cmake)
+
+# Do not use any proxy for lookup of an invalid site.
+# DNS failure by proxy looks different than DNS failure without proxy.
+set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid")
+
+set(url "badhostname.invalid")
+
+file_download()
diff --git a/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt
new file mode 100644
index 0000000..701e995
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/basic-stdout.txt
@@ -0,0 +1 @@
+-- status='0;"No error"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/basic.cmake b/Tests/RunCMake/file-DOWNLOAD/basic.cmake
new file mode 100644
index 0000000..1fd931c
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/basic.cmake
@@ -0,0 +1,3 @@
+include(common.cmake)
+
+file_download()
diff --git a/Tests/RunCMake/file-DOWNLOAD/common.cmake b/Tests/RunCMake/file-DOWNLOAD/common.cmake
new file mode 100644
index 0000000..6aa2fe6
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/common.cmake
@@ -0,0 +1,15 @@
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/")
+ set(slash /)
+endif()
+set(url "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/input.png")
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output.png)
+
+function(file_download)
+ file(DOWNLOAD "${url}"
+ ${file} # leave unquoted
+ TIMEOUT 30
+ STATUS status
+ ${ARGN}
+ )
+ message(STATUS "status='${status}'")
+endfunction()
diff --git a/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt
new file mode 100644
index 0000000..701e995
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/file-without-path-stdout.txt
@@ -0,0 +1 @@
+-- status='0;"No error"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake b/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake
new file mode 100644
index 0000000..a628423
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/file-without-path.cmake
@@ -0,0 +1,10 @@
+include(common.cmake)
+
+set(file_orig "${file}")
+cmake_path(GET file_orig FILENAME file)
+
+file_download()
+
+if(NOT EXISTS "${file_orig}")
+ message(FATAL_ERROR "file not downloaded to expected path:\n ${file_orig}")
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt
new file mode 100644
index 0000000..6682794
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at hash-mismatch.cmake:[0-9]+ \(file\):
+ file DOWNLOAD HASH mismatch
+
+ for file: \[.*/Tests/RunCMake/file-DOWNLOAD/hash-mismatch-build/output.png\]
+ expected hash: \[0123456789abcdef0123456789abcdef01234567\]
+ actual hash: \[67eee17f79d9ac557284fc0b8ad19f25723fb578\]
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 actual: 67eee17f79d9ac557284fc0b8ad19f25723fb578'$
diff --git a/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake
new file mode 100644
index 0000000..e3f91e3
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/hash-mismatch.cmake
@@ -0,0 +1,8 @@
+include(common.cmake)
+
+file(DOWNLOAD ${url} ${file}
+ EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567
+ TIMEOUT 30
+ STATUS status
+ )
+message("status='${status}'")
diff --git a/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt
new file mode 100644
index 0000000..3ac5082
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at httpheader-not-set.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing string for HTTPHEADER.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake
new file mode 100644
index 0000000..6efc958
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/httpheader-not-set.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" HTTPHEADER "Content-Type: application/x-compressed-tar" HTTPHEADER)
diff --git a/Tests/RunCMake/file-DOWNLOAD/input.png b/Tests/RunCMake/file-DOWNLOAD/input.png
new file mode 100644
index 0000000..9ab565a
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/input.png
Binary files differ
diff --git a/Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt
new file mode 100644
index 0000000..61d7c99
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad-stderr.txt
@@ -0,0 +1,19 @@
+^CMake Error at netrc-bad\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing level value for NETRC\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at netrc-bad\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing file value for NETRC_FILE\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at netrc-bad\.cmake:[0-9]+ \(file\):
+ file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at netrc-bad\.cmake:[0-9]+ \(file\):
+ file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake
new file mode 100644
index 0000000..c62238a
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.cmake
@@ -0,0 +1,15 @@
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/")
+ set(slash /)
+endif()
+file(DOWNLOAD "" "" NETRC)
+file(DOWNLOAD "" "" NETRC_FILE)
+set(CMAKE_NETRC FALSE)
+file(DOWNLOAD
+ "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/netrc-bad.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+ NETRC INVALID
+ )
+file(DOWNLOAD
+ "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/netrc-bad.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt"
+ )
diff --git a/Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/netrc-bad.txt
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake b/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake
new file mode 100644
index 0000000..6520940
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-file-arg.cmake
@@ -0,0 +1,11 @@
+include(common.cmake)
+
+set(file "")
+
+file_download()
+
+set(file "${CMAKE_CURRENT_BINARY_DIR}/input.png")
+
+if(NOT EXISTS "${file}")
+ message(FATAL_ERROR "file not downloaded to expected path:\n ${file}")
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt
new file mode 100644
index 0000000..701e995
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-file-stdout.txt
@@ -0,0 +1 @@
+-- status='0;"No error"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-file.cmake b/Tests/RunCMake/file-DOWNLOAD/no-file.cmake
new file mode 100644
index 0000000..dc234b2
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-file.cmake
@@ -0,0 +1,11 @@
+include(common.cmake)
+
+# Test downloading without saving to a file.
+set(file "")
+file_download()
+
+foreach(name input.png output.png TIMEOUT)
+ if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${name}")
+ message(FATAL_ERROR "file incorrectly saved to:\n ${CMAKE_CURRENT_BINARY_DIR}/${name}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt
new file mode 100644
index 0000000..8f2f885
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at common\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD cannot calculate hash if file is not saved\.
+Call Stack \(most recent call first\):
+ no-save-hash.cmake:[0-9]+ \(file_download\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake
new file mode 100644
index 0000000..7fdc397
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.cmake
@@ -0,0 +1,5 @@
+include(common.cmake)
+
+# Test downloading without saving to a file.
+set(file "")
+file_download(EXPECTED_HASH MD5=55555555555555555555555555555555)
diff --git a/Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/no-save-hash.txt
diff --git a/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt
new file mode 100644
index 0000000..23997c5
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at pass-not-set.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing string for USERPWD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake
new file mode 100644
index 0000000..61eff6d
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/pass-not-set.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" USERPWD)
diff --git a/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt
new file mode 100644
index 0000000..e2ed7aa
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/range-stdout.txt
@@ -0,0 +1,4 @@
+-- status='0;"No error"'
+-- status='0;"No error"'
+-- status='0;"No error"'
+-- status='0;"No error"'
diff --git a/Tests/RunCMake/file-DOWNLOAD/range.cmake b/Tests/RunCMake/file-DOWNLOAD/range.cmake
new file mode 100644
index 0000000..f77bb28
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/range.cmake
@@ -0,0 +1,15 @@
+include(common.cmake)
+
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output1.png)
+file_download(RANGE_START 0 EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92)
+
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output2.png)
+file_download(RANGE_END 50 EXPECTED_MD5 8592e5665b839b5d23825dc84c135b61)
+
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output3.png)
+file_download(RANGE_START 10 RANGE_END 50 EXPECTED_MD5 36cd52681e6c6c8fef85fcd9e86fc30d)
+
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output4.png)
+file_download(RANGE_START 0 RANGE_END 50
+ RANGE_START 60 RANGE_END 100
+ EXPECTED_MD5 c5c9e74e82d493dd901eecccd659cebc)
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt
new file mode 100644
index 0000000..d9fa7b7
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at tls-cainfo-not-set.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing file value for TLS_CAINFO.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake
new file mode 100644
index 0000000..b476425
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-cainfo-not-set.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" TLS_CAINFO)
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt
new file mode 100644
index 0000000..c048ea9
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at tls-verify-not-set.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing bool value for TLS_VERIFY.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake
new file mode 100644
index 0000000..919368c
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/tls-verify-not-set.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" TLS_VERIFY)
diff --git a/Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt b/Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument-result.txt
diff --git a/Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt
new file mode 100644
index 0000000..f7cfc4f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Warning \(dev\) at common.cmake:[0-9]+ \(file\):
+ Unexpected argument: JUNK
+Call Stack \(most recent call first\):
+ unused-argument.cmake:[0-9]+ \(file_download\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake b/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake
new file mode 100644
index 0000000..6f7f597
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/unused-argument.cmake
@@ -0,0 +1,3 @@
+include(common.cmake)
+
+file_download(JUNK)