mirror of
https://github.com/reactos/CMake.git
synced 2024-12-05 02:06:34 +00:00
Merge topic 'ctest-chrono'
5fd979a8
CTest: adopt std::chrono::system_clock
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1487
This commit is contained in:
commit
345ae8d0e1
@ -407,7 +407,7 @@ int cmCTestBuildHandler::ProcessHandler()
|
||||
|
||||
// Remember start build time
|
||||
this->StartBuild = this->CTest->CurrentTime();
|
||||
this->StartBuildTime = cmSystemTools::GetTime();
|
||||
this->StartBuildTime = std::chrono::system_clock::now();
|
||||
int retVal = 0;
|
||||
int res = cmsysProcess_State_Exited;
|
||||
if (!this->CTest->GetShowOnly()) {
|
||||
@ -421,7 +421,7 @@ int cmCTestBuildHandler::ProcessHandler()
|
||||
|
||||
// Remember end build time and calculate elapsed time
|
||||
this->EndBuild = this->CTest->CurrentTime();
|
||||
this->EndBuildTime = cmSystemTools::GetTime();
|
||||
this->EndBuildTime = std::chrono::system_clock::now();
|
||||
auto elapsed_build_time =
|
||||
std::chrono::steady_clock::now() - elapsed_time_start;
|
||||
|
||||
@ -488,8 +488,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
|
||||
this->CTest->GenerateSubprojectsOutput(xml);
|
||||
xml.StartElement("Build");
|
||||
xml.Element("StartDateTime", this->StartBuild);
|
||||
xml.Element("StartBuildTime",
|
||||
static_cast<unsigned int>(this->StartBuildTime));
|
||||
xml.Element("StartBuildTime", this->StartBuildTime);
|
||||
xml.Element("BuildCommand", this->GetMakeCommand());
|
||||
}
|
||||
|
||||
@ -644,7 +643,7 @@ void cmCTestBuildHandler::GenerateXMLFooter(
|
||||
xml.EndElement(); // Log
|
||||
|
||||
xml.Element("EndDateTime", this->EndBuild);
|
||||
xml.Element("EndBuildTime", static_cast<unsigned int>(this->EndBuildTime));
|
||||
xml.Element("EndBuildTime", this->EndBuildTime);
|
||||
xml.Element(
|
||||
"ElapsedMinutes",
|
||||
std::chrono::duration_cast<std::chrono::minutes>(elapsed_build_time)
|
||||
|
@ -94,8 +94,8 @@ private:
|
||||
|
||||
std::string StartBuild;
|
||||
std::string EndBuild;
|
||||
double StartBuildTime;
|
||||
double EndBuildTime;
|
||||
std::chrono::system_clock::time_point StartBuildTime;
|
||||
std::chrono::system_clock::time_point EndBuildTime;
|
||||
|
||||
std::vector<std::string> CustomErrorMatches;
|
||||
std::vector<std::string> CustomErrorExceptions;
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
#include <chrono>
|
||||
@ -57,8 +56,7 @@ int cmCTestConfigureHandler::ProcessHandler()
|
||||
return 1;
|
||||
}
|
||||
std::string start_time = this->CTest->CurrentTime();
|
||||
unsigned int start_time_time =
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime());
|
||||
auto start_time_time = std::chrono::system_clock::now();
|
||||
|
||||
cmGeneratedFileStream ofs;
|
||||
this->StartLogFile("Configure", ofs);
|
||||
@ -84,8 +82,7 @@ int cmCTestConfigureHandler::ProcessHandler()
|
||||
xml.Element("Log", output);
|
||||
xml.Element("ConfigureStatus", retVal);
|
||||
xml.Element("EndDateTime", this->CTest->CurrentTime());
|
||||
xml.Element("EndConfigureTime",
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("EndConfigureTime", std::chrono::system_clock::now());
|
||||
xml.Element("ElapsedMinutes",
|
||||
std::chrono::duration_cast<std::chrono::minutes>(
|
||||
std::chrono::steady_clock::now() - elapsed_time_start)
|
||||
|
@ -175,14 +175,13 @@ void cmCTestCoverageHandler::StartCoverageLogXML(cmXMLWriter& xml)
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
xml.StartElement("CoverageLog");
|
||||
xml.Element("StartDateTime", this->CTest->CurrentTime());
|
||||
xml.Element("StartTime",
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("StartTime", std::chrono::system_clock::now());
|
||||
}
|
||||
|
||||
void cmCTestCoverageHandler::EndCoverageLogXML(cmXMLWriter& xml)
|
||||
{
|
||||
xml.Element("EndDateTime", this->CTest->CurrentTime());
|
||||
xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("EndTime", std::chrono::system_clock::now());
|
||||
xml.EndElement(); // CoverageLog
|
||||
this->CTest->EndXML(xml);
|
||||
}
|
||||
@ -283,8 +282,7 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||
}
|
||||
|
||||
std::string coverage_start_time = this->CTest->CurrentTime();
|
||||
unsigned int coverage_start_time_time =
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime());
|
||||
auto coverage_start_time_time = std::chrono::system_clock::now();
|
||||
std::string sourceDir =
|
||||
this->CTest->GetCTestConfiguration("SourceDirectory");
|
||||
std::string binaryDir = this->CTest->GetCTestConfiguration("BuildDirectory");
|
||||
@ -622,8 +620,7 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||
covSumXML.Element("LOC", total_lines);
|
||||
covSumXML.Element("PercentCoverage", percent_coverage);
|
||||
covSumXML.Element("EndDateTime", end_time);
|
||||
covSumXML.Element("EndTime",
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
covSumXML.Element("EndTime", std::chrono::system_clock::now());
|
||||
covSumXML.Element("ElapsedMinutes",
|
||||
std::chrono::duration_cast<std::chrono::minutes>(
|
||||
std::chrono::steady_clock::now() - elapsed_time_start)
|
||||
@ -1970,8 +1967,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||
std::string coverage_start_time = this->CTest->CurrentTime();
|
||||
xml.StartElement("Coverage");
|
||||
xml.Element("StartDateTime", coverage_start_time);
|
||||
xml.Element("StartTime",
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("StartTime", std::chrono::system_clock::now());
|
||||
std::string stdline;
|
||||
std::string errline;
|
||||
// expected output:
|
||||
@ -2092,7 +2088,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||
xml.Element("LOC", total_functions);
|
||||
xml.Element("PercentCoverage", SAFEDIV(percent_coverage, number_files));
|
||||
xml.Element("EndDateTime", end_time);
|
||||
xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("EndTime", std::chrono::system_clock::now());
|
||||
xml.Element("ElapsedMinutes",
|
||||
std::chrono::duration_cast<std::chrono::minutes>(
|
||||
std::chrono::steady_clock::now() - elapsed_time_start)
|
||||
|
@ -1069,6 +1069,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
||||
if (subproject) {
|
||||
str << "subproject=" << curl.Escape(subproject) << "&";
|
||||
}
|
||||
auto timeNow =
|
||||
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
str << "stamp=" << curl.Escape(this->CTest->GetCurrentTag()) << "-"
|
||||
<< curl.Escape(this->CTest->GetTestModelString()) << "&"
|
||||
<< "model=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
|
||||
@ -1077,8 +1079,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
||||
<< "site=" << curl.Escape(this->CTest->GetCTestConfiguration("Site"))
|
||||
<< "&"
|
||||
<< "track=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
|
||||
<< "starttime=" << static_cast<int>(cmSystemTools::GetTime()) << "&"
|
||||
<< "endtime=" << static_cast<int>(cmSystemTools::GetTime()) << "&"
|
||||
<< "starttime=" << timeNow << "&"
|
||||
<< "endtime=" << timeNow << "&"
|
||||
<< "datafilesmd5[0]=" << md5sum << "&"
|
||||
<< "type=" << curl.Escape(typeString);
|
||||
std::string fields = str.str();
|
||||
|
@ -1204,7 +1204,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
||||
{
|
||||
this->ComputeTestList();
|
||||
this->StartTest = this->CTest->CurrentTime();
|
||||
this->StartTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
|
||||
this->StartTestTime = std::chrono::system_clock::now();
|
||||
auto elapsed_time_start = std::chrono::steady_clock::now();
|
||||
|
||||
cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs()
|
||||
@ -1271,7 +1271,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
||||
}
|
||||
delete parallel;
|
||||
this->EndTest = this->CTest->CurrentTime();
|
||||
this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
|
||||
this->EndTestTime = std::chrono::system_clock::now();
|
||||
this->ElapsedTestingTime =
|
||||
std::chrono::steady_clock::now() - elapsed_time_start;
|
||||
*this->LogFile << "End testing: " << this->CTest->CurrentTime() << std::endl;
|
||||
|
@ -207,8 +207,8 @@ protected:
|
||||
std::vector<std::string> CustomTestsIgnore;
|
||||
std::string StartTest;
|
||||
std::string EndTest;
|
||||
unsigned int StartTestTime;
|
||||
unsigned int EndTestTime;
|
||||
std::chrono::system_clock::time_point StartTestTime;
|
||||
std::chrono::system_clock::time_point EndTestTime;
|
||||
bool MemCheck;
|
||||
int CustomMaximumPassedTestOutputSize;
|
||||
int CustomMaximumFailedTestOutputSize;
|
||||
|
@ -177,8 +177,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
||||
return -1;
|
||||
}
|
||||
std::string start_time = this->CTest->CurrentTime();
|
||||
unsigned int start_time_time =
|
||||
static_cast<unsigned int>(cmSystemTools::GetTime());
|
||||
auto start_time_time = std::chrono::system_clock::now();
|
||||
auto elapsed_time_start = std::chrono::steady_clock::now();
|
||||
|
||||
bool updated = vc->Update();
|
||||
@ -226,7 +225,7 @@ int cmCTestUpdateHandler::ProcessHandler()
|
||||
cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet);
|
||||
std::string end_time = this->CTest->CurrentTime();
|
||||
xml.Element("EndDateTime", end_time);
|
||||
xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime()));
|
||||
xml.Element("EndTime", std::chrono::system_clock::now());
|
||||
xml.Element("ElapsedMinutes",
|
||||
std::chrono::duration_cast<std::chrono::minutes>(
|
||||
std::chrono::steady_clock::now() - elapsed_time_start)
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "cmsys/String.hxx"
|
||||
#include "cmsys/SystemInformation.hxx"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include <ctype.h>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
@ -1418,7 +1418,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
std::string note_time = this->CurrentTime();
|
||||
xml.StartElement("Note");
|
||||
xml.Attribute("Name", file);
|
||||
xml.Element("Time", static_cast<uint64_t>(cmSystemTools::GetTime()));
|
||||
xml.Element("Time", std::chrono::system_clock::now());
|
||||
xml.Element("DateTime", note_time);
|
||||
xml.StartElement("Text");
|
||||
cmsys::ifstream ifs(file.c_str());
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "cmXMLSafe.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <ostream>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
@ -99,6 +101,22 @@ private:
|
||||
return cmXMLSafe(value).Quotes(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a std::chrono::system::time_point to the number of seconds since
|
||||
* the UN*X epoch.
|
||||
*
|
||||
* It would be tempting to convert a time_point to number of seconds by
|
||||
* using time_since_epoch(). Unfortunately the C++11 standard does not
|
||||
* specify what the epoch of the system_clock must be.
|
||||
* Therefore we must assume it is an arbitary point in time. Instead of this
|
||||
* method, it is recommended to convert it by means of the to_time_t method.
|
||||
*/
|
||||
static std::time_t SafeContent(
|
||||
std::chrono::system_clock::time_point const& value)
|
||||
{
|
||||
return std::chrono::system_clock::to_time_t(value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T SafeContent(T value)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user