summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-02-11 11:33:03 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-02-11 11:33:20 (GMT)
commit49f32b27ed9e66f6ab5db7952eab6e27fc8f0329 (patch)
tree277b5247fb42b986c8d15da1781dcd54d3bad7b4 /Tests
parent48c69eeafe5e480b5baa0c6766d4d2e3c7f5a4ad (diff)
parent3350c1745132cda0adeb1d87b39834db526537e6 (diff)
downloadCMake-49f32b27ed9e66f6ab5db7952eab6e27fc8f0329.zip
CMake-49f32b27ed9e66f6ab5db7952eab6e27fc8f0329.tar.gz
CMake-49f32b27ed9e66f6ab5db7952eab6e27fc8f0329.tar.bz2
Merge topic 'test-https-connections'
3350c17451 ci: Enable file(DOWNLOAD) TLS_VERIFY test case in CI jobs 17b47da3d8 Tests: Add test for file(DOWNLOAD) with TLS_VERIFY Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8194
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt10
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake6
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake6
6 files changed, 28 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index a7a8295..930122c 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -469,7 +469,15 @@ add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(define_property)
add_RunCMake_test(file -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
add_RunCMake_test(file-CHMOD -DMSYS=${MSYS})
-add_RunCMake_test(file-DOWNLOAD -DCMake_TEST_NO_NETWORK=${CMake_TEST_NO_NETWORK})
+foreach(var
+ CMake_TEST_NO_NETWORK
+ CMake_TEST_TLS_VERIFY_URL
+ )
+ if(DEFINED ${var})
+ list(APPEND file-DOWNLOAD_ARGS -D${var}=${${var}})
+ endif()
+endforeach()
+add_RunCMake_test(file-DOWNLOAD)
add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(find_file)
add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
diff --git a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
index 565f440..d757eea 100644
--- a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
@@ -24,3 +24,8 @@ run_cmake(SHOW_PROGRESS)
if(NOT CMake_TEST_NO_NETWORK)
run_cmake(bad-hostname)
endif()
+
+if(CMake_TEST_TLS_VERIFY_URL)
+ run_cmake(TLS_VERIFY-bad)
+ run_cmake_with_options(TLS_VERIFY-good -Durl=${CMake_TEST_TLS_VERIFY_URL})
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt
new file mode 100644
index 0000000..8f5d437
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt
@@ -0,0 +1 @@
+-- (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error")
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake
new file mode 100644
index 0000000..333f990
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake
@@ -0,0 +1,6 @@
+file(DOWNLOAD https://expired.badssl.com TLS_VERIFY 1 STATUS status LOG log)
+message(STATUS "${status}")
+list(GET status 0 code)
+if(NOT code MATCHES "^(35|60)$")
+ message("${log}")
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt
new file mode 100644
index 0000000..348bb17
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good-stdout.txt
@@ -0,0 +1 @@
+-- 0;"No error"
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake
new file mode 100644
index 0000000..279eb69
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-good.cmake
@@ -0,0 +1,6 @@
+file(DOWNLOAD ${url} TLS_VERIFY 1 STATUS status LOG log)
+message(STATUS "${status}")
+list(GET status 0 code)
+if(NOT code EQUAL 0)
+ message("${log}")
+endif()