cmCTest: Use default member initialization

This commit is contained in:
Regina Pfeifer
2019-03-18 22:25:50 +01:00
committed by Brad King
parent b172a81d55
commit 71a3391b5f
2 changed files with 42 additions and 95 deletions

View File

@@ -87,26 +87,26 @@ struct cmCTest::Private
std::string Name; std::string Name;
}; };
int RepeatTests; int RepeatTests = 1; // default to run each test once
bool RepeatUntilFail; bool RepeatUntilFail = false;
std::string ConfigType; std::string ConfigType;
std::string ScheduleType; std::string ScheduleType;
std::chrono::system_clock::time_point StopTime; std::chrono::system_clock::time_point StopTime;
bool TestProgressOutput; bool TestProgressOutput = false;
bool Verbose; bool Verbose = false;
bool ExtraVerbose; bool ExtraVerbose = false;
bool ProduceXML; bool ProduceXML = false;
bool LabelSummary; bool LabelSummary = true;
bool SubprojectSummary; bool SubprojectSummary = true;
bool UseHTTP10; bool UseHTTP10 = false;
bool PrintLabels; bool PrintLabels = false;
bool Failover; bool Failover = false;
bool FlushTestProgressLine; bool FlushTestProgressLine = false;
bool ForceNewCTestProcess; bool ForceNewCTestProcess = false;
bool RunConfigurationScript; bool RunConfigurationScript = false;
// these are helper classes // these are helper classes
cmCTestBuildHandler BuildHandler; cmCTestBuildHandler BuildHandler;
@@ -143,9 +143,9 @@ struct cmCTest::Private
{ "upload", &this->UploadHandler } }; { "upload", &this->UploadHandler } };
} }
bool ShowOnly; bool ShowOnly = false;
bool OutputAsJson; bool OutputAsJson = false;
int OutputAsJsonVersion; int OutputAsJsonVersion = 1;
/** Map of configuration properties */ /** Map of configuration properties */
typedef std::map<std::string, std::string> CTestConfigurationMap; typedef std::map<std::string, std::string> CTestConfigurationMap;
@@ -161,21 +161,21 @@ struct cmCTest::Private
PartMapType PartMap; PartMapType PartMap;
std::string CurrentTag; std::string CurrentTag;
bool TomorrowTag; bool TomorrowTag = false;
int TestModel; int TestModel = cmCTest::EXPERIMENTAL;
std::string SpecificTrack; std::string SpecificTrack;
cmDuration TimeOut; cmDuration TimeOut = cmDuration::zero();
cmDuration GlobalTimeout; cmDuration GlobalTimeout = cmDuration::zero();
int MaxTestNameWidth; int MaxTestNameWidth = 30;
int ParallelLevel; int ParallelLevel = 1;
bool ParallelLevelSetInCli; bool ParallelLevelSetInCli = false;
unsigned long TestLoad; unsigned long TestLoad = 0;
int CompatibilityMode; int CompatibilityMode;
@@ -184,33 +184,34 @@ struct cmCTest::Private
std::string NotesFiles; std::string NotesFiles;
bool InteractiveDebugMode; bool InteractiveDebugMode = true;
bool ShortDateFormat; bool ShortDateFormat = true;
bool CompressXMLFiles; bool CompressXMLFiles = false;
bool CompressTestOutput; bool CompressTestOutput = true;
std::ostream* StreamOut; // By default we write output to the process output streams.
std::ostream* StreamErr; std::ostream* StreamOut = &std::cout;
std::ostream* StreamErr = &std::cerr;
bool SuppressUpdatingCTestConfiguration; bool SuppressUpdatingCTestConfiguration = false;
bool Debug; bool Debug = false;
bool ShowLineNumbers; bool ShowLineNumbers = false;
bool Quiet; bool Quiet = false;
std::string BuildID; std::string BuildID;
std::vector<std::string> InitialCommandLineArguments; std::vector<std::string> InitialCommandLineArguments;
int SubmitIndex; int SubmitIndex = 0;
cmGeneratedFileStream* OutputLogFile; cmGeneratedFileStream* OutputLogFile = nullptr;
int OutputLogFileLastTag; int OutputLogFileLastTag = -1;
bool OutputTestOutputOnTestFailure; bool OutputTestOutputOnTestFailure = false;
bool OutputColorCode; bool OutputColorCode = cmCTest::ColoredOutputSupportedByConsole();
std::map<std::string, std::string> Definitions; std::map<std::string, std::string> Definitions;
}; };
@@ -411,47 +412,6 @@ std::string cmCTest::DecodeURL(const std::string& in)
cmCTest::cmCTest() cmCTest::cmCTest()
: Impl(new Private) : Impl(new Private)
{ {
this->Impl->LabelSummary = true;
this->Impl->SubprojectSummary = true;
this->Impl->ParallelLevel = 1;
this->Impl->ParallelLevelSetInCli = false;
this->Impl->TestLoad = 0;
this->Impl->SubmitIndex = 0;
this->Impl->Failover = false;
this->Impl->ForceNewCTestProcess = false;
this->Impl->TomorrowTag = false;
this->Impl->TestProgressOutput = false;
this->Impl->FlushTestProgressLine = false;
this->Impl->Verbose = false;
this->Impl->Debug = false;
this->Impl->ShowLineNumbers = false;
this->Impl->Quiet = false;
this->Impl->ExtraVerbose = false;
this->Impl->ProduceXML = false;
this->Impl->ShowOnly = false;
this->Impl->OutputAsJson = false;
this->Impl->OutputAsJsonVersion = 1;
this->Impl->RunConfigurationScript = false;
this->Impl->UseHTTP10 = false;
this->Impl->PrintLabels = false;
this->Impl->CompressTestOutput = true;
this->Impl->TestModel = cmCTest::EXPERIMENTAL;
this->Impl->MaxTestNameWidth = 30;
this->Impl->InteractiveDebugMode = true;
this->Impl->TimeOut = cmDuration::zero();
this->Impl->GlobalTimeout = cmDuration::zero();
this->Impl->CompressXMLFiles = false;
this->Impl->ScheduleType.clear();
this->Impl->OutputLogFile = nullptr;
this->Impl->OutputLogFileLastTag = -1;
this->Impl->SuppressUpdatingCTestConfiguration = false;
this->Impl->BuildID = "";
this->Impl->OutputTestOutputOnTestFailure = false;
this->Impl->OutputColorCode = cmCTest::ColoredOutputSupportedByConsole();
this->Impl->RepeatTests = 1; // default to run each test once
this->Impl->RepeatUntilFail = false;
std::string envValue; std::string envValue;
if (cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE", envValue)) { if (cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE", envValue)) {
this->Impl->OutputTestOutputOnTestFailure = this->Impl->OutputTestOutputOnTestFailure =
@@ -462,8 +422,6 @@ cmCTest::cmCTest()
this->Impl->TestProgressOutput = !cmSystemTools::IsOff(envValue); this->Impl->TestProgressOutput = !cmSystemTools::IsOff(envValue);
} }
this->InitStreams();
this->Impl->Parts[PartStart].SetName("Start"); this->Impl->Parts[PartStart].SetName("Start");
this->Impl->Parts[PartUpdate].SetName("Update"); this->Impl->Parts[PartUpdate].SetName("Update");
this->Impl->Parts[PartConfigure].SetName("Configure"); this->Impl->Parts[PartConfigure].SetName("Configure");
@@ -483,8 +441,6 @@ cmCTest::cmCTest()
->PartMap[cmSystemTools::LowerCase(this->Impl->Parts[p].GetName())] = p; ->PartMap[cmSystemTools::LowerCase(this->Impl->Parts[p].GetName())] = p;
} }
this->Impl->ShortDateFormat = true;
for (auto& handler : this->Impl->GetTestingHandlers()) { for (auto& handler : this->Impl->GetTestingHandlers()) {
handler->SetCTestInstance(this); handler->SetCTestInstance(this);
} }
@@ -495,7 +451,7 @@ cmCTest::cmCTest()
cmCTest::~cmCTest() cmCTest::~cmCTest()
{ {
this->SetOutputLogFileName(nullptr); delete this->Impl->OutputLogFile;
} }
int cmCTest::GetParallelLevel() const int cmCTest::GetParallelLevel() const
@@ -3188,13 +3144,6 @@ static const char* cmCTestStringLogType[] = { "DEBUG",
} \ } \
} while (false) } while (false)
void cmCTest::InitStreams()
{
// By default we write output to the process output streams.
this->Impl->StreamOut = &std::cout;
this->Impl->StreamErr = &std::cerr;
}
void cmCTest::Log(int logType, const char* file, int line, const char* msg, void cmCTest::Log(int logType, const char* file, int line, const char* msg,
bool suppress) bool suppress)
{ {

View File

@@ -467,8 +467,6 @@ public:
private: private:
int GenerateNotesFile(const char* files); int GenerateNotesFile(const char* files);
void InitStreams();
void BlockTestErrorDiagnostics(); void BlockTestErrorDiagnostics();
/** /**