diff options
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBZR.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 33 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.h | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestVC.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 2 |
12 files changed, 69 insertions, 28 deletions
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index a353435..0fe4ff4 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -20,9 +20,9 @@ #include "cmSystemTools.h" #include "cmXMLParser.h" -extern "C" int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/, - const XML_Char* name, - XML_Encoding* info) +static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/, + const XML_Char* name, + XML_Encoding* info) { static const int latin1[] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index f9c4a8e..2aba79d 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -81,6 +81,7 @@ static const char* cmCTestErrorMatches[] = { "^The project cannot be built\\.", "^\\[ERROR\\]", "^Command .* failed with exit code", + "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): (error|ошибка)", nullptr }; @@ -122,6 +123,7 @@ static const char* cmCTestWarningMatches[] = { "cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*", "^CMake Warning.*:", "^\\[WARNING\\]", + "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): (warning|предупреждение)", nullptr }; @@ -160,6 +162,9 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = { { "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 }, { "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 }, + { "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): " + "(error|ошибка|warning|предупреждение)", + 1, 3 }, { nullptr, 0, 0 } }; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 57b1dda..1b2f769 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -49,9 +49,8 @@ public: } ~cmCTestRunProcess() { - if (!(this->PipeState == -1) && - !(this->PipeState == cmsysProcess_Pipe_None) && - !(this->PipeState == cmsysProcess_Pipe_Timeout)) { + if (this->PipeState != -1 && this->PipeState != cmsysProcess_Pipe_None && + this->PipeState != cmsysProcess_Pipe_Timeout) { this->WaitForExit(); } cmsysProcess_Delete(this->Process); @@ -148,7 +147,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile( cmGeneratedFileStream& covLogFile, int logFileCount) { char covLogFilename[1024]; - sprintf(covLogFilename, "CoverageLog-%d", logFileCount); + snprintf(covLogFilename, sizeof(covLogFilename), "CoverageLog-%d", + logFileCount); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " << covLogFilename << std::endl, this->Quiet); @@ -165,7 +165,8 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, int logFileCount) { char covLogFilename[1024]; - sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount); + snprintf(covLogFilename, sizeof(covLogFilename), "CoverageLog-%d.xml", + logFileCount); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " << covLogFilename << std::endl, this->Quiet); @@ -692,7 +693,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf) # define fnc_prefix(s, t) cmHasPrefix(s, t) #endif -bool IsFileInDir(const std::string& infile, const std::string& indir) +static bool IsFileInDir(const std::string& infile, const std::string& indir) { std::string file = cmSystemTools::CollapseFullPath(infile); std::string dir = cmSystemTools::CollapseFullPath(indir); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index d85edcc..da94754 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -582,16 +582,17 @@ private: time_t seconds = static_cast<time_t>(person.Time); struct tm* t = gmtime(&seconds); char dt[1024]; - sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900, - t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); + snprintf(dt, sizeof(dt), "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, + t->tm_min, t->tm_sec); std::string out = dt; // Add the time-zone field "+zone" or "-zone". char tz[32]; if (person.TimeZone >= 0) { - sprintf(tz, " +%04ld", person.TimeZone); + snprintf(tz, sizeof(tz), " +%04ld", person.TimeZone); } else { - sprintf(tz, " -%04ld", -person.TimeZone); + snprintf(tz, sizeof(tz), " -%04ld", -person.TimeZone); } out += tz; return out; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9d2cef6..6cd3b09 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -229,7 +229,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; char buf[1024]; - sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count()); + snprintf(buf, sizeof(buf), "%6.2f sec", + this->TestProcess->GetTotalTime().count()); outputStream << buf << "\n"; bool passedOrSkipped = passed || skipped; @@ -294,9 +295,10 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) ttime -= minutes; auto seconds = std::chrono::duration_cast<std::chrono::seconds>(ttime); char buffer[100]; - sprintf(buffer, "%02d:%02d:%02d", static_cast<unsigned>(hours.count()), - static_cast<unsigned>(minutes.count()), - static_cast<unsigned>(seconds.count())); + snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d", + static_cast<unsigned>(hours.count()), + static_cast<unsigned>(minutes.count()), + static_cast<unsigned>(seconds.count())); *this->TestHandler->LogFile << "----------------------------------------------------------" << std::endl; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index f685f66..16c0a0e 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -48,8 +48,6 @@ # include <unistd.h> #endif -#define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log" - cmCTestScriptHandler::cmCTestScriptHandler() = default; void cmCTestScriptHandler::Initialize() @@ -411,7 +409,7 @@ int cmCTestScriptHandler::ExtractVariables() char updateVar[40]; int i; for (i = 1; i < 10; ++i) { - sprintf(updateVar, "CTEST_EXTRA_UPDATES_%i", i); + snprintf(updateVar, sizeof(updateVar), "CTEST_EXTRA_UPDATES_%i", i); cmValue updateVal = this->Makefile->GetDefinition(updateVar); if (updateVal) { if (this->UpdateCmd.empty()) { diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index c4f87e9..a2dc615 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -58,6 +58,9 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() this->CTest->SetCTestConfigurationFromCMakeVariable( this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "SubmitInactivityTimeout", + "CTEST_SUBMIT_INACTIVITY_TIMEOUT", this->Quiet); cmValue notesFilesVariable = this->Makefile->GetDefinition("CTEST_NOTES_FILES"); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index b99bb79..fae5e30 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,6 +7,7 @@ #include <cstdlib> #include <sstream> +#include <cm/iomanip> #include <cmext/algorithm> #include <cm3p/curl/curl.h> @@ -216,8 +217,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( // if there is little to no activity for too long stop submitting ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1); - ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, - SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT); + auto submitInactivityTimeout = this->GetSubmitInactivityTimeout(); + if (submitInactivityTimeout != 0) { + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, + submitInactivityTimeout); + } /* HTTP PUT please */ ::curl_easy_setopt(curl, CURLOPT_PUT, 1); @@ -499,7 +503,10 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector<std::string> args = cmExpandedList(curlopt); curl.SetCurlOptions(args); - curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT); + auto submitInactivityTimeout = this->GetSubmitInactivityTimeout(); + if (submitInactivityTimeout != 0) { + curl.SetTimeOutSeconds(submitInactivityTimeout); + } curl.SetHttpHeaders(this->HttpHeaders); std::string url = this->CTest->GetSubmitURL(); if (!cmHasLiteralPrefix(url, "http://") && @@ -893,6 +900,26 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts) } } +int cmCTestSubmitHandler::GetSubmitInactivityTimeout() +{ + int submitInactivityTimeout = SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT; + std::string const& timeoutStr = + this->CTest->GetCTestConfiguration("SubmitInactivityTimeout"); + if (!timeoutStr.empty()) { + unsigned long timeout; + if (cmStrToULong(timeoutStr, &timeout)) { + submitInactivityTimeout = static_cast<int>(timeout); + } else { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "SubmitInactivityTimeout is invalid: " + << cm::quoted(timeoutStr) << "." + << " Using a default value of " + << SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT << "." << std::endl); + } + } + return submitInactivityTimeout; +} + void cmCTestSubmitHandler::SelectFiles(std::set<std::string> const& files) { this->Files.insert(files.begin(), files.end()); diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 809c615..0c7253c 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -63,6 +63,7 @@ private: void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk); std::string GetSubmitResultsPrefix(); + int GetSubmitInactivityTimeout(); class ResponseParser; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6e97a83..02db0c6 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -59,6 +59,8 @@ public: } virtual ~cmCTestCommand() = default; + cmCTestCommand(const cmCTestCommand&) = default; + cmCTestCommand& operator=(const cmCTestCommand&) = default; bool operator()(std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) @@ -621,7 +623,7 @@ void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed, this->PrintLabelOrSubprojectSummary(false); } char realBuf[1024]; - sprintf(realBuf, "%6.2f sec", durationInSecs.count()); + snprintf(realBuf, sizeof(realBuf), "%6.2f sec", durationInSecs.count()); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet); @@ -782,7 +784,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) label.resize(maxlen + 3, ' '); char buf[1024]; - sprintf(buf, "%6.2f sec*proc", labelTimes[i]); + snprintf(buf, sizeof(buf), "%6.2f sec*proc", labelTimes[i]); std::ostringstream labelCountStr; labelCountStr << "(" << labelCounts[i] << " test"; diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 423b506..9ba6456 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -123,8 +123,9 @@ std::string cmCTestVC::GetNightlyTime() this->CTest->GetCTestConfiguration("NightlyStartTime"), this->CTest->GetTomorrowTag()); char current_time[1024]; - sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900, - t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); + snprintf(current_time, sizeof(current_time), "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, + t->tm_sec); return std::string(current_time); } diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 16bca01..e14a4e1 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -511,7 +511,7 @@ std::string cmProcess::GetExitExceptionString() const default: char buf[1024]; const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n"; - _snprintf(buf, 1024, fmt, this->ExitValue); + snprintf(buf, sizeof(buf), fmt, this->ExitValue); exception_str.assign(buf); } #else |