diff options
author | Dāvis Mosāns <davispuh@gmail.com> | 2016-07-07 21:54:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-07-18 13:51:01 (GMT) |
commit | b1f87a50b3aee129d420b8d789ebec55068e4ec5 (patch) | |
tree | e9223617c45d01c60a4c89c5d60dc0121a75a989 /Source/CTest | |
parent | 03407040d4d7d89fbb45e941a9dfb4257003a8a8 (diff) | |
download | CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.zip CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.gz CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.bz2 |
Use better KWSys SystemTools::GetEnv and HasEnv signatures
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 27 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 10 |
3 files changed, 26 insertions, 24 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 7102533..3f37f2a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -727,10 +727,8 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( // if it doesn't exist or is empty, assume the // binary directory is used. std::string coverageXMLFile; - const char* covDir = cmSystemTools::GetEnv("COBERTURADIR"); - if (covDir && strlen(covDir) != 0) { - coverageXMLFile = std::string(covDir); - } else { + if (!cmSystemTools::GetEnv("COBERTURADIR", coverageXMLFile) || + coverageXMLFile.empty()) { coverageXMLFile = this->CTest->GetBinaryDir(); } // build the find file string with the directory from above @@ -791,7 +789,8 @@ struct cmCTestCoverageHandlerLocale { cmCTestCoverageHandlerLocale() { - if (const char* l = cmSystemTools::GetEnv("LC_ALL")) { + std::string l; + if (cmSystemTools::GetEnv("LC_ALL", l)) { lc_all = l; } if (lc_all != "C") { @@ -2121,8 +2120,8 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( int cmCTestCoverageHandler::HandleBullseyeCoverage( cmCTestCoverageHandlerContainer* cont) { - const char* covfile = cmSystemTools::GetEnv("COVFILE"); - if (!covfile || strlen(covfile) == 0) { + std::string covfile; + if (!cmSystemTools::GetEnv("COVFILE", covfile) || covfile.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " COVFILE environment variable not found, not running " " bullseye\n", diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 6b8e5b5..b335e32 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -219,16 +219,18 @@ bool cmCTestCurl::HttpRequest(std::string const& url, void cmCTestCurl::SetProxyType() { - if (cmSystemTools::GetEnv("HTTP_PROXY")) { - this->HTTPProxy = cmSystemTools::GetEnv("HTTP_PROXY"); - if (cmSystemTools::GetEnv("HTTP_PROXY_PORT")) { + this->HTTPProxy = ""; + // this is the default + this->HTTPProxyType = CURLPROXY_HTTP; + this->HTTPProxyAuth = ""; + if (cmSystemTools::GetEnv("HTTP_PROXY", this->HTTPProxy)) { + std::string port; + if (cmSystemTools::GetEnv("HTTP_PROXY_PORT", port)) { this->HTTPProxy += ":"; - this->HTTPProxy += cmSystemTools::GetEnv("HTTP_PROXY_PORT"); + this->HTTPProxy += port; } - if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE")) { - // this is the default - this->HTTPProxyType = CURLPROXY_HTTP; - std::string type = cmSystemTools::GetEnv("HTTP_PROXY_TYPE"); + std::string type; + if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE", type)) { // HTTP/SOCKS4/SOCKS5 if (type == "HTTP") { this->HTTPProxyType = CURLPROXY_HTTP; @@ -238,12 +240,11 @@ void cmCTestCurl::SetProxyType() this->HTTPProxyType = CURLPROXY_SOCKS5; } } - if (cmSystemTools::GetEnv("HTTP_PROXY_USER")) { - this->HTTPProxyAuth = cmSystemTools::GetEnv("HTTP_PROXY_USER"); - } - if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD")) { + cmSystemTools::GetEnv("HTTP_PROXY_USER", this->HTTPProxyAuth); + std::string passwd; + if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD", passwd)) { this->HTTPProxyAuth += ":"; - this->HTTPProxyAuth += cmSystemTools::GetEnv("HTTP_PROXY_PASSWD"); + this->HTTPProxyAuth += passwd; } } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ae97d32..a4e0b95 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -261,12 +261,14 @@ void cmCTestMultiProcessHandler::StartNextTests() allTestsFailedTestLoadCheck = true; // Check for a fake load average value used in testing. - if (const char* fake_load_value = - cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING")) { + std::string fake_load_value; + if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING", + fake_load_value)) { usedFakeLoadForTesting = true; - if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad)) { + if (!cmSystemTools::StringToULong(fake_load_value.c_str(), + &systemLoad)) { cmSystemTools::Error("Failed to parse fake load value: ", - fake_load_value); + fake_load_value.c_str()); } } // If it's not set, look up the true load average. |