mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-03 05:08:47 -06:00
Merge topic 'ctest-devirtualize-handlers'
5a72dbd40ccmCTest: Remove dead codea5eeb0310dcmCTest: Cleanup typedefs71a3391b5fcmCTest: Use default member initializationb172a81d55cmCTest: Use concrete accessor functions for TestingHandlers46090c2337cmCTest: Store TestingHandlers by valueda5ee509b2cmCTest: Move all data members to private implementation struct670d27da64cmCTest: Remove friend declarations9406844616cmCTest: De-inline all member functions Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de> Merge-request: !3114
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestBuildHandler.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
@@ -39,12 +38,10 @@ cmCTestBuildCommand::~cmCTestBuildCommand()
|
||||
|
||||
cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
|
||||
{
|
||||
cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("build");
|
||||
if (!handler) {
|
||||
this->SetError("internal CTest error. Cannot instantiate build handler");
|
||||
return nullptr;
|
||||
}
|
||||
this->Handler = static_cast<cmCTestBuildHandler*>(handler);
|
||||
cmCTestBuildHandler* handler = this->CTest->GetBuildHandler();
|
||||
handler->Initialize();
|
||||
|
||||
this->Handler = handler;
|
||||
|
||||
const char* ctestBuildCommand =
|
||||
this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "cmCTestConfigureCommand.h"
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestConfigureHandler.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
@@ -142,13 +142,8 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
|
||||
labelsForSubprojects, this->Quiet);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* handler =
|
||||
this->CTest->GetInitializedHandler("configure");
|
||||
if (!handler) {
|
||||
this->SetError(
|
||||
"internal CTest error. Cannot instantiate configure handler");
|
||||
return nullptr;
|
||||
}
|
||||
cmCTestConfigureHandler* handler = this->CTest->GetConfigureHandler();
|
||||
handler->Initialize();
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,8 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
|
||||
this->Quiet);
|
||||
cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
|
||||
this->CTest->GetInitializedHandler("coverage"));
|
||||
if (!handler) {
|
||||
this->SetError("internal CTest error. Cannot instantiate test handler");
|
||||
return nullptr;
|
||||
}
|
||||
cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
|
||||
handler->Initialize();
|
||||
|
||||
// If a LABELS option was given, select only files with the labels.
|
||||
if (this->LabelsMentioned) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestMemCheckHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
|
||||
@@ -20,8 +19,8 @@ cmCTestMemCheckCommand::cmCTestMemCheckCommand()
|
||||
|
||||
cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler()
|
||||
{
|
||||
cmCTestGenericHandler* handler =
|
||||
this->CTest->GetInitializedHandler("memcheck");
|
||||
cmCTestMemCheckHandler* handler = this->CTest->GetMemCheckHandler();
|
||||
handler->Initialize();
|
||||
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet);
|
||||
|
||||
@@ -132,14 +132,17 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
||||
} else {
|
||||
this->TestResult.Status = cmCTestTestHandler::FAILED;
|
||||
outputStream << "***Failed " << reason;
|
||||
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
|
||||
outputTestErrorsToConsole =
|
||||
this->CTest->GetOutputTestOutputOnTestFailure();
|
||||
}
|
||||
} else if (res == cmProcess::State::Expired) {
|
||||
outputStream << "***Timeout ";
|
||||
this->TestResult.Status = cmCTestTestHandler::TIMEOUT;
|
||||
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
|
||||
outputTestErrorsToConsole =
|
||||
this->CTest->GetOutputTestOutputOnTestFailure();
|
||||
} else if (res == cmProcess::State::Exception) {
|
||||
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
|
||||
outputTestErrorsToConsole =
|
||||
this->CTest->GetOutputTestOutputOnTestFailure();
|
||||
outputStream << "***Exception: ";
|
||||
this->TestResult.ExceptionStatus =
|
||||
this->TestProcess->GetExitExceptionString();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "cmCTestSubmitCommand.h"
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestSubmitHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
@@ -42,33 +41,23 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
|
||||
if (notesFilesVariable) {
|
||||
std::vector<std::string> notesFiles;
|
||||
cmCTest::VectorOfStrings newNotesFiles;
|
||||
cmSystemTools::ExpandListArgument(notesFilesVariable, notesFiles);
|
||||
newNotesFiles.insert(newNotesFiles.end(), notesFiles.begin(),
|
||||
notesFiles.end());
|
||||
this->CTest->GenerateNotesFile(newNotesFiles);
|
||||
this->CTest->GenerateNotesFile(notesFiles);
|
||||
}
|
||||
|
||||
const char* extraFilesVariable =
|
||||
this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
|
||||
if (extraFilesVariable) {
|
||||
std::vector<std::string> extraFiles;
|
||||
cmCTest::VectorOfStrings newExtraFiles;
|
||||
cmSystemTools::ExpandListArgument(extraFilesVariable, extraFiles);
|
||||
newExtraFiles.insert(newExtraFiles.end(), extraFiles.begin(),
|
||||
extraFiles.end());
|
||||
if (!this->CTest->SubmitExtraFiles(newExtraFiles)) {
|
||||
if (!this->CTest->SubmitExtraFiles(extraFiles)) {
|
||||
this->SetError("problem submitting extra files.");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* handler =
|
||||
this->CTest->GetInitializedHandler("submit");
|
||||
if (!handler) {
|
||||
this->SetError("internal CTest error. Cannot instantiate submit handler");
|
||||
return nullptr;
|
||||
}
|
||||
cmCTestSubmitHandler* handler = this->CTest->GetSubmitHandler();
|
||||
handler->Initialize();
|
||||
|
||||
// If no FILES or PARTS given, *all* PARTS are submitted by default.
|
||||
//
|
||||
@@ -90,38 +79,30 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
// But FILES with no PARTS mentioned should just submit the FILES
|
||||
// without any of the default parts.
|
||||
//
|
||||
std::set<cmCTest::Part> noParts;
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts);
|
||||
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files);
|
||||
handler->SelectParts(std::set<cmCTest::Part>());
|
||||
handler->SelectFiles(this->Files);
|
||||
}
|
||||
|
||||
// If a PARTS option was given, select only the named parts for submission.
|
||||
//
|
||||
if (this->PartsMentioned) {
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
|
||||
handler->SelectParts(this->Parts);
|
||||
}
|
||||
|
||||
// Pass along any HTTPHEADER to the handler if this option was given.
|
||||
if (!this->HttpHeaders.empty()) {
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetHttpHeaders(
|
||||
this->HttpHeaders);
|
||||
handler->SetHttpHeaders(this->HttpHeaders);
|
||||
}
|
||||
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
|
||||
"RetryDelay", this->RetryDelay.c_str());
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
|
||||
"RetryCount", this->RetryCount.c_str());
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
|
||||
"InternalTest", this->InternalTest ? "ON" : "OFF");
|
||||
handler->SetOption("RetryDelay", this->RetryDelay.c_str());
|
||||
handler->SetOption("RetryCount", this->RetryCount.c_str());
|
||||
handler->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF");
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
|
||||
if (this->CDashUpload) {
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
|
||||
"CDashUploadFile", this->CDashUploadFile.c_str());
|
||||
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
|
||||
"CDashUploadType", this->CDashUploadType.c_str());
|
||||
handler->SetOption("CDashUploadFile", this->CDashUploadFile.c_str());
|
||||
handler->SetOption("CDashUploadType", this->CDashUploadType.c_str());
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ protected:
|
||||
std::set<cmCTest::Part> Parts;
|
||||
bool FilesMentioned;
|
||||
bool InternalTest;
|
||||
cmCTest::SetOfStrings Files;
|
||||
std::set<std::string> Files;
|
||||
std::string RetryCount;
|
||||
std::string RetryDelay;
|
||||
bool CDashUpload;
|
||||
|
||||
@@ -259,8 +259,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
|
||||
upload_as += "-";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
|
||||
cmCTestScriptHandler* ch = static_cast<cmCTestScriptHandler*>(
|
||||
this->CTest->GetHandler("script"));
|
||||
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
|
||||
cmake* cm = ch->GetCMake();
|
||||
if (cm) {
|
||||
const char* subproject =
|
||||
@@ -558,8 +557,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
||||
// has already been uploaded
|
||||
// TODO I added support for subproject. You would need to add
|
||||
// a "&subproject=subprojectname" to the first POST.
|
||||
cmCTestScriptHandler* ch =
|
||||
static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script"));
|
||||
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
|
||||
cmake* cm = ch->GetCMake();
|
||||
const char* subproject = cm->GetState()->GetGlobalProperty("SubProject");
|
||||
// TODO: Encode values for a URL instead of trusting caller.
|
||||
@@ -902,7 +900,7 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files)
|
||||
void cmCTestSubmitHandler::SelectFiles(std::set<std::string> const& files)
|
||||
{
|
||||
this->Files.insert(files.begin(), files.end());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void SelectParts(std::set<cmCTest::Part> const& parts);
|
||||
|
||||
/** Specify a set of files to submit. */
|
||||
void SelectFiles(cmCTest::SetOfStrings const& files);
|
||||
void SelectFiles(std::set<std::string> const& files);
|
||||
|
||||
// handle the cdash file upload protocol
|
||||
int HandleCDashUploadFile(std::string const& file, std::string const& type);
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
bool SubmitPart[cmCTest::PartCount];
|
||||
bool HasWarnings;
|
||||
bool HasErrors;
|
||||
cmCTest::SetOfStrings Files;
|
||||
std::set<std::string> Files;
|
||||
std::vector<std::string> HttpHeaders;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestTestHandler.h"
|
||||
#include "cmDuration.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
@@ -140,5 +141,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
|
||||
|
||||
cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
|
||||
{
|
||||
return this->CTest->GetInitializedHandler("test");
|
||||
cmCTestTestHandler* handler = this->CTest->GetTestHandler();
|
||||
handler->Initialize();
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "cmCTestUpdateCommand.h"
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestUpdateHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
@@ -74,12 +74,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "P4Options", "CTEST_P4_OPTIONS", this->Quiet);
|
||||
|
||||
cmCTestGenericHandler* handler =
|
||||
this->CTest->GetInitializedHandler("update");
|
||||
if (!handler) {
|
||||
this->SetError("internal CTest error. Cannot instantiate update handler");
|
||||
return nullptr;
|
||||
}
|
||||
cmCTestUpdateHandler* handler = this->CTest->GetUpdateHandler();
|
||||
handler->Initialize();
|
||||
handler->SetCommand(this);
|
||||
if (source_dir.empty()) {
|
||||
this->SetError("source directory not specified. Please use SOURCE tag");
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestUploadHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
@@ -14,14 +13,9 @@
|
||||
|
||||
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
|
||||
{
|
||||
cmCTestGenericHandler* handler =
|
||||
this->CTest->GetInitializedHandler("upload");
|
||||
if (!handler) {
|
||||
this->SetError("internal CTest error. Cannot instantiate upload handler");
|
||||
return nullptr;
|
||||
}
|
||||
static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
|
||||
|
||||
cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
|
||||
handler->Initialize();
|
||||
handler->SetFiles(this->Files);
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestHandlerCommand.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
class cmCTestGenericHandler;
|
||||
@@ -22,8 +22,6 @@ class cmCommand;
|
||||
class cmCTestUploadCommand : public cmCTestHandlerCommand
|
||||
{
|
||||
public:
|
||||
cmCTestUploadCommand() {}
|
||||
|
||||
/**
|
||||
* This is a virtual constructor for the command.
|
||||
*/
|
||||
@@ -55,7 +53,7 @@ protected:
|
||||
ArgumentDoingLast2
|
||||
};
|
||||
|
||||
cmCTest::SetOfStrings Files;
|
||||
std::set<std::string> Files;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmCTestUploadHandler.h"
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmVersion.h"
|
||||
#include "cmXMLWriter.h"
|
||||
@@ -20,7 +21,7 @@ void cmCTestUploadHandler::Initialize()
|
||||
this->Files.clear();
|
||||
}
|
||||
|
||||
void cmCTestUploadHandler::SetFiles(const cmCTest::SetOfStrings& files)
|
||||
void cmCTestUploadHandler::SetFiles(std::set<std::string> const& files)
|
||||
{
|
||||
this->Files = files;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
/** \class cmCTestUploadHandler
|
||||
* \brief Helper class for CTest
|
||||
*
|
||||
@@ -20,7 +22,6 @@ public:
|
||||
typedef cmCTestGenericHandler Superclass;
|
||||
|
||||
cmCTestUploadHandler();
|
||||
~cmCTestUploadHandler() override {}
|
||||
|
||||
/*
|
||||
* The main entry point for this class
|
||||
@@ -30,10 +31,10 @@ public:
|
||||
void Initialize() override;
|
||||
|
||||
/** Specify a set of files to submit. */
|
||||
void SetFiles(cmCTest::SetOfStrings const& files);
|
||||
void SetFiles(std::set<std::string> const& files);
|
||||
|
||||
private:
|
||||
cmCTest::SetOfStrings Files;
|
||||
std::set<std::string> Files;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
1117
Source/cmCTest.cxx
1117
Source/cmCTest.cxx
File diff suppressed because it is too large
Load Diff
258
Source/cmCTest.h
258
Source/cmCTest.h
@@ -10,13 +10,22 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <memory> // IWYU pragma: keep
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
|
||||
class cmCTestGenericHandler;
|
||||
class cmCTestBuildHandler;
|
||||
class cmCTestBuildAndTestHandler;
|
||||
class cmCTestCoverageHandler;
|
||||
class cmCTestScriptHandler;
|
||||
class cmCTestTestHandler;
|
||||
class cmCTestUpdateHandler;
|
||||
class cmCTestConfigureHandler;
|
||||
class cmCTestMemCheckHandler;
|
||||
class cmCTestSubmitHandler;
|
||||
class cmCTestUploadHandler;
|
||||
class cmCTestStartCommand;
|
||||
class cmGeneratedFileStream;
|
||||
class cmMakefile;
|
||||
@@ -31,9 +40,6 @@ class cmXMLWriter;
|
||||
*/
|
||||
class cmCTest
|
||||
{
|
||||
friend class cmCTestRunTest;
|
||||
friend class cmCTestMultiProcessHandler;
|
||||
|
||||
public:
|
||||
typedef cmProcessOutput::Encoding Encoding;
|
||||
/** Enumerate parts of the testing and submission process. */
|
||||
@@ -54,44 +60,10 @@ public:
|
||||
PartCount // Update names in constructor when adding a part
|
||||
};
|
||||
|
||||
/** Representation of one part. */
|
||||
struct PartInfo
|
||||
{
|
||||
void SetName(const std::string& name) { this->Name = name; }
|
||||
const std::string& GetName() const { return this->Name; }
|
||||
|
||||
void Enable() { this->Enabled = true; }
|
||||
explicit operator bool() const { return this->Enabled; }
|
||||
|
||||
std::vector<std::string> SubmitFiles;
|
||||
|
||||
private:
|
||||
bool Enabled = false;
|
||||
std::string Name;
|
||||
};
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
enum HTTPMethod
|
||||
{
|
||||
HTTP_GET,
|
||||
HTTP_POST,
|
||||
HTTP_PUT
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform an HTTP request.
|
||||
*/
|
||||
static int HTTPRequest(std::string url, HTTPMethod method,
|
||||
std::string& response, std::string const& fields = "",
|
||||
std::string const& putFile = "", int timeout = 0);
|
||||
#endif
|
||||
|
||||
/** Get a testing part id from its string name. Returns PartCount
|
||||
if the string does not name a valid part. */
|
||||
Part GetPartFromName(const char* name);
|
||||
|
||||
typedef std::vector<std::string> VectorOfStrings;
|
||||
typedef std::set<std::string> SetOfStrings;
|
||||
|
||||
/** Process Command line arguments */
|
||||
int Run(std::vector<std::string>&, std::string* output = nullptr);
|
||||
|
||||
@@ -128,7 +100,7 @@ public:
|
||||
/**
|
||||
* Is the tomorrow tag set?
|
||||
*/
|
||||
bool GetTomorrowTag() { return this->TomorrowTag; }
|
||||
bool GetTomorrowTag() const;
|
||||
|
||||
/**
|
||||
* Try to run tests of the project
|
||||
@@ -137,16 +109,16 @@ public:
|
||||
|
||||
/** what is the configuration type, e.g. Debug, Release etc. */
|
||||
std::string const& GetConfigType();
|
||||
cmDuration GetTimeOut() { return this->TimeOut; }
|
||||
void SetTimeOut(cmDuration t) { this->TimeOut = t; }
|
||||
cmDuration GetTimeOut() const;
|
||||
void SetTimeOut(cmDuration t);
|
||||
|
||||
cmDuration GetGlobalTimeout() { return this->GlobalTimeout; }
|
||||
cmDuration GetGlobalTimeout() const;
|
||||
|
||||
/** how many test to run at the same time */
|
||||
int GetParallelLevel() { return this->ParallelLevel; }
|
||||
int GetParallelLevel() const;
|
||||
void SetParallelLevel(int);
|
||||
|
||||
unsigned long GetTestLoad() { return this->TestLoad; }
|
||||
unsigned long GetTestLoad() const;
|
||||
void SetTestLoad(unsigned long);
|
||||
|
||||
/**
|
||||
@@ -164,7 +136,7 @@ public:
|
||||
* Set the cmake test mode (experimental, nightly, continuous).
|
||||
*/
|
||||
void SetTestModel(int mode);
|
||||
int GetTestModel() { return this->TestModel; }
|
||||
int GetTestModel() const;
|
||||
|
||||
std::string GetTestModelString();
|
||||
static int GetTestModelFromString(const char* str);
|
||||
@@ -222,26 +194,23 @@ public:
|
||||
|
||||
int GetOutputAsJsonVersion();
|
||||
|
||||
bool ShouldUseHTTP10() { return this->UseHTTP10; }
|
||||
bool ShouldUseHTTP10() const;
|
||||
|
||||
bool ShouldPrintLabels() { return this->PrintLabels; }
|
||||
bool ShouldPrintLabels() const;
|
||||
|
||||
bool ShouldCompressTestOutput();
|
||||
bool CompressString(std::string& str);
|
||||
|
||||
std::chrono::system_clock::time_point GetStopTime()
|
||||
{
|
||||
return this->StopTime;
|
||||
}
|
||||
std::chrono::system_clock::time_point GetStopTime() const;
|
||||
void SetStopTime(std::string const& time);
|
||||
|
||||
/** Used for parallel ctest job scheduling */
|
||||
std::string GetScheduleType() { return this->ScheduleType; }
|
||||
void SetScheduleType(std::string const& type) { this->ScheduleType = type; }
|
||||
std::string GetScheduleType() const;
|
||||
void SetScheduleType(std::string const& type);
|
||||
|
||||
/** The max output width */
|
||||
int GetMaxTestNameWidth() const;
|
||||
void SetMaxTestNameWidth(int w) { this->MaxTestNameWidth = w; }
|
||||
void SetMaxTestNameWidth(int w);
|
||||
|
||||
/**
|
||||
* Run a single executable command and put the stdout and stderr
|
||||
@@ -334,17 +303,19 @@ public:
|
||||
std::vector<std::string>* environment,
|
||||
Encoding encoding = cmProcessOutput::Auto);
|
||||
|
||||
/**
|
||||
* Execute handler and return its result. If the handler fails, it returns
|
||||
* negative value.
|
||||
*/
|
||||
int ExecuteHandler(const char* handler);
|
||||
|
||||
/**
|
||||
* Get the handler object
|
||||
*/
|
||||
cmCTestGenericHandler* GetHandler(const char* handler);
|
||||
cmCTestGenericHandler* GetInitializedHandler(const char* handler);
|
||||
cmCTestBuildHandler* GetBuildHandler();
|
||||
cmCTestBuildAndTestHandler* GetBuildAndTestHandler();
|
||||
cmCTestCoverageHandler* GetCoverageHandler();
|
||||
cmCTestScriptHandler* GetScriptHandler();
|
||||
cmCTestTestHandler* GetTestHandler();
|
||||
cmCTestUpdateHandler* GetUpdateHandler();
|
||||
cmCTestConfigureHandler* GetConfigureHandler();
|
||||
cmCTestMemCheckHandler* GetMemCheckHandler();
|
||||
cmCTestSubmitHandler* GetSubmitHandler();
|
||||
cmCTestUploadHandler* GetUploadHandler();
|
||||
|
||||
/**
|
||||
* Set the CTest variable from CMake variable
|
||||
@@ -354,9 +325,6 @@ public:
|
||||
const std::string& cmake_var,
|
||||
bool suppress = false);
|
||||
|
||||
/** Make string safe to be sent as a URL */
|
||||
static std::string MakeURLSafe(const std::string&);
|
||||
|
||||
/** Decode a URL to the original string. */
|
||||
static std::string DecodeURL(const std::string&);
|
||||
|
||||
@@ -364,10 +332,7 @@ public:
|
||||
* Should ctect configuration be updated. When using new style ctest
|
||||
* script, this should be true.
|
||||
*/
|
||||
void SetSuppressUpdatingCTestConfiguration(bool val)
|
||||
{
|
||||
this->SuppressUpdatingCTestConfiguration = val;
|
||||
}
|
||||
void SetSuppressUpdatingCTestConfiguration(bool val);
|
||||
|
||||
/**
|
||||
* Add overwrite to ctest configuration.
|
||||
@@ -377,14 +342,14 @@ public:
|
||||
void AddCTestConfigurationOverwrite(const std::string& encstr);
|
||||
|
||||
/** Create XML file that contains all the notes specified */
|
||||
int GenerateNotesFile(const VectorOfStrings& files);
|
||||
int GenerateNotesFile(std::vector<std::string> const& files);
|
||||
|
||||
/** Create XML file to indicate that build is complete */
|
||||
int GenerateDoneFile();
|
||||
|
||||
/** Submit extra files to the server */
|
||||
bool SubmitExtraFiles(const char* files);
|
||||
bool SubmitExtraFiles(const VectorOfStrings& files);
|
||||
bool SubmitExtraFiles(std::vector<std::string> const& files);
|
||||
|
||||
/** Set the output log file name */
|
||||
void SetOutputLogFileName(const char* name);
|
||||
@@ -424,62 +389,52 @@ public:
|
||||
std::string GetColorCode(Color color) const;
|
||||
|
||||
/** The Build ID is assigned by CDash */
|
||||
void SetBuildID(const std::string& id) { this->BuildID = id; }
|
||||
std::string GetBuildID() { return this->BuildID; }
|
||||
void SetBuildID(const std::string& id);
|
||||
std::string GetBuildID() const;
|
||||
|
||||
/** Add file to be submitted */
|
||||
void AddSubmitFile(Part part, const char* name);
|
||||
std::vector<std::string> const& GetSubmitFiles(Part part)
|
||||
{
|
||||
return this->Parts[part].SubmitFiles;
|
||||
}
|
||||
void ClearSubmitFiles(Part part) { this->Parts[part].SubmitFiles.clear(); }
|
||||
std::vector<std::string> const& GetSubmitFiles(Part part) const;
|
||||
void ClearSubmitFiles(Part part);
|
||||
|
||||
/**
|
||||
* Read the custom configuration files and apply them to the current ctest
|
||||
*/
|
||||
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf);
|
||||
|
||||
std::vector<std::string>& GetInitialCommandLineArguments()
|
||||
{
|
||||
return this->InitialCommandLineArguments;
|
||||
}
|
||||
std::vector<std::string>& GetInitialCommandLineArguments();
|
||||
|
||||
/** Set the track to submit to */
|
||||
void SetSpecificTrack(const char* track);
|
||||
const char* GetSpecificTrack();
|
||||
|
||||
void SetFailover(bool failover) { this->Failover = failover; }
|
||||
bool GetFailover() { return this->Failover; }
|
||||
void SetFailover(bool failover);
|
||||
bool GetFailover() const;
|
||||
|
||||
bool GetTestProgressOutput() const { return this->TestProgressOutput; }
|
||||
bool GetTestProgressOutput() const;
|
||||
|
||||
bool GetVerbose() { return this->Verbose; }
|
||||
bool GetExtraVerbose() { return this->ExtraVerbose; }
|
||||
bool GetVerbose() const;
|
||||
bool GetExtraVerbose() const;
|
||||
|
||||
/** Direct process output to given streams. */
|
||||
void SetStreams(std::ostream* out, std::ostream* err)
|
||||
{
|
||||
this->StreamOut = out;
|
||||
this->StreamErr = err;
|
||||
}
|
||||
void SetStreams(std::ostream* out, std::ostream* err);
|
||||
|
||||
void AddSiteProperties(cmXMLWriter& xml);
|
||||
|
||||
bool GetLabelSummary() { return this->LabelSummary; }
|
||||
bool GetSubprojectSummary() { return this->SubprojectSummary; }
|
||||
bool GetLabelSummary() const;
|
||||
bool GetSubprojectSummary() const;
|
||||
|
||||
std::string GetCostDataFile();
|
||||
|
||||
const std::map<std::string, std::string>& GetDefinitions()
|
||||
{
|
||||
return this->Definitions;
|
||||
}
|
||||
bool GetOutputTestOutputOnTestFailure() const;
|
||||
|
||||
const std::map<std::string, std::string>& GetDefinitions() const;
|
||||
|
||||
/** Return the number of times a test should be run */
|
||||
int GetTestRepeat() { return this->RepeatTests; }
|
||||
int GetTestRepeat() const;
|
||||
|
||||
/** Return true if test should run until fail */
|
||||
bool GetRepeatUntilFail() { return this->RepeatUntilFail; }
|
||||
bool GetRepeatUntilFail() const;
|
||||
|
||||
void GenerateSubprojectsOutput(cmXMLWriter& xml);
|
||||
std::vector<std::string> GetLabelsForSubprojects();
|
||||
@@ -487,85 +442,8 @@ public:
|
||||
void SetRunCurrentScript(bool value);
|
||||
|
||||
private:
|
||||
int RepeatTests;
|
||||
bool RepeatUntilFail;
|
||||
std::string ConfigType;
|
||||
std::string ScheduleType;
|
||||
std::chrono::system_clock::time_point StopTime;
|
||||
bool TestProgressOutput;
|
||||
bool Verbose;
|
||||
bool ExtraVerbose;
|
||||
bool ProduceXML;
|
||||
bool LabelSummary;
|
||||
bool SubprojectSummary;
|
||||
bool UseHTTP10;
|
||||
bool PrintLabels;
|
||||
bool Failover;
|
||||
|
||||
bool FlushTestProgressLine;
|
||||
|
||||
bool ForceNewCTestProcess;
|
||||
|
||||
bool RunConfigurationScript;
|
||||
|
||||
int GenerateNotesFile(const char* files);
|
||||
|
||||
// these are helper classes
|
||||
typedef std::map<std::string, cmCTestGenericHandler*> t_TestingHandlers;
|
||||
t_TestingHandlers TestingHandlers;
|
||||
|
||||
bool ShowOnly;
|
||||
bool OutputAsJson;
|
||||
int OutputAsJsonVersion;
|
||||
|
||||
/** Map of configuration properties */
|
||||
typedef std::map<std::string, std::string> CTestConfigurationMap;
|
||||
|
||||
// TODO: The ctest configuration should be a hierarchy of
|
||||
// configuration option sources: command-line, script, ini file.
|
||||
// Then the ini file can get re-loaded whenever it changes without
|
||||
// affecting any higher-precedence settings.
|
||||
CTestConfigurationMap CTestConfiguration;
|
||||
CTestConfigurationMap CTestConfigurationOverwrites;
|
||||
PartInfo Parts[PartCount];
|
||||
typedef std::map<std::string, Part> PartMapType;
|
||||
PartMapType PartMap;
|
||||
|
||||
std::string CurrentTag;
|
||||
bool TomorrowTag;
|
||||
|
||||
int TestModel;
|
||||
std::string SpecificTrack;
|
||||
|
||||
cmDuration TimeOut;
|
||||
|
||||
cmDuration GlobalTimeout;
|
||||
|
||||
int MaxTestNameWidth;
|
||||
|
||||
int ParallelLevel;
|
||||
bool ParallelLevelSetInCli;
|
||||
|
||||
unsigned long TestLoad;
|
||||
|
||||
int CompatibilityMode;
|
||||
|
||||
// information for the --build-and-test options
|
||||
std::string BinaryDir;
|
||||
|
||||
std::string NotesFiles;
|
||||
|
||||
bool InteractiveDebugMode;
|
||||
|
||||
bool ShortDateFormat;
|
||||
|
||||
bool CompressXMLFiles;
|
||||
bool CompressTestOutput;
|
||||
|
||||
void InitStreams();
|
||||
std::ostream* StreamOut;
|
||||
std::ostream* StreamErr;
|
||||
|
||||
void BlockTestErrorDiagnostics();
|
||||
|
||||
/**
|
||||
@@ -610,7 +488,8 @@ private:
|
||||
bool UpdateCTestConfiguration();
|
||||
|
||||
/** Create note from files. */
|
||||
int GenerateCTestNotesOutput(cmXMLWriter& xml, const VectorOfStrings& files);
|
||||
int GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
std::vector<std::string> const& files);
|
||||
|
||||
/** Check if the argument is the one specified */
|
||||
bool CheckArgument(const std::string& arg, const char* varg1,
|
||||
@@ -630,25 +509,8 @@ private:
|
||||
int RunCMakeAndTest(std::string* output);
|
||||
int ExecuteTests();
|
||||
|
||||
bool SuppressUpdatingCTestConfiguration;
|
||||
|
||||
bool Debug;
|
||||
bool ShowLineNumbers;
|
||||
bool Quiet;
|
||||
|
||||
std::string BuildID;
|
||||
|
||||
std::vector<std::string> InitialCommandLineArguments;
|
||||
|
||||
int SubmitIndex;
|
||||
|
||||
cmGeneratedFileStream* OutputLogFile;
|
||||
int OutputLogFileLastTag;
|
||||
|
||||
bool OutputTestOutputOnTestFailure;
|
||||
bool OutputColorCode;
|
||||
|
||||
std::map<std::string, std::string> Definitions;
|
||||
struct Private;
|
||||
std::unique_ptr<Private> Impl;
|
||||
};
|
||||
|
||||
class cmCTestLogWrite
|
||||
|
||||
@@ -191,8 +191,7 @@ int main(int argc, char const* const* argv)
|
||||
doc.addCTestStandardDocSections();
|
||||
if (doc.CheckOptions(argc, argv)) {
|
||||
// Construct and print requested documentation.
|
||||
cmCTestScriptHandler* ch =
|
||||
static_cast<cmCTestScriptHandler*>(inst.GetHandler("script"));
|
||||
cmCTestScriptHandler* ch = inst.GetScriptHandler();
|
||||
ch->CreateCMake();
|
||||
|
||||
doc.SetShowGenerators(false);
|
||||
|
||||
Reference in New Issue
Block a user