diff options
Diffstat (limited to 'Tests/RunCMake/file-DOWNLOAD')
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-darwin.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-windows.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake | 59 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-result.txt (renamed from Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-stderr.txt (renamed from Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt) | 6 | ||||
-rw-r--r-- | Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid.cmake | 10 |
8 files changed, 86 insertions, 11 deletions
diff --git a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake index 5e0310b..3fe2090 100644 --- a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake @@ -11,6 +11,7 @@ run_cmake(httpheader-not-set) run_cmake(netrc-bad) run_cmake(tls-cainfo-not-set) run_cmake(tls-verify-not-set) +run_cmake(TLS_VERSION-invalid) run_cmake(TLS_VERSION-missing) run_cmake(pass-not-set) run_cmake(no-save-hash) @@ -26,10 +27,12 @@ if(NOT CMake_TEST_NO_NETWORK) run_cmake(bad-hostname) endif() -run_cmake_with_options(TLS_VERSION-bad) if(CMake_TEST_TLS_VERIFY_URL_BAD) run_cmake_with_options(TLS_VERIFY-bad -Durl=${CMake_TEST_TLS_VERIFY_URL_BAD}) endif() +if(CMake_TEST_TLS_VERSION_URL_BAD) + run_cmake_with_options(TLS_VERSION-bad -Durl=${CMake_TEST_TLS_VERSION_URL_BAD}) +endif() if(CMake_TEST_TLS_VERIFY_URL) run_cmake_with_options(TLS_VERIFY-good -Durl=${CMake_TEST_TLS_VERIFY_URL}) diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-darwin.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-darwin.txt new file mode 100644 index 0000000..730cf59 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-darwin.txt @@ -0,0 +1,7 @@ +-- def-1\.1: 0;"No error" +-- env-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- env-1\.1: 0;"No error" +-- var-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- var-1\.1: 0;"No error" +-- opt-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- opt-1\.1: 0;"No error" diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-windows.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-windows.txt new file mode 100644 index 0000000..730cf59 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout-windows.txt @@ -0,0 +1,7 @@ +-- def-1\.1: 0;"No error" +-- env-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- env-1\.1: 0;"No error" +-- var-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- var-1\.1: 0;"No error" +-- opt-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- opt-1\.1: 0;"No error" diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout.txt new file mode 100644 index 0000000..34d99d1 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stdout.txt @@ -0,0 +1,3 @@ +-- env-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- var-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") +-- opt-1\.2: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error") diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake index 51ae4a2..106fe44 100644 --- a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake @@ -1,10 +1,55 @@ -# The environment variable provides a default. -set(ENV{CMAKE_TLS_VERSION} bad-env) -file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log) +function(download case) + # URL with semantics like https://tls-v1-1.badssl.com:1011 is provided by caller + file(DOWNLOAD ${url} ${ARGN} STATUS status LOG log) + message(STATUS "${case}: ${status}") + if(case MATCHES "1\\.2$" AND NOT status MATCHES "^(35|60);") + message("${log}") + endif() +endfunction() + +set(CMAKE_TLS_VERIFY 1) + +if(CMAKE_HOST_WIN32 OR CMAKE_HOST_APPLE) + # The OS-native TLS implementations support TLS 1.1. + set(TEST_TLSv1_1 1) +else() + # OpenSSL 3.1+ does not support TLS 1.1 or older without setting + # the security level to 0, which curl (correctly) does not do. + # https://openssl-library.org/news/openssl-3.1-notes/index.html#major-changes-between-openssl-30-and-openssl-310-14-mar-2023 + set(TEST_TLSv1_1 0) +endif() + +if(TEST_TLSv1_1) + # The default is to allow 1.1. + unset(ENV{CMAKE_TLS_VERSION}) + unset(CMAKE_TLS_VERSION) + download(def-1.1) +endif() + +# The environment variable overrides the default. +set(ENV{CMAKE_TLS_VERSION} 1.2) +download(env-1.2) +if(TEST_TLSv1_1) + set(ENV{CMAKE_TLS_VERSION} 1.1) + download(env-1.1) +endif() # The cmake variable overrides the environment variable. -set(CMAKE_TLS_VERSION bad-var) -file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log) +set(ENV{CMAKE_TLS_VERSION} 1.1) +set(CMAKE_TLS_VERSION 1.2) +download(var-1.2) +if(TEST_TLSv1_1) + set(ENV{CMAKE_TLS_VERSION} 1.2) + set(CMAKE_TLS_VERSION 1.1) + download(var-1.1) +endif() -# The explicit argument overrides the cmake variable. -file(DOWNLOAD "" TLS_VERSION bad-arg TLS_VERIFY 1 STATUS status LOG log) +# The explicit argument overrides the cmake variable and the environment variable. +set(ENV{CMAKE_TLS_VERSION} 1.1) +set(CMAKE_TLS_VERSION 1.1) +download(opt-1.2 TLS_VERSION 1.2) +if(TEST_TLSv1_1) + set(ENV{CMAKE_TLS_VERSION} 1.2) + set(CMAKE_TLS_VERSION 1.2) + download(opt-1.1 TLS_VERSION 1.1) +endif() diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-result.txt diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-stderr.txt index 421c8cf..565facb 100644 --- a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid-stderr.txt @@ -1,14 +1,14 @@ -^CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\): +^CMake Error at TLS_VERSION-invalid\.cmake:[0-9]+ \(file\): file DOWNLOAD given unknown TLS/SSL version bad-env Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\): +CMake Error at TLS_VERSION-invalid\.cmake:[0-9]+ \(file\): file DOWNLOAD given unknown TLS/SSL version bad-var Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) + -CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\): +CMake Error at TLS_VERSION-invalid\.cmake:[0-9]+ \(file\): file DOWNLOAD given unknown TLS/SSL version bad-arg Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid.cmake new file mode 100644 index 0000000..51ae4a2 --- /dev/null +++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-invalid.cmake @@ -0,0 +1,10 @@ +# The environment variable provides a default. +set(ENV{CMAKE_TLS_VERSION} bad-env) +file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log) + +# The cmake variable overrides the environment variable. +set(CMAKE_TLS_VERSION bad-var) +file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log) + +# The explicit argument overrides the cmake variable. +file(DOWNLOAD "" TLS_VERSION bad-arg TLS_VERIFY 1 STATUS status LOG log) |