From c0b1f5f30c083e78693784405ff2ca301fb29ecb Mon Sep 17 00:00:00 2001 From: "william.r.dieter" Date: Fri, 29 Jan 2021 13:39:34 -0500 Subject: Tests: Add host to ENV{no_proxy} when DNS lookup failure is expected DNS lookup of an invalid host name fails with a different error in a proxy environment than it does in an environment without proxy. Many tools, including curl, use the `no_proxy` environment variable to provid a list of hosts for which proxy should not be used. To make lookup failure consistent, add invalid host names to the `no_proxy` environment variable in tests that attempt to look up invalid host names. This way the lookup will fail consistently regardless of whether proxy is generally used or not. Signed-off-by: william.r.dieter --- Tests/CMakeTests/FileDownloadTest.cmake.in | 3 +++ Tests/RunCMake/ctest_submit/CTestConfig.cmake.in | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 69d9a14c4b..e0ce99ab8c 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -136,6 +136,9 @@ __reportIfWrongStatus("${status}" 0) # Print status because we check its message too message(STATUS "${status}") +# do not use proxy for lookup of invalid site (DNS failure by proxy looks +# different than DNS failure without proxy) +set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid") message(STATUS "FileDownload:11") file(DOWNLOAD badhostname.invalid diff --git a/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in b/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in index 140e4be358..c35397cb83 100644 --- a/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in +++ b/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in @@ -3,3 +3,7 @@ # so that any ctest_submit calls fail with an error message. set(CTEST_DROP_METHOD "@CASE_DROP_METHOD@") set(CTEST_DROP_SITE "@CASE_DROP_SITE@") + +# do not use proxy for lookup of invalid site (DNS failure by proxy looks +# different than DNS failure without proxy) +set(ENV{no_proxy} "$ENV{no_proxy},@CASE_DROP_SITE@") -- cgit v1.2.1