ctest: Fall back to CMake options for TLS server verification
Use `CMAKE_TLS_VERIFY` if `CTEST_TLS_VERIFY` is not set.
This commit is contained in:
parent
6671f17f65
commit
56e319ce4a
@ -8,3 +8,6 @@ Specify the CTest ``TLSVerify`` setting in a :manual:`ctest(1)`
|
|||||||
before including the :module:`CTest` module. The value is a boolean
|
before including the :module:`CTest` module. The value is a boolean
|
||||||
indicating whether to verify the server certificate when submitting
|
indicating whether to verify the server certificate when submitting
|
||||||
to a dashboard via ``https://`` URLs.
|
to a dashboard via ``https://`` URLs.
|
||||||
|
|
||||||
|
If ``CTEST_TLS_VERIFY`` is not set, :variable:`CMAKE_TLS_VERIFY` is
|
||||||
|
used instead.
|
||||||
|
@ -21,6 +21,9 @@ mark_as_advanced(CMAKE_CTEST_COMMAND)
|
|||||||
# configure files
|
# configure files
|
||||||
|
|
||||||
block()
|
block()
|
||||||
|
if(NOT DEFINED CTEST_TLS_VERIFY AND DEFINED CMAKE_TLS_VERIFY)
|
||||||
|
set(CTEST_TLS_VERIFY "${CMAKE_TLS_VERIFY}")
|
||||||
|
endif()
|
||||||
if(CTEST_NEW_FORMAT)
|
if(CTEST_NEW_FORMAT)
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
|
${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
|
||||||
|
@ -57,8 +57,19 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
|||||||
|
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||||
this->Makefile, "TLSVersion", "CTEST_TLS_VERSION", this->Quiet);
|
this->Makefile, "TLSVersion", "CTEST_TLS_VERSION", this->Quiet);
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||||
this->Makefile, "TLSVerify", "CTEST_TLS_VERIFY", this->Quiet);
|
this->Makefile, "TLSVerify", "CTEST_TLS_VERIFY", this->Quiet)) {
|
||||||
|
if (cmValue tlsVerifyVar =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_TLS_VERIFY")) {
|
||||||
|
cmCTestOptionalLog(
|
||||||
|
this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
|
"SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:"
|
||||||
|
<< *tlsVerifyVar << std::endl,
|
||||||
|
this->Quiet);
|
||||||
|
this->CTest->SetCTestConfiguration("TLSVerify", *tlsVerifyVar,
|
||||||
|
this->Quiet);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||||
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
|
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||||
|
@ -498,7 +498,7 @@ function(run_FailDrop case)
|
|||||||
endfunction()
|
endfunction()
|
||||||
run_FailDrop(TLSVersion-1.1 -DCTEST_TLS_VERSION=1.1)
|
run_FailDrop(TLSVersion-1.1 -DCTEST_TLS_VERSION=1.1)
|
||||||
run_FailDrop(TLSVerify-ON -DCTEST_TLS_VERIFY=ON)
|
run_FailDrop(TLSVerify-ON -DCTEST_TLS_VERIFY=ON)
|
||||||
run_FailDrop(TLSVerify-OFF -DCTEST_TLS_VERIFY=OFF)
|
run_FailDrop(TLSVerify-OFF -DCMAKE_TLS_VERIFY=OFF) # Test fallback to CMake variable.
|
||||||
|
|
||||||
run_cmake_command(EmptyDirCoverage-ctest
|
run_cmake_command(EmptyDirCoverage-ctest
|
||||||
${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
|
${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SetCTestConfigurationFromCMakeVariable:TLSVerify:CTEST_TLS_VERIFY
|
SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:OFF
|
||||||
SetCTestConfiguration:TLSVerify:OFF
|
SetCTestConfiguration:TLSVerify:OFF
|
||||||
.*
|
.*
|
||||||
Set CURLOPT_SSL_VERIFYPEER to off
|
Set CURLOPT_SSL_VERIFYPEER to off
|
||||||
|
@ -61,6 +61,6 @@ block()
|
|||||||
run_ctest(FailDrop-TLSVersion-1.1 -VV)
|
run_ctest(FailDrop-TLSVersion-1.1 -VV)
|
||||||
set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERIFY ON)")
|
set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERIFY ON)")
|
||||||
run_ctest(FailDrop-TLSVerify-ON -VV)
|
run_ctest(FailDrop-TLSVerify-ON -VV)
|
||||||
set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERIFY OFF)")
|
set(CASE_TEST_PREFIX_CODE "set(CMAKE_TLS_VERIFY OFF)") # Test fallback to CMake variable.
|
||||||
run_ctest(FailDrop-TLSVerify-OFF -VV)
|
run_ctest(FailDrop-TLSVerify-OFF -VV)
|
||||||
endblock()
|
endblock()
|
||||||
|
Loading…
Reference in New Issue
Block a user