mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 13:48:33 -05:00
Merge topic 'ctest-handler-refactoring'
9fe40b33e0cmCTest*Handler: Use default member initializationd07a35a336cmCTest: Remove handler instancesb64e59d571cmCTestSubmitHandler: Initialize HttpHeaders with command line81e904bd53cmCTestScriptHandler: Don't inherit from cmCTestGenericHandler914a355810CTest: Remove unneeded code70dfb24957cmCTestTestHandler: Consolidate simple options into cmCTestTestOptionsb43d3dcfbacmCTestTestHandler: Consolidate File options into cmCTestTestOptionsf7181175adcmCTestTestHandler: Consolidate RegExp options into cmCTestTestOptions ... Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9926
This commit is contained in:
@@ -1109,6 +1109,7 @@ add_library(
|
||||
CTest/cmCTestTestCommand.cxx
|
||||
CTest/cmCTestTestHandler.cxx
|
||||
CTest/cmCTestTestMeasurementXMLParser.cxx
|
||||
CTest/cmCTestTypes.cxx
|
||||
CTest/cmCTestUpdateCommand.cxx
|
||||
CTest/cmCTestUpdateHandler.cxx
|
||||
CTest/cmCTestUploadCommand.cxx
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestBuildHandler.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCommand.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -39,10 +40,9 @@ void cmCTestBuildCommand::BindArguments()
|
||||
|
||||
cmCTestBuildCommand::~cmCTestBuildCommand() = default;
|
||||
|
||||
cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler()
|
||||
{
|
||||
cmCTestBuildHandler* handler = this->CTest->GetBuildHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestBuildHandler>(this->CTest);
|
||||
|
||||
cmValue ctestBuildCommand =
|
||||
this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
|
||||
@@ -133,7 +133,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
|
||||
}
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
void cmCTestBuildCommand::ProcessAdditionalValues(
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
protected:
|
||||
void ProcessAdditionalValues(cmCTestGenericHandler* handler) override;
|
||||
void BindArguments() override;
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
std::string NumberErrors;
|
||||
std::string NumberWarnings;
|
||||
|
||||
@@ -176,62 +176,10 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = {
|
||||
{ nullptr, 0, 0 }
|
||||
};
|
||||
|
||||
cmCTestBuildHandler::cmCTestBuildHandler()
|
||||
cmCTestBuildHandler::cmCTestBuildHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
, LastErrorOrWarning(this->ErrorsAndWarnings.end())
|
||||
{
|
||||
this->MaxPreContext = 10;
|
||||
this->MaxPostContext = 10;
|
||||
|
||||
this->MaxErrors = 50;
|
||||
this->MaxWarnings = 50;
|
||||
|
||||
this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
|
||||
|
||||
this->UseCTestLaunch = false;
|
||||
}
|
||||
|
||||
void cmCTestBuildHandler::Initialize(cmCTest* ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
this->StartBuild.clear();
|
||||
this->EndBuild.clear();
|
||||
this->CustomErrorMatches.clear();
|
||||
this->CustomErrorExceptions.clear();
|
||||
this->CustomWarningMatches.clear();
|
||||
this->CustomWarningExceptions.clear();
|
||||
this->ReallyCustomWarningMatches.clear();
|
||||
this->ReallyCustomWarningExceptions.clear();
|
||||
this->ErrorWarningFileLineRegex.clear();
|
||||
|
||||
this->ErrorMatchRegex.clear();
|
||||
this->ErrorExceptionRegex.clear();
|
||||
this->WarningMatchRegex.clear();
|
||||
this->WarningExceptionRegex.clear();
|
||||
this->BuildProcessingQueue.clear();
|
||||
this->BuildProcessingErrorQueue.clear();
|
||||
this->BuildOutputLogSize = 0;
|
||||
this->CurrentProcessingLine.clear();
|
||||
|
||||
this->SimplifySourceDir.clear();
|
||||
this->SimplifyBuildDir.clear();
|
||||
this->OutputLineCounter = 0;
|
||||
this->ErrorsAndWarnings.clear();
|
||||
this->LastErrorOrWarning = this->ErrorsAndWarnings.end();
|
||||
this->PostContextCount = 0;
|
||||
this->MaxPreContext = 10;
|
||||
this->MaxPostContext = 10;
|
||||
this->PreContext.clear();
|
||||
|
||||
this->TotalErrors = 0;
|
||||
this->TotalWarnings = 0;
|
||||
this->LastTickChar = 0;
|
||||
|
||||
this->ErrorQuotaReached = false;
|
||||
this->WarningQuotaReached = false;
|
||||
|
||||
this->MaxErrors = 50;
|
||||
this->MaxWarnings = 50;
|
||||
|
||||
this->UseCTestLaunch = false;
|
||||
}
|
||||
|
||||
void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
@@ -502,7 +450,7 @@ int cmCTestBuildHandler::ProcessHandler()
|
||||
|
||||
void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
|
||||
{
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
this->CTest->GenerateSubprojectsOutput(xml);
|
||||
xml.StartElement("Build");
|
||||
xml.Element("StartDateTime", this->StartBuild);
|
||||
|
||||
@@ -37,15 +37,10 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
cmCTestBuildHandler();
|
||||
cmCTestBuildHandler(cmCTest* ctest);
|
||||
|
||||
void PopulateCustomVectors(cmMakefile* mf) override;
|
||||
|
||||
/**
|
||||
* Initialize handler
|
||||
*/
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
|
||||
int GetTotalErrors() const { return this->TotalErrors; }
|
||||
int GetTotalWarnings() const { return this->TotalWarnings; }
|
||||
|
||||
@@ -121,34 +116,34 @@ private:
|
||||
|
||||
t_BuildProcessingQueueType BuildProcessingQueue;
|
||||
t_BuildProcessingQueueType BuildProcessingErrorQueue;
|
||||
size_t BuildOutputLogSize;
|
||||
size_t BuildOutputLogSize = 0;
|
||||
std::vector<char> CurrentProcessingLine;
|
||||
|
||||
std::string SimplifySourceDir;
|
||||
std::string SimplifyBuildDir;
|
||||
size_t OutputLineCounter;
|
||||
size_t OutputLineCounter = 0;
|
||||
using t_ErrorsAndWarningsVector = std::vector<cmCTestBuildErrorWarning>;
|
||||
t_ErrorsAndWarningsVector ErrorsAndWarnings;
|
||||
t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
|
||||
size_t PostContextCount;
|
||||
size_t MaxPreContext;
|
||||
size_t MaxPostContext;
|
||||
size_t PostContextCount = 0;
|
||||
size_t MaxPreContext = 10;
|
||||
size_t MaxPostContext = 10;
|
||||
std::deque<std::string> PreContext;
|
||||
|
||||
int TotalErrors;
|
||||
int TotalWarnings;
|
||||
char LastTickChar;
|
||||
int TotalErrors = 0;
|
||||
int TotalWarnings = 0;
|
||||
char LastTickChar = '\0';
|
||||
|
||||
bool ErrorQuotaReached;
|
||||
bool WarningQuotaReached;
|
||||
bool ErrorQuotaReached = false;
|
||||
bool WarningQuotaReached = false;
|
||||
|
||||
int MaxErrors;
|
||||
int MaxWarnings;
|
||||
int MaxErrors = 50;
|
||||
int MaxWarnings = 50;
|
||||
|
||||
// Used to remove ANSI color codes before checking for errors and warnings.
|
||||
cmStringReplaceHelper* ColorRemover;
|
||||
|
||||
bool UseCTestLaunch;
|
||||
bool UseCTestLaunch = false;
|
||||
std::string CTestLaunchDir;
|
||||
class LaunchHelper;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestConfigureHandler.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmList.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -24,7 +25,8 @@ void cmCTestConfigureCommand::BindArguments()
|
||||
this->Bind("OPTIONS"_s, this->Options);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler>
|
||||
cmCTestConfigureCommand::InitializeHandler()
|
||||
{
|
||||
cmList options;
|
||||
|
||||
@@ -149,8 +151,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
|
||||
*labelsForSubprojects, this->Quiet);
|
||||
}
|
||||
|
||||
cmCTestConfigureHandler* handler = this->CTest->GetConfigureHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestConfigureHandler>(this->CTest);
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
std::string Options;
|
||||
};
|
||||
|
||||
@@ -11,11 +11,9 @@
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
cmCTestConfigureHandler::cmCTestConfigureHandler() = default;
|
||||
|
||||
void cmCTestConfigureHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestConfigureHandler::cmCTestConfigureHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
}
|
||||
|
||||
// clearly it would be nice if this were broken up into a few smaller
|
||||
@@ -71,7 +69,7 @@ int cmCTestConfigureHandler::ProcessHandler()
|
||||
|
||||
if (os) {
|
||||
cmXMLWriter xml(os);
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
this->CTest->GenerateSubprojectsOutput(xml);
|
||||
xml.StartElement("Configure");
|
||||
xml.Element("StartDateTime", start_time);
|
||||
|
||||
@@ -22,7 +22,5 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
cmCTestConfigureHandler();
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
cmCTestConfigureHandler(cmCTest* ctest);
|
||||
};
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestCoverageHandler.h"
|
||||
|
||||
class cmCTestGenericHandler;
|
||||
#include "cmCTestGenericHandler.h"
|
||||
|
||||
void cmCTestCoverageCommand::BindArguments()
|
||||
{
|
||||
@@ -17,15 +16,15 @@ void cmCTestCoverageCommand::BindArguments()
|
||||
this->Bind("LABELS"_s, this->Labels);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler>
|
||||
cmCTestCoverageCommand::InitializeHandler()
|
||||
{
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
|
||||
this->Quiet);
|
||||
cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestCoverageHandler>(this->CTest);
|
||||
|
||||
// If a LABELS option was given, select only files with the labels.
|
||||
if (this->Labels) {
|
||||
@@ -34,5 +33,5 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
||||
}
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Labels;
|
||||
};
|
||||
|
||||
@@ -40,17 +40,9 @@ class cmMakefile;
|
||||
|
||||
#define SAFEDIV(x, y) (((y) != 0) ? ((x) / (y)) : (0))
|
||||
|
||||
cmCTestCoverageHandler::cmCTestCoverageHandler() = default;
|
||||
|
||||
void cmCTestCoverageHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestCoverageHandler::cmCTestCoverageHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
this->CustomCoverageExclude.clear();
|
||||
this->SourceLabels.clear();
|
||||
this->TargetDirs.clear();
|
||||
this->LabelIdMap.clear();
|
||||
this->Labels.clear();
|
||||
this->LabelFilter.clear();
|
||||
}
|
||||
|
||||
void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log)
|
||||
@@ -99,7 +91,7 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
|
||||
|
||||
void cmCTestCoverageHandler::StartCoverageLogXML(cmXMLWriter& xml)
|
||||
{
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
xml.StartElement("CoverageLog");
|
||||
xml.Element("StartDateTime", this->CTest->CurrentTime());
|
||||
xml.Element("StartTime", std::chrono::system_clock::now());
|
||||
@@ -330,7 +322,7 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||
covSumFile.setf(std::ios::fixed, std::ios::floatfield);
|
||||
covSumFile.precision(2);
|
||||
|
||||
this->CTest->StartXML(covSumXML, this->AppendXML);
|
||||
this->CTest->StartXML(covSumXML, this->CMake, this->AppendXML);
|
||||
// Produce output xml files
|
||||
|
||||
covSumXML.StartElement("Coverage");
|
||||
@@ -1909,7 +1901,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||
"Cannot open coverage summary file." << std::endl);
|
||||
return 0;
|
||||
}
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
auto elapsed_time_start = std::chrono::steady_clock::now();
|
||||
std::string coverage_start_time = this->CTest->CurrentTime();
|
||||
xml.StartElement("Coverage");
|
||||
|
||||
@@ -45,9 +45,7 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
cmCTestCoverageHandler();
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
cmCTestCoverageHandler(cmCTest* ctest);
|
||||
|
||||
/**
|
||||
* This method is called when reading CTest custom file
|
||||
|
||||
@@ -3,114 +3,20 @@
|
||||
#include "cmCTestGenericHandler.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
cmCTestGenericHandler::cmCTestGenericHandler()
|
||||
cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest)
|
||||
: CTest(ctest)
|
||||
{
|
||||
this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
|
||||
this->CTest = nullptr;
|
||||
this->SubmitIndex = 0;
|
||||
this->AppendXML = false;
|
||||
this->Quiet = false;
|
||||
this->TestLoad = 0;
|
||||
this->SetVerbose(ctest->GetExtraVerbose());
|
||||
this->SetSubmitIndex(ctest->GetSubmitIndex());
|
||||
}
|
||||
|
||||
cmCTestGenericHandler::~cmCTestGenericHandler() = default;
|
||||
|
||||
namespace {
|
||||
/* Modify the given `map`, setting key `op` to `value` if `value`
|
||||
* is non-null, otherwise removing key `op` (if it exists).
|
||||
*/
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, const std::string& value)
|
||||
{
|
||||
map[op] = value;
|
||||
}
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, cmValue value)
|
||||
{
|
||||
if (!value) {
|
||||
map.erase(op);
|
||||
return;
|
||||
}
|
||||
|
||||
map[op] = *value;
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op, cmValue value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
cmValue value)
|
||||
{
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::AddMultiOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->MultiOptions[op].emplace_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::AddPersistentMultiOption(const std::string& op,
|
||||
const std::string& value)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->MultiOptions[op].emplace_back(value);
|
||||
this->PersistentMultiOptions[op].emplace_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::Initialize(cmCTest* ctest)
|
||||
{
|
||||
this->CTest = ctest;
|
||||
this->AppendXML = false;
|
||||
this->TestLoad = 0;
|
||||
this->Options = this->PersistentOptions;
|
||||
this->MultiOptions = this->PersistentMultiOptions;
|
||||
}
|
||||
|
||||
cmValue cmCTestGenericHandler::GetOption(const std::string& op)
|
||||
{
|
||||
auto remit = this->Options.find(op);
|
||||
if (remit == this->Options.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return cmValue(remit->second);
|
||||
}
|
||||
|
||||
std::vector<std::string> cmCTestGenericHandler::GetMultiOption(
|
||||
const std::string& optionName) const
|
||||
{
|
||||
// Avoid inserting a key, which MultiOptions[op] would do.
|
||||
auto remit = this->MultiOptions.find(optionName);
|
||||
if (remit == this->MultiOptions.end()) {
|
||||
return {};
|
||||
}
|
||||
return remit->second;
|
||||
}
|
||||
|
||||
bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
|
||||
const char* name,
|
||||
cmGeneratedFileStream& xofs)
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
class cmGeneratedFileStream;
|
||||
class cmMakefile;
|
||||
class cmake;
|
||||
|
||||
/** \class cmCTestGenericHandler
|
||||
* \brief A superclass of all CTest Handlers
|
||||
@@ -42,11 +41,6 @@ public:
|
||||
*/
|
||||
virtual int ProcessHandler() = 0;
|
||||
|
||||
/**
|
||||
* Initialize handler
|
||||
*/
|
||||
virtual void Initialize(cmCTest* ctest);
|
||||
|
||||
/**
|
||||
* Get the CTest instance
|
||||
*/
|
||||
@@ -55,46 +49,10 @@ public:
|
||||
/**
|
||||
* Construct handler
|
||||
*/
|
||||
cmCTestGenericHandler();
|
||||
cmCTestGenericHandler(cmCTest* ctest);
|
||||
virtual ~cmCTestGenericHandler();
|
||||
|
||||
using t_StringToString = std::map<std::string, std::string>;
|
||||
using t_StringToMultiString =
|
||||
std::map<std::string, std::vector<std::string>>;
|
||||
|
||||
/**
|
||||
* Options collect a single value from flags; passing the
|
||||
* flag multiple times on the command-line *overwrites* values,
|
||||
* and only the last one specified counts. Set an option to
|
||||
* nullptr to "unset" it.
|
||||
*
|
||||
* The value is stored as a string. The values set for single
|
||||
* and multi-options (see below) live in different spaces,
|
||||
* so calling a single-getter for a key that has only been set
|
||||
* as a multi-value will return nullptr.
|
||||
*/
|
||||
void SetPersistentOption(const std::string& op, const std::string& value);
|
||||
void SetPersistentOption(const std::string& op, cmValue value);
|
||||
void SetOption(const std::string& op, const std::string& value);
|
||||
void SetOption(const std::string& op, cmValue value);
|
||||
cmValue GetOption(const std::string& op);
|
||||
|
||||
/**
|
||||
* Multi-Options collect one or more values from flags; passing
|
||||
* the flag multiple times on the command-line *adds* values,
|
||||
* rather than overwriting the previous values.
|
||||
*
|
||||
* Adding an empty value does nothing.
|
||||
*
|
||||
* The value is stored as a vector of strings. The values set for single
|
||||
* (see above) and multi-options live in different spaces,
|
||||
* so calling a multi-getter for a key that has only been set
|
||||
* as a single-value will return an empty vector.
|
||||
*/
|
||||
void AddPersistentMultiOption(const std::string& optionName,
|
||||
const std::string& value);
|
||||
void AddMultiOption(const std::string& optionName, const std::string& value);
|
||||
std::vector<std::string> GetMultiOption(const std::string& op) const;
|
||||
|
||||
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
|
||||
int GetSubmitIndex() { return this->SubmitIndex; }
|
||||
@@ -105,21 +63,20 @@ public:
|
||||
void SetTestLoad(unsigned long load) { this->TestLoad = load; }
|
||||
unsigned long GetTestLoad() const { return this->TestLoad; }
|
||||
|
||||
void SetCMakeInstance(cmake* cm) { this->CMake = cm; }
|
||||
|
||||
protected:
|
||||
bool StartResultingXML(cmCTest::Part part, const char* name,
|
||||
cmGeneratedFileStream& xofs);
|
||||
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
|
||||
|
||||
bool AppendXML;
|
||||
bool Quiet;
|
||||
unsigned long TestLoad;
|
||||
cmSystemTools::OutputOption HandlerVerbose;
|
||||
bool AppendXML = false;
|
||||
bool Quiet = false;
|
||||
unsigned long TestLoad = 0;
|
||||
cmSystemTools::OutputOption HandlerVerbose = cmSystemTools::OUTPUT_NONE;
|
||||
cmCTest* CTest;
|
||||
t_StringToString Options;
|
||||
t_StringToString PersistentOptions;
|
||||
t_StringToMultiString MultiOptions;
|
||||
t_StringToMultiString PersistentMultiOptions;
|
||||
t_StringToString LogFileNames;
|
||||
cmake* CMake = nullptr;
|
||||
|
||||
int SubmitIndex;
|
||||
int SubmitIndex = 0;
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl);
|
||||
cmCTestGenericHandler* handler = this->InitializeHandler();
|
||||
auto handler = this->InitializeHandler();
|
||||
if (!handler) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Cannot instantiate test handler " << this->GetName()
|
||||
@@ -202,12 +202,13 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
|
||||
|
||||
// reread time limit, as the variable may have been modified.
|
||||
this->CTest->SetTimeLimit(this->Makefile->GetDefinition("CTEST_TIME_LIMIT"));
|
||||
handler->SetCMakeInstance(this->Makefile->GetCMakeInstance());
|
||||
|
||||
int res = handler->ProcessHandler();
|
||||
if (!this->ReturnValue.empty()) {
|
||||
this->Makefile->AddDefinition(this->ReturnValue, std::to_string(res));
|
||||
}
|
||||
this->ProcessAdditionalValues(handler);
|
||||
this->ProcessAdditionalValues(handler.get());
|
||||
// log the error message if there was an error
|
||||
if (captureCMakeError) {
|
||||
const char* returnString = "0";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
cmExecutionStatus& status) override;
|
||||
|
||||
protected:
|
||||
virtual cmCTestGenericHandler* InitializeHandler() = 0;
|
||||
virtual std::unique_ptr<cmCTestGenericHandler> InitializeHandler() = 0;
|
||||
|
||||
virtual void ProcessAdditionalValues(cmCTestGenericHandler* /*handler*/) {}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestMemCheckHandler.h"
|
||||
#include "cmCTestTestHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
|
||||
void cmCTestMemCheckCommand::BindArguments()
|
||||
@@ -14,10 +15,10 @@ void cmCTestMemCheckCommand::BindArguments()
|
||||
this->Bind("DEFECT_COUNT"_s, this->DefectCount);
|
||||
}
|
||||
|
||||
cmCTestTestHandler* cmCTestMemCheckCommand::InitializeActualHandler()
|
||||
std::unique_ptr<cmCTestTestHandler>
|
||||
cmCTestMemCheckCommand::InitializeActualHandler()
|
||||
{
|
||||
cmCTestMemCheckHandler* handler = this->CTest->GetMemCheckHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestMemCheckHandler>(this->CTest);
|
||||
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet);
|
||||
@@ -35,7 +36,7 @@ cmCTestTestHandler* cmCTestMemCheckCommand::InitializeActualHandler()
|
||||
"CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", this->Quiet);
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestTestHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
void cmCTestMemCheckCommand::ProcessAdditionalValues(
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
|
||||
cmCTestTestHandler* InitializeActualHandler() override;
|
||||
std::unique_ptr<cmCTestTestHandler> InitializeActualHandler() override;
|
||||
|
||||
void ProcessAdditionalValues(cmCTestGenericHandler* handler) override;
|
||||
|
||||
|
||||
@@ -118,26 +118,12 @@ public:
|
||||
#define BOUNDS_CHECKER_MARKER \
|
||||
"******######*****Begin BOUNDS CHECKER XML******######******"
|
||||
|
||||
cmCTestMemCheckHandler::cmCTestMemCheckHandler()
|
||||
cmCTestMemCheckHandler::cmCTestMemCheckHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
{
|
||||
this->MemCheck = true;
|
||||
this->CustomMaximumPassedTestOutputSize = 0;
|
||||
this->CustomMaximumFailedTestOutputSize = 0;
|
||||
this->LogWithPID = false;
|
||||
}
|
||||
|
||||
void cmCTestMemCheckHandler::Initialize(cmCTest* ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
this->LogWithPID = false;
|
||||
this->CustomMaximumPassedTestOutputSize = 0;
|
||||
this->CustomMaximumFailedTestOutputSize = 0;
|
||||
this->MemoryTester.clear();
|
||||
this->MemoryTesterDynamicOptions.clear();
|
||||
this->MemoryTesterOptions.clear();
|
||||
this->MemoryTesterStyle = UNKNOWN;
|
||||
this->MemoryTesterOutputFile.clear();
|
||||
this->DefectCount = 0;
|
||||
this->TestOptions.OutputSizePassed = 0;
|
||||
this->TestOptions.OutputSizeFailed = 0;
|
||||
}
|
||||
|
||||
int cmCTestMemCheckHandler::PreProcessHandler()
|
||||
@@ -311,7 +297,7 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml)
|
||||
if (!this->CTest->GetProduceXML()) {
|
||||
return;
|
||||
}
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
this->CTest->GenerateSubprojectsOutput(xml);
|
||||
xml.StartElement("DynamicAnalysis");
|
||||
switch (this->MemoryTesterStyle) {
|
||||
@@ -371,9 +357,8 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml)
|
||||
continue;
|
||||
}
|
||||
this->CleanTestOutput(
|
||||
memcheckstr,
|
||||
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize),
|
||||
this->TestOutputTruncation);
|
||||
memcheckstr, static_cast<size_t>(this->TestOptions.OutputSizeFailed),
|
||||
this->TestOptions.OutputTruncation);
|
||||
this->WriteTestResultHeader(xml, result);
|
||||
xml.StartElement("Results");
|
||||
int memoryErrors = 0;
|
||||
@@ -929,7 +914,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
|
||||
cmsys::SystemTools::Split(str, lines);
|
||||
bool unlimitedOutput = false;
|
||||
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
|
||||
this->CustomMaximumFailedTestOutputSize == 0) {
|
||||
this->TestOptions.OutputSizeFailed == 0) {
|
||||
unlimitedOutput = true;
|
||||
}
|
||||
|
||||
@@ -1029,7 +1014,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
|
||||
ostr << lines[i] << std::endl;
|
||||
if (!unlimitedOutput &&
|
||||
totalOutputSize >
|
||||
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) {
|
||||
static_cast<size_t>(this->TestOptions.OutputSizeFailed)) {
|
||||
ostr << "....\n";
|
||||
ostr << "Test Output for this test has been truncated see testing"
|
||||
" machine logs for full output,\n";
|
||||
@@ -1143,7 +1128,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
|
||||
cmsys::SystemTools::Split(str, lines);
|
||||
bool unlimitedOutput = false;
|
||||
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
|
||||
this->CustomMaximumFailedTestOutputSize == 0) {
|
||||
this->TestOptions.OutputSizeFailed == 0) {
|
||||
unlimitedOutput = true;
|
||||
}
|
||||
|
||||
@@ -1243,7 +1228,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
|
||||
ostr << lines[i] << std::endl;
|
||||
if (!unlimitedOutput &&
|
||||
totalOutputSize >
|
||||
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) {
|
||||
static_cast<size_t>(this->TestOptions.OutputSizeFailed)) {
|
||||
ostr << "....\n";
|
||||
ostr << "Test Output for this test has been truncated see testing"
|
||||
" machine logs for full output,\n";
|
||||
|
||||
@@ -26,9 +26,7 @@ public:
|
||||
|
||||
void PopulateCustomVectors(cmMakefile* mf) override;
|
||||
|
||||
cmCTestMemCheckHandler();
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
cmCTestMemCheckHandler(cmCTest* ctest);
|
||||
|
||||
int GetDefectCount() const;
|
||||
|
||||
@@ -101,15 +99,15 @@ private:
|
||||
std::string MemoryTester;
|
||||
std::vector<std::string> MemoryTesterDynamicOptions;
|
||||
std::vector<std::string> MemoryTesterOptions;
|
||||
int MemoryTesterStyle;
|
||||
int MemoryTesterStyle = UNKNOWN;
|
||||
std::string MemoryTesterOutputFile;
|
||||
std::string MemoryTesterEnvironmentVariable;
|
||||
// these are used to store the types of errors that can show up
|
||||
std::vector<std::string> ResultStrings;
|
||||
std::vector<std::string> ResultStringsLong;
|
||||
std::vector<int> GlobalResults;
|
||||
bool LogWithPID; // does log file add pid
|
||||
int DefectCount;
|
||||
bool LogWithPID = false; // does log file add pid
|
||||
int DefectCount = 0;
|
||||
|
||||
std::vector<int>::size_type FindOrAddWarning(const std::string& warning);
|
||||
// initialize the ResultStrings and ResultStringsLong for
|
||||
|
||||
@@ -296,11 +296,11 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
|
||||
if (!this->TestHandler->MemCheck && started) {
|
||||
this->TestHandler->CleanTestOutput(
|
||||
this->ProcessOutput,
|
||||
static_cast<size_t>(
|
||||
this->TestResult.Status == cmCTestTestHandler::COMPLETED
|
||||
? this->TestHandler->CustomMaximumPassedTestOutputSize
|
||||
: this->TestHandler->CustomMaximumFailedTestOutputSize),
|
||||
this->TestHandler->TestOutputTruncation);
|
||||
static_cast<size_t>(this->TestResult.Status ==
|
||||
cmCTestTestHandler::COMPLETED
|
||||
? this->TestHandler->TestOptions.OutputSizePassed
|
||||
: this->TestHandler->TestOptions.OutputSizeFailed),
|
||||
this->TestHandler->TestOptions.OutputTruncation);
|
||||
}
|
||||
this->TestResult.Reason = reason;
|
||||
if (this->TestHandler->LogFile) {
|
||||
|
||||
@@ -40,18 +40,9 @@
|
||||
#include "cmUVProcessChain.h"
|
||||
#include "cmake.h"
|
||||
|
||||
cmCTestScriptHandler::cmCTestScriptHandler() = default;
|
||||
|
||||
void cmCTestScriptHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestScriptHandler::cmCTestScriptHandler(cmCTest* ctest)
|
||||
: CTest(ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
|
||||
this->Makefile.reset();
|
||||
this->ParentMakefile = nullptr;
|
||||
|
||||
this->GlobalGenerator.reset();
|
||||
|
||||
this->CMake.reset();
|
||||
}
|
||||
|
||||
cmCTestScriptHandler::~cmCTestScriptHandler() = default;
|
||||
@@ -355,8 +346,7 @@ bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf,
|
||||
const std::string& sname, bool InProcess,
|
||||
int* returnValue)
|
||||
{
|
||||
auto sh = cm::make_unique<cmCTestScriptHandler>();
|
||||
sh->Initialize(ctest);
|
||||
auto sh = cm::make_unique<cmCTestScriptHandler>(ctest);
|
||||
sh->ParentMakefile = mf;
|
||||
sh->AddConfigurationScript(sname, InProcess);
|
||||
int res = sh->ProcessHandler();
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTestGenericHandler.h"
|
||||
|
||||
class cmCTest;
|
||||
class cmCTestCommand;
|
||||
class cmGlobalGenerator;
|
||||
@@ -19,11 +17,9 @@ class cmake;
|
||||
/** \class cmCTestScriptHandler
|
||||
* \brief A class that handles ctest -S invocations
|
||||
*/
|
||||
class cmCTestScriptHandler : public cmCTestGenericHandler
|
||||
class cmCTestScriptHandler
|
||||
{
|
||||
public:
|
||||
using Superclass = cmCTestGenericHandler;
|
||||
|
||||
/**
|
||||
* Add a script to run, and if is should run in the current process
|
||||
*/
|
||||
@@ -32,7 +28,7 @@ public:
|
||||
/**
|
||||
* Run a dashboard using a specified configuration script
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
int ProcessHandler();
|
||||
|
||||
/*
|
||||
* Run a script
|
||||
@@ -46,12 +42,10 @@ public:
|
||||
*/
|
||||
void UpdateElapsedTime();
|
||||
|
||||
cmCTestScriptHandler();
|
||||
cmCTestScriptHandler(cmCTest* ctest);
|
||||
cmCTestScriptHandler(const cmCTestScriptHandler&) = delete;
|
||||
const cmCTestScriptHandler& operator=(const cmCTestScriptHandler&) = delete;
|
||||
~cmCTestScriptHandler() override;
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
~cmCTestScriptHandler();
|
||||
|
||||
void CreateCMake();
|
||||
cmake* GetCMake() { return this->CMake.get(); }
|
||||
@@ -68,6 +62,7 @@ private:
|
||||
void AddCTestCommand(std::string const& name,
|
||||
std::unique_ptr<cmCTestCommand> command);
|
||||
|
||||
cmCTest* CTest = nullptr;
|
||||
std::vector<std::string> ConfigurationScripts;
|
||||
std::vector<bool> ScriptProcessScope;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestSubmitHandler.h"
|
||||
#include "cmCommand.h"
|
||||
#include "cmList.h"
|
||||
@@ -32,7 +33,8 @@ std::unique_ptr<cmCommand> cmCTestSubmitCommand::Clone()
|
||||
return std::unique_ptr<cmCommand>(std::move(ni));
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler>
|
||||
cmCTestSubmitCommand::InitializeHandler()
|
||||
{
|
||||
cmValue submitURL = !this->SubmitURL.empty()
|
||||
? cmValue(this->SubmitURL)
|
||||
@@ -108,7 +110,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
|
||||
if (notesFilesVariable) {
|
||||
cmList notesFiles{ *notesFilesVariable };
|
||||
this->CTest->GenerateNotesFile(notesFiles);
|
||||
this->CTest->GenerateNotesFile(this->Makefile->GetCMakeInstance(),
|
||||
notesFiles);
|
||||
}
|
||||
|
||||
cmValue extraFilesVariable =
|
||||
@@ -121,8 +124,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
}
|
||||
}
|
||||
|
||||
cmCTestSubmitHandler* handler = this->CTest->GetSubmitHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestSubmitHandler>(this->CTest);
|
||||
|
||||
// If no FILES or PARTS given, *all* PARTS are submitted by default.
|
||||
//
|
||||
@@ -175,7 +177,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||
handler->CDashUploadFile = this->CDashUploadFile;
|
||||
handler->CDashUploadType = this->CDashUploadType;
|
||||
}
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
void CheckArguments() override;
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
bool CDashUpload = false;
|
||||
bool InternalTest = false;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestCurl.h"
|
||||
#include "cmCTestScriptHandler.h"
|
||||
#include "cmCryptoHash.h"
|
||||
#include "cmCurl.h"
|
||||
#include "cmDuration.h"
|
||||
@@ -117,23 +116,15 @@ static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/,
|
||||
return 0;
|
||||
}
|
||||
|
||||
cmCTestSubmitHandler::cmCTestSubmitHandler() = default;
|
||||
|
||||
void cmCTestSubmitHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestSubmitHandler::cmCTestSubmitHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
, HttpHeaders(ctest->GetCommandLineHttpHeaders())
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
// We submit all available parts by default.
|
||||
for (cmCTest::Part p = cmCTest::PartStart; p != cmCTest::PartCount;
|
||||
p = static_cast<cmCTest::Part>(p + 1)) {
|
||||
this->SubmitPart[p] = true;
|
||||
}
|
||||
this->HasWarnings = false;
|
||||
this->HasErrors = false;
|
||||
this->HTTPProxy.clear();
|
||||
this->HTTPProxyType = 0;
|
||||
this->HTTPProxyAuth.clear();
|
||||
this->LogFile = nullptr;
|
||||
this->Files.clear();
|
||||
}
|
||||
|
||||
bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
||||
@@ -259,9 +250,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
|
||||
upload_as += "-";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetTestGroupString());
|
||||
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
|
||||
cmake* cm = ch->GetCMake();
|
||||
if (cm) {
|
||||
if (cmake* cm = this->CMake) {
|
||||
cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
|
||||
if (subproject) {
|
||||
upload_as += "&subproject=";
|
||||
@@ -556,9 +545,8 @@ 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 = this->CTest->GetScriptHandler();
|
||||
cmake* cm = ch->GetCMake();
|
||||
cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
|
||||
cmValue subproject =
|
||||
this->CMake->GetState()->GetGlobalProperty("SubProject");
|
||||
// TODO: Encode values for a URL instead of trusting caller.
|
||||
std::ostringstream str;
|
||||
if (subproject) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class cmCTestSubmitHandler : public cmCTestGenericHandler
|
||||
public:
|
||||
using Superclass = cmCTestGenericHandler;
|
||||
|
||||
cmCTestSubmitHandler();
|
||||
cmCTestSubmitHandler(cmCTest* ctest);
|
||||
~cmCTestSubmitHandler() override { this->LogFile = nullptr; }
|
||||
|
||||
/*
|
||||
@@ -31,8 +31,6 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
|
||||
/** Specify a set of parts (by name) to submit. */
|
||||
void SelectParts(std::set<cmCTest::Part> const& parts);
|
||||
|
||||
@@ -42,20 +40,9 @@ public:
|
||||
// handle the cdash file upload protocol
|
||||
int HandleCDashUploadFile(std::string const& file, std::string const& type);
|
||||
|
||||
void AddCommandLineHttpHeader(std::string const& h)
|
||||
{
|
||||
this->HttpHeaders.push_back(h);
|
||||
this->CommandLineHttpHeaders.push_back(h);
|
||||
}
|
||||
|
||||
void SetHttpHeaders(std::vector<std::string> const& v)
|
||||
{
|
||||
if (this->CommandLineHttpHeaders.empty()) {
|
||||
this->HttpHeaders = v;
|
||||
} else {
|
||||
this->HttpHeaders = this->CommandLineHttpHeaders;
|
||||
this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
|
||||
}
|
||||
this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -79,14 +66,13 @@ private:
|
||||
class ResponseParser;
|
||||
|
||||
std::string HTTPProxy;
|
||||
int HTTPProxyType;
|
||||
int HTTPProxyType = 0;
|
||||
std::string HTTPProxyAuth;
|
||||
std::ostream* LogFile;
|
||||
std::ostream* LogFile = nullptr;
|
||||
bool SubmitPart[cmCTest::PartCount];
|
||||
bool HasWarnings;
|
||||
bool HasErrors;
|
||||
bool HasWarnings = false;
|
||||
bool HasErrors = false;
|
||||
std::set<std::string> Files;
|
||||
std::vector<std::string> CommandLineHttpHeaders;
|
||||
std::vector<std::string> HttpHeaders;
|
||||
|
||||
bool CDashUpload = false;
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
#include <cstdlib>
|
||||
#include <ratio>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestTestHandler.h"
|
||||
#include "cmDuration.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -41,7 +43,7 @@ void cmCTestTestCommand::BindArguments()
|
||||
this->Bind("OUTPUT_JUNIT"_s, this->OutputJUnit);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler()
|
||||
{
|
||||
cmValue ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
|
||||
|
||||
@@ -63,59 +65,58 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
|
||||
this->ResourceSpecFile = *resourceSpecFile;
|
||||
}
|
||||
|
||||
cmCTestTestHandler* handler = this->InitializeActualHandler();
|
||||
auto handler = this->InitializeActualHandler();
|
||||
if (!this->Start.empty() || !this->End.empty() || !this->Stride.empty()) {
|
||||
handler->SetOption(
|
||||
"TestsToRunInformation",
|
||||
cmStrCat(this->Start, ',', this->End, ',', this->Stride));
|
||||
handler->TestOptions.TestsToRunInformation =
|
||||
cmStrCat(this->Start, ',', this->End, ',', this->Stride);
|
||||
}
|
||||
if (!this->Exclude.empty()) {
|
||||
handler->SetOption("ExcludeRegularExpression", this->Exclude);
|
||||
handler->TestOptions.ExcludeRegularExpression = this->Exclude;
|
||||
}
|
||||
if (!this->Include.empty()) {
|
||||
handler->SetOption("IncludeRegularExpression", this->Include);
|
||||
handler->TestOptions.IncludeRegularExpression = this->Include;
|
||||
}
|
||||
if (!this->ExcludeLabel.empty()) {
|
||||
handler->AddMultiOption("ExcludeLabelRegularExpression",
|
||||
this->ExcludeLabel);
|
||||
handler->TestOptions.ExcludeLabelRegularExpression.push_back(
|
||||
this->ExcludeLabel);
|
||||
}
|
||||
if (!this->IncludeLabel.empty()) {
|
||||
handler->AddMultiOption("LabelRegularExpression", this->IncludeLabel);
|
||||
handler->TestOptions.LabelRegularExpression.push_back(this->IncludeLabel);
|
||||
}
|
||||
|
||||
if (!this->ExcludeTestsFromFile.empty()) {
|
||||
handler->SetOption("ExcludeTestListFile", this->ExcludeTestsFromFile);
|
||||
handler->TestOptions.ExcludeTestListFile = this->ExcludeTestsFromFile;
|
||||
}
|
||||
if (!this->IncludeTestsFromFile.empty()) {
|
||||
handler->SetOption("TestListFile", this->IncludeTestsFromFile);
|
||||
handler->TestOptions.TestListFile = this->IncludeTestsFromFile;
|
||||
}
|
||||
|
||||
if (!this->ExcludeFixture.empty()) {
|
||||
handler->SetOption("ExcludeFixtureRegularExpression",
|
||||
this->ExcludeFixture);
|
||||
handler->TestOptions.ExcludeFixtureRegularExpression =
|
||||
this->ExcludeFixture;
|
||||
}
|
||||
if (!this->ExcludeFixtureSetup.empty()) {
|
||||
handler->SetOption("ExcludeFixtureSetupRegularExpression",
|
||||
this->ExcludeFixtureSetup);
|
||||
handler->TestOptions.ExcludeFixtureSetupRegularExpression =
|
||||
this->ExcludeFixtureSetup;
|
||||
}
|
||||
if (!this->ExcludeFixtureCleanup.empty()) {
|
||||
handler->SetOption("ExcludeFixtureCleanupRegularExpression",
|
||||
this->ExcludeFixtureCleanup);
|
||||
handler->TestOptions.ExcludeFixtureCleanupRegularExpression =
|
||||
this->ExcludeFixtureCleanup;
|
||||
}
|
||||
if (this->StopOnFailure) {
|
||||
handler->SetOption("StopOnFailure", "ON");
|
||||
handler->TestOptions.StopOnFailure = true;
|
||||
}
|
||||
if (this->ParallelLevel) {
|
||||
handler->SetOption("ParallelLevel", *this->ParallelLevel);
|
||||
handler->ParallelLevel = *this->ParallelLevel;
|
||||
}
|
||||
if (!this->Repeat.empty()) {
|
||||
handler->SetOption("Repeat", this->Repeat);
|
||||
handler->Repeat = this->Repeat;
|
||||
}
|
||||
if (!this->ScheduleRandom.empty()) {
|
||||
handler->SetOption("ScheduleRandom", this->ScheduleRandom);
|
||||
handler->TestOptions.ScheduleRandom = cmValue(this->ScheduleRandom).IsOn();
|
||||
}
|
||||
if (!this->ResourceSpecFile.empty()) {
|
||||
handler->SetOption("ResourceSpecFile", this->ResourceSpecFile);
|
||||
handler->TestOptions.ResourceSpecFile = this->ResourceSpecFile;
|
||||
}
|
||||
if (!this->StopTime.empty()) {
|
||||
this->CTest->SetStopTime(this->StopTime);
|
||||
@@ -156,12 +157,11 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
|
||||
}
|
||||
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
cmCTestTestHandler* cmCTestTestCommand::InitializeActualHandler()
|
||||
std::unique_ptr<cmCTestTestHandler>
|
||||
cmCTestTestCommand::InitializeActualHandler()
|
||||
{
|
||||
cmCTestTestHandler* handler = this->CTest->GetTestHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
return handler;
|
||||
return cm::make_unique<cmCTestTestHandler>(this->CTest);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
virtual cmCTestTestHandler* InitializeActualHandler();
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
virtual std::unique_ptr<cmCTestTestHandler> InitializeActualHandler();
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
std::string Start;
|
||||
std::string End;
|
||||
|
||||
@@ -274,25 +274,10 @@ inline int GetNextRealNumber(std::string const& in, double& val,
|
||||
|
||||
} // namespace
|
||||
|
||||
cmCTestTestHandler::cmCTestTestHandler()
|
||||
cmCTestTestHandler::cmCTestTestHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
, TestOptions(ctest->GetTestOptions())
|
||||
{
|
||||
this->UseUnion = false;
|
||||
|
||||
this->UseIncludeRegExpFlag = false;
|
||||
this->UseExcludeRegExpFlag = false;
|
||||
this->UseExcludeRegExpFirst = false;
|
||||
|
||||
this->CustomMaximumPassedTestOutputSize = 1 * 1024;
|
||||
this->CustomMaximumFailedTestOutputSize = 300 * 1024;
|
||||
this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
|
||||
|
||||
this->MemCheck = false;
|
||||
|
||||
this->LogFile = nullptr;
|
||||
|
||||
// Support for JUnit XML output.
|
||||
this->JUnitXMLFileName = "";
|
||||
|
||||
// Regular expressions to scan test output for custom measurements.
|
||||
|
||||
// Capture the whole section of test output from the first opening
|
||||
@@ -313,46 +298,6 @@ cmCTestTestHandler::cmCTestTestHandler()
|
||||
this->CustomLabelRegex.compile("<CTestLabel>(.*)</CTestLabel>");
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::Initialize(cmCTest* ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
|
||||
this->ElapsedTestingTime = cmDuration();
|
||||
|
||||
this->TestResults.clear();
|
||||
|
||||
this->CustomTestsIgnore.clear();
|
||||
this->StartTest.clear();
|
||||
this->EndTest.clear();
|
||||
|
||||
this->CustomPreTest.clear();
|
||||
this->CustomPostTest.clear();
|
||||
this->CustomMaximumPassedTestOutputSize = 1 * 1024;
|
||||
this->CustomMaximumFailedTestOutputSize = 300 * 1024;
|
||||
this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
|
||||
|
||||
this->TestsToRun.clear();
|
||||
|
||||
this->UseIncludeRegExpFlag = false;
|
||||
this->UseExcludeRegExpFlag = false;
|
||||
this->UseExcludeRegExpFirst = false;
|
||||
this->IncludeLabelRegularExpressions.clear();
|
||||
this->ExcludeLabelRegularExpressions.clear();
|
||||
this->IncludeRegExp.clear();
|
||||
this->ExcludeRegExp.clear();
|
||||
this->ExcludeFixtureRegExp.clear();
|
||||
this->ExcludeFixtureSetupRegExp.clear();
|
||||
this->ExcludeFixtureCleanupRegExp.clear();
|
||||
this->TestListFile.clear();
|
||||
this->ExcludeTestListFile.clear();
|
||||
this->TestsToRunByName.reset();
|
||||
this->TestsToExcludeByName.reset();
|
||||
|
||||
this->TestsToRunString.clear();
|
||||
this->UseUnion = false;
|
||||
this->TestList.clear();
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
{
|
||||
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST",
|
||||
@@ -363,14 +308,14 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
this->CustomTestsIgnore);
|
||||
this->CTest->PopulateCustomInteger(
|
||||
mf, "CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE",
|
||||
this->CustomMaximumPassedTestOutputSize);
|
||||
this->TestOptions.OutputSizePassed);
|
||||
this->CTest->PopulateCustomInteger(
|
||||
mf, "CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE",
|
||||
this->CustomMaximumFailedTestOutputSize);
|
||||
this->TestOptions.OutputSizeFailed);
|
||||
|
||||
cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION");
|
||||
if (dval) {
|
||||
if (!this->SetTestOutputTruncation(*dval)) {
|
||||
if (!SetTruncationMode(this->TestOptions.OutputTruncation, *dval)) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: "
|
||||
<< *dval << std::endl);
|
||||
@@ -378,33 +323,6 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::SetCMakeVariables(cmMakefile& mf)
|
||||
{
|
||||
mf.AddDefinition("CTEST_CUSTOM_PRE_TEST",
|
||||
cmList(this->CustomPreTest).to_string());
|
||||
mf.AddDefinition("CTEST_CUSTOM_POST_TEST",
|
||||
cmList(this->CustomPostTest).to_string());
|
||||
mf.AddDefinition("CTEST_CUSTOM_TESTS_IGNORE",
|
||||
cmList(this->CustomTestsIgnore).to_string());
|
||||
mf.AddDefinition("CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE",
|
||||
std::to_string(this->CustomMaximumPassedTestOutputSize));
|
||||
mf.AddDefinition("CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE",
|
||||
std::to_string(this->CustomMaximumFailedTestOutputSize));
|
||||
mf.AddDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION",
|
||||
[this]() -> cm::string_view {
|
||||
switch (this->TestOutputTruncation) {
|
||||
case cmCTestTypes::TruncationMode::Tail:
|
||||
return "tail"_s;
|
||||
case cmCTestTypes::TruncationMode::Middle:
|
||||
return "middle"_s;
|
||||
case cmCTestTypes::TruncationMode::Head:
|
||||
return "head"_s;
|
||||
default:
|
||||
return ""_s;
|
||||
}
|
||||
}());
|
||||
}
|
||||
|
||||
int cmCTestTestHandler::PreProcessHandler()
|
||||
{
|
||||
if (!this->ExecuteCommands(this->CustomPreTest)) {
|
||||
@@ -546,12 +464,11 @@ static bool BuildLabelRE(const std::vector<std::string>& parts,
|
||||
bool cmCTestTestHandler::ProcessOptions()
|
||||
{
|
||||
// Update internal data structure from generic one
|
||||
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
|
||||
this->SetUseUnion(this->GetOption("UseUnion").IsOn());
|
||||
if (this->GetOption("ScheduleRandom").IsOn()) {
|
||||
this->SetTestsToRunInformation(this->TestOptions.TestsToRunInformation);
|
||||
if (this->TestOptions.ScheduleRandom) {
|
||||
this->CTest->SetScheduleType("Random");
|
||||
}
|
||||
if (cmValue repeat = this->GetOption("Repeat")) {
|
||||
if (auto repeat = this->Repeat) {
|
||||
cmsys::RegularExpression repeatRegex(
|
||||
"^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$");
|
||||
if (repeatRegex.find(*repeat)) {
|
||||
@@ -575,8 +492,8 @@ bool cmCTestTestHandler::ProcessOptions()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (cmValue parallelLevel = this->GetOption("ParallelLevel")) {
|
||||
if (parallelLevel.IsEmpty()) {
|
||||
if (auto parallelLevel = this->ParallelLevel) {
|
||||
if (parallelLevel->empty()) {
|
||||
// An empty value tells ctest to choose a default.
|
||||
this->CTest->SetParallelLevel(cm::nullopt);
|
||||
} else {
|
||||
@@ -592,50 +509,20 @@ bool cmCTestTestHandler::ProcessOptions()
|
||||
}
|
||||
}
|
||||
|
||||
if (this->GetOption("StopOnFailure")) {
|
||||
if (this->TestOptions.StopOnFailure) {
|
||||
this->CTest->SetStopOnFailure(true);
|
||||
}
|
||||
|
||||
BuildLabelRE(this->GetMultiOption("LabelRegularExpression"),
|
||||
BuildLabelRE(this->TestOptions.LabelRegularExpression,
|
||||
this->IncludeLabelRegularExpressions);
|
||||
BuildLabelRE(this->GetMultiOption("ExcludeLabelRegularExpression"),
|
||||
BuildLabelRE(this->TestOptions.ExcludeLabelRegularExpression,
|
||||
this->ExcludeLabelRegularExpressions);
|
||||
cmValue val = this->GetOption("IncludeRegularExpression");
|
||||
if (val) {
|
||||
if (!this->TestOptions.IncludeRegularExpression.empty()) {
|
||||
this->UseIncludeRegExp();
|
||||
this->SetIncludeRegExp(*val);
|
||||
}
|
||||
val = this->GetOption("ExcludeRegularExpression");
|
||||
if (val) {
|
||||
if (!this->TestOptions.ExcludeRegularExpression.empty()) {
|
||||
this->UseExcludeRegExp();
|
||||
this->SetExcludeRegExp(*val);
|
||||
}
|
||||
val = this->GetOption("ExcludeFixtureRegularExpression");
|
||||
if (val) {
|
||||
this->ExcludeFixtureRegExp = *val;
|
||||
}
|
||||
val = this->GetOption("ExcludeFixtureSetupRegularExpression");
|
||||
if (val) {
|
||||
this->ExcludeFixtureSetupRegExp = *val;
|
||||
}
|
||||
val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
|
||||
if (val) {
|
||||
this->ExcludeFixtureCleanupRegExp = *val;
|
||||
}
|
||||
val = this->GetOption("ResourceSpecFile");
|
||||
if (val) {
|
||||
this->ResourceSpecFile = *val;
|
||||
}
|
||||
val = this->GetOption("TestListFile");
|
||||
if (val) {
|
||||
this->TestListFile = val;
|
||||
}
|
||||
val = this->GetOption("ExcludeTestListFile");
|
||||
if (val) {
|
||||
this->ExcludeTestListFile = val;
|
||||
}
|
||||
this->SetRerunFailed(this->GetOption("RerunFailed").IsOn());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -947,7 +834,7 @@ bool cmCTestTestHandler::ComputeTestList()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->RerunFailed) {
|
||||
if (this->TestOptions.RerunFailed) {
|
||||
return this->ComputeTestListForRerunFailed();
|
||||
}
|
||||
|
||||
@@ -961,7 +848,7 @@ bool cmCTestTestHandler::ComputeTestList()
|
||||
}
|
||||
}
|
||||
// expand the test list based on the union flag
|
||||
if (this->UseUnion) {
|
||||
if (this->TestOptions.UseUnion) {
|
||||
this->ExpandTestsToRunInformation(static_cast<int>(tmsize));
|
||||
} else {
|
||||
this->ExpandTestsToRunInformation(inREcnt);
|
||||
@@ -976,7 +863,7 @@ bool cmCTestTestHandler::ComputeTestList()
|
||||
inREcnt++;
|
||||
}
|
||||
|
||||
if (this->UseUnion) {
|
||||
if (this->TestOptions.UseUnion) {
|
||||
// if it is not in the list and not in the regexp then skip
|
||||
if ((!this->TestsToRun.empty() &&
|
||||
!cm::contains(this->TestsToRun, cnt)) &&
|
||||
@@ -1059,22 +946,24 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
||||
this->Quiet);
|
||||
|
||||
// Prepare regular expression evaluators
|
||||
std::string setupRegExp(this->ExcludeFixtureRegExp);
|
||||
std::string cleanupRegExp(this->ExcludeFixtureRegExp);
|
||||
if (!this->ExcludeFixtureSetupRegExp.empty()) {
|
||||
std::string setupRegExp(this->TestOptions.ExcludeFixtureRegularExpression);
|
||||
std::string cleanupRegExp(this->TestOptions.ExcludeFixtureRegularExpression);
|
||||
if (!this->TestOptions.ExcludeFixtureSetupRegularExpression.empty()) {
|
||||
if (setupRegExp.empty()) {
|
||||
setupRegExp = this->ExcludeFixtureSetupRegExp;
|
||||
setupRegExp = this->TestOptions.ExcludeFixtureSetupRegularExpression;
|
||||
} else {
|
||||
setupRegExp.append("(" + setupRegExp + ")|(" +
|
||||
this->ExcludeFixtureSetupRegExp + ")");
|
||||
setupRegExp.append(
|
||||
"(" + setupRegExp + ")|(" +
|
||||
this->TestOptions.ExcludeFixtureSetupRegularExpression + ")");
|
||||
}
|
||||
}
|
||||
if (!this->ExcludeFixtureCleanupRegExp.empty()) {
|
||||
if (!this->TestOptions.ExcludeFixtureCleanupRegularExpression.empty()) {
|
||||
if (cleanupRegExp.empty()) {
|
||||
cleanupRegExp = this->ExcludeFixtureCleanupRegExp;
|
||||
cleanupRegExp = this->TestOptions.ExcludeFixtureCleanupRegularExpression;
|
||||
} else {
|
||||
cleanupRegExp.append("(" + cleanupRegExp + ")|(" +
|
||||
this->ExcludeFixtureCleanupRegExp + ")");
|
||||
cleanupRegExp.append(
|
||||
"(" + cleanupRegExp + ")|(" +
|
||||
this->TestOptions.ExcludeFixtureCleanupRegularExpression + ")");
|
||||
}
|
||||
}
|
||||
cmsys::RegularExpression excludeSetupRegex(setupRegExp);
|
||||
@@ -1456,7 +1345,7 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
||||
tests[p.Index].Depends = depends;
|
||||
properties[p.Index] = &p;
|
||||
}
|
||||
parallel->SetResourceSpecFile(this->ResourceSpecFile);
|
||||
parallel->SetResourceSpecFile(this->TestOptions.ResourceSpecFile);
|
||||
if (!parallel->SetTests(std::move(tests), std::move(properties))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1492,7 +1381,7 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
|
||||
return;
|
||||
}
|
||||
|
||||
this->CTest->StartXML(xml, this->AppendXML);
|
||||
this->CTest->StartXML(xml, this->CMake, this->AppendXML);
|
||||
this->CTest->GenerateSubprojectsOutput(xml);
|
||||
xml.StartElement("Testing");
|
||||
xml.Element("StartDateTime", this->StartTest);
|
||||
@@ -1835,11 +1724,13 @@ bool cmCTestTestHandler::ParseResourceGroupsProperty(
|
||||
|
||||
bool cmCTestTestHandler::GetListOfTests()
|
||||
{
|
||||
if (!this->IncludeRegExp.empty()) {
|
||||
this->IncludeTestsRegularExpression.compile(this->IncludeRegExp);
|
||||
if (!this->TestOptions.IncludeRegularExpression.empty()) {
|
||||
this->IncludeTestsRegularExpression.compile(
|
||||
this->TestOptions.IncludeRegularExpression);
|
||||
}
|
||||
if (!this->ExcludeRegExp.empty()) {
|
||||
this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp);
|
||||
if (!this->TestOptions.ExcludeRegularExpression.empty()) {
|
||||
this->ExcludeTestsRegularExpression.compile(
|
||||
this->TestOptions.ExcludeRegularExpression);
|
||||
}
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
"Constructing a list of tests" << std::endl, this->Quiet);
|
||||
@@ -1889,19 +1780,20 @@ bool cmCTestTestHandler::GetListOfTests()
|
||||
return false;
|
||||
}
|
||||
cmValue specFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
|
||||
if (this->ResourceSpecFile.empty() && specFile) {
|
||||
this->ResourceSpecFile = *specFile;
|
||||
if (this->TestOptions.ResourceSpecFile.empty() && specFile) {
|
||||
this->TestOptions.ResourceSpecFile = *specFile;
|
||||
}
|
||||
|
||||
if (!this->TestListFile.empty()) {
|
||||
this->TestsToRunByName = this->ReadTestListFile(this->TestListFile);
|
||||
if (!this->TestOptions.TestListFile.empty()) {
|
||||
this->TestsToRunByName =
|
||||
this->ReadTestListFile(this->TestOptions.TestListFile);
|
||||
if (!this->TestsToRunByName) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!this->ExcludeTestListFile.empty()) {
|
||||
if (!this->TestOptions.ExcludeTestListFile.empty()) {
|
||||
this->TestsToExcludeByName =
|
||||
this->ReadTestListFile(this->ExcludeTestListFile);
|
||||
this->ReadTestListFile(this->TestOptions.ExcludeTestListFile);
|
||||
if (!this->TestsToExcludeByName) {
|
||||
return false;
|
||||
}
|
||||
@@ -2178,41 +2070,14 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::SetIncludeRegExp(const std::string& arg)
|
||||
void cmCTestTestHandler::SetTestsToRunInformation(std::string const& in)
|
||||
{
|
||||
this->IncludeRegExp = arg;
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::SetExcludeRegExp(const std::string& arg)
|
||||
{
|
||||
this->ExcludeRegExp = arg;
|
||||
}
|
||||
|
||||
bool cmCTestTestHandler::SetTestOutputTruncation(const std::string& mode)
|
||||
{
|
||||
if (mode == "tail") {
|
||||
this->TestOutputTruncation = cmCTestTypes::TruncationMode::Tail;
|
||||
} else if (mode == "middle") {
|
||||
this->TestOutputTruncation = cmCTestTypes::TruncationMode::Middle;
|
||||
} else if (mode == "head") {
|
||||
this->TestOutputTruncation = cmCTestTypes::TruncationMode::Head;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmCTestTestHandler::SetTestsToRunInformation(cmValue in)
|
||||
{
|
||||
if (!in) {
|
||||
return;
|
||||
}
|
||||
this->TestsToRunString = *in;
|
||||
this->TestsToRunString = in;
|
||||
// if the argument is a file, then read it and use the contents as the
|
||||
// string
|
||||
if (cmSystemTools::FileExists(*in)) {
|
||||
cmsys::ifstream fin(in->c_str());
|
||||
unsigned long filelen = cmSystemTools::FileLength(*in);
|
||||
if (cmSystemTools::FileExists(in)) {
|
||||
cmsys::ifstream fin(in.c_str());
|
||||
unsigned long filelen = cmSystemTools::FileLength(in);
|
||||
auto buff = cm::make_unique<char[]>(filelen + 1);
|
||||
fin.getline(buff.get(), filelen);
|
||||
buff[fin.gcount()] = 0;
|
||||
@@ -2615,22 +2480,22 @@ bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator!=(
|
||||
|
||||
void cmCTestTestHandler::SetJUnitXMLFileName(const std::string& filename)
|
||||
{
|
||||
this->JUnitXMLFileName = filename;
|
||||
this->TestOptions.JUnitXMLFileName = filename;
|
||||
}
|
||||
|
||||
bool cmCTestTestHandler::WriteJUnitXML()
|
||||
{
|
||||
if (this->JUnitXMLFileName.empty()) {
|
||||
if (this->TestOptions.JUnitXMLFileName.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Open new XML file for writing.
|
||||
cmGeneratedFileStream xmlfile;
|
||||
xmlfile.SetTempExt("tmp");
|
||||
xmlfile.Open(this->JUnitXMLFileName);
|
||||
xmlfile.Open(this->TestOptions.JUnitXMLFileName);
|
||||
if (!xmlfile) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Problem opening file: " << this->JUnitXMLFileName
|
||||
"Problem opening file: " << this->TestOptions.JUnitXMLFileName
|
||||
<< std::endl);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,11 +24,39 @@
|
||||
#include "cmCTestTypes.h" // IWYU pragma: keep
|
||||
#include "cmDuration.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
class cmMakefile;
|
||||
class cmXMLWriter;
|
||||
|
||||
struct cmCTestTestOptions
|
||||
{
|
||||
bool RerunFailed = false;
|
||||
bool ScheduleRandom = false;
|
||||
bool StopOnFailure = false;
|
||||
bool UseUnion = false;
|
||||
|
||||
int OutputSizePassed = 1 * 1024;
|
||||
int OutputSizeFailed = 300 * 1024;
|
||||
cmCTestTypes::TruncationMode OutputTruncation =
|
||||
cmCTestTypes::TruncationMode::Tail;
|
||||
|
||||
std::string TestsToRunInformation;
|
||||
std::string IncludeRegularExpression;
|
||||
std::string ExcludeRegularExpression;
|
||||
|
||||
std::vector<std::string> LabelRegularExpression;
|
||||
std::vector<std::string> ExcludeLabelRegularExpression;
|
||||
|
||||
std::string ExcludeFixtureRegularExpression;
|
||||
std::string ExcludeFixtureSetupRegularExpression;
|
||||
std::string ExcludeFixtureCleanupRegularExpression;
|
||||
|
||||
std::string TestListFile;
|
||||
std::string ExcludeTestListFile;
|
||||
std::string ResourceSpecFile;
|
||||
std::string JUnitXMLFileName;
|
||||
};
|
||||
|
||||
/** \class cmCTestTestHandler
|
||||
* \brief A class that handles ctest -S invocations
|
||||
*
|
||||
@@ -47,19 +75,6 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
/**
|
||||
* When both -R and -I are used should the resulting test list be the
|
||||
* intersection or the union of the lists. By default it is the
|
||||
* intersection.
|
||||
*/
|
||||
void SetUseUnion(bool val) { this->UseUnion = val; }
|
||||
|
||||
/**
|
||||
* Set whether or not CTest should only execute the tests that failed
|
||||
* on the previous run. By default this is false.
|
||||
*/
|
||||
void SetRerunFailed(bool val) { this->RerunFailed = val; }
|
||||
|
||||
/**
|
||||
* This method is called when reading CTest custom file
|
||||
*/
|
||||
@@ -69,28 +84,14 @@ public:
|
||||
/// them on
|
||||
void UseIncludeRegExp();
|
||||
void UseExcludeRegExp();
|
||||
void SetIncludeRegExp(const std::string&);
|
||||
void SetExcludeRegExp(const std::string&);
|
||||
|
||||
void SetMaxIndex(int n) { this->MaxIndex = n; }
|
||||
int GetMaxIndex() { return this->MaxIndex; }
|
||||
|
||||
void SetTestOutputSizePassed(int n)
|
||||
{
|
||||
this->CustomMaximumPassedTestOutputSize = n;
|
||||
}
|
||||
void SetTestOutputSizeFailed(int n)
|
||||
{
|
||||
this->CustomMaximumFailedTestOutputSize = n;
|
||||
}
|
||||
|
||||
//! Set test output truncation mode. Return false if unknown mode.
|
||||
bool SetTestOutputTruncation(const std::string& mode);
|
||||
|
||||
//! pass the -I argument down
|
||||
void SetTestsToRunInformation(cmValue);
|
||||
void SetTestsToRunInformation(std::string const& in);
|
||||
|
||||
cmCTestTestHandler();
|
||||
cmCTestTestHandler(cmCTest* ctest);
|
||||
|
||||
/*
|
||||
* Add the test to the list of tests to be executed
|
||||
@@ -107,8 +108,6 @@ public:
|
||||
*/
|
||||
bool SetDirectoryProperties(const std::vector<std::string>& args);
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
|
||||
struct cmCTestTestResourceRequirement
|
||||
{
|
||||
std::string ResourceType;
|
||||
@@ -228,11 +227,6 @@ public:
|
||||
// Support for writing test results in JUnit XML format.
|
||||
void SetJUnitXMLFileName(const std::string& id);
|
||||
|
||||
/**
|
||||
* Set CMake variables from CTest Options
|
||||
*/
|
||||
void SetCMakeVariables(cmMakefile& mf);
|
||||
|
||||
protected:
|
||||
using SetOfTests =
|
||||
std::set<cmCTestTestHandler::cmCTestTestResult, cmCTestTestResultLess>;
|
||||
@@ -265,6 +259,8 @@ protected:
|
||||
void CleanTestOutput(std::string& output, size_t length,
|
||||
cmCTestTypes::TruncationMode truncate);
|
||||
|
||||
cmCTestTestOptions TestOptions;
|
||||
|
||||
cmDuration ElapsedTestingTime;
|
||||
|
||||
using TestResultsVector = std::vector<cmCTestTestResult>;
|
||||
@@ -275,10 +271,7 @@ protected:
|
||||
std::string EndTest;
|
||||
std::chrono::system_clock::time_point StartTestTime;
|
||||
std::chrono::system_clock::time_point EndTestTime;
|
||||
bool MemCheck;
|
||||
int CustomMaximumPassedTestOutputSize;
|
||||
int CustomMaximumFailedTestOutputSize;
|
||||
cmCTestTypes::TruncationMode TestOutputTruncation;
|
||||
bool MemCheck = false;
|
||||
int MaxIndex;
|
||||
|
||||
public:
|
||||
@@ -355,24 +348,17 @@ private:
|
||||
|
||||
std::vector<int> TestsToRun;
|
||||
|
||||
bool UseIncludeRegExpFlag;
|
||||
bool UseExcludeRegExpFlag;
|
||||
bool UseExcludeRegExpFirst;
|
||||
std::string IncludeRegExp;
|
||||
std::string ExcludeRegExp;
|
||||
std::string ExcludeFixtureRegExp;
|
||||
std::string ExcludeFixtureSetupRegExp;
|
||||
std::string ExcludeFixtureCleanupRegExp;
|
||||
bool UseIncludeRegExpFlag = false;
|
||||
bool UseExcludeRegExpFlag = false;
|
||||
bool UseExcludeRegExpFirst = false;
|
||||
std::vector<cmsys::RegularExpression> IncludeLabelRegularExpressions;
|
||||
std::vector<cmsys::RegularExpression> ExcludeLabelRegularExpressions;
|
||||
cmsys::RegularExpression IncludeTestsRegularExpression;
|
||||
cmsys::RegularExpression ExcludeTestsRegularExpression;
|
||||
std::string TestListFile;
|
||||
std::string ExcludeTestListFile;
|
||||
cm::optional<std::set<std::string>> TestsToRunByName;
|
||||
cm::optional<std::set<std::string>> TestsToExcludeByName;
|
||||
|
||||
std::string ResourceSpecFile;
|
||||
cm::optional<std::string> ParallelLevel;
|
||||
cm::optional<std::string> Repeat;
|
||||
|
||||
void RecordCustomTestMeasurements(cmXMLWriter& xml, std::string content);
|
||||
void CheckLabelFilter(cmCTestTestProperties& it);
|
||||
@@ -380,7 +366,6 @@ private:
|
||||
void CheckLabelFilterInclude(cmCTestTestProperties& it);
|
||||
|
||||
std::string TestsToRunString;
|
||||
bool UseUnion;
|
||||
ListOfTests TestList;
|
||||
size_t TotalNumberOfTests;
|
||||
cmsys::RegularExpression AllTestMeasurementsRegex;
|
||||
@@ -388,11 +373,10 @@ private:
|
||||
cmsys::RegularExpression CustomCompletionStatusRegex;
|
||||
cmsys::RegularExpression CustomLabelRegex;
|
||||
|
||||
std::ostream* LogFile;
|
||||
std::ostream* LogFile = nullptr;
|
||||
|
||||
cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never;
|
||||
int RepeatCount = 1;
|
||||
bool RerunFailed;
|
||||
|
||||
std::string JUnitXMLFileName;
|
||||
friend class cmCTestTestCommand;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
#include "cmCTestTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace cmCTestTypes {
|
||||
|
||||
bool SetTruncationMode(TruncationMode& mode, cm::string_view str)
|
||||
{
|
||||
if (str == "tail") {
|
||||
mode = cmCTestTypes::TruncationMode::Tail;
|
||||
} else if (str == "middle") {
|
||||
mode = cmCTestTypes::TruncationMode::Middle;
|
||||
} else if (str == "head") {
|
||||
mode = cmCTestTypes::TruncationMode::Head;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace cmCTestTypes
|
||||
@@ -5,12 +5,18 @@
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <cm/string_view>
|
||||
|
||||
namespace cmCTestTypes {
|
||||
|
||||
// Test output truncation mode
|
||||
enum class TruncationMode
|
||||
{ // Test output truncation mode
|
||||
{
|
||||
Tail,
|
||||
Middle,
|
||||
Head
|
||||
};
|
||||
}
|
||||
|
||||
bool SetTruncationMode(TruncationMode& mode, cm::string_view str);
|
||||
|
||||
} // namespace cmCTestTypes
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
#include "cmCTestUpdateCommand.h"
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestUpdateHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler>
|
||||
cmCTestUpdateCommand::InitializeHandler()
|
||||
{
|
||||
if (!this->Source.empty()) {
|
||||
this->CTest->SetCTestConfiguration(
|
||||
@@ -73,13 +75,12 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
|
||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||
this->Makefile, "P4Options", "CTEST_P4_OPTIONS", this->Quiet);
|
||||
|
||||
cmCTestUpdateHandler* handler = this->CTest->GetUpdateHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestUpdateHandler>(this->CTest);
|
||||
if (source_dir.empty()) {
|
||||
this->SetError("source directory not specified. Please use SOURCE tag");
|
||||
return nullptr;
|
||||
}
|
||||
handler->SourceDirectory = source_dir;
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
@@ -38,5 +38,5 @@ public:
|
||||
std::string GetName() const override { return "ctest_update"; }
|
||||
|
||||
protected:
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
};
|
||||
|
||||
@@ -35,13 +35,9 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type)
|
||||
return cmCTestUpdateHandlerUpdateStrings[type];
|
||||
}
|
||||
|
||||
cmCTestUpdateHandler::cmCTestUpdateHandler() = default;
|
||||
|
||||
void cmCTestUpdateHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestUpdateHandler::cmCTestUpdateHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
this->UpdateCommand.clear();
|
||||
this->UpdateType = e_CVS;
|
||||
}
|
||||
|
||||
int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
cmCTestUpdateHandler();
|
||||
cmCTestUpdateHandler(cmCTest* ctest);
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -40,11 +40,6 @@ public:
|
||||
e_LAST
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize handler
|
||||
*/
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
|
||||
private:
|
||||
// Some structures needed for update
|
||||
struct StringPair : public std::pair<std::string, std::string>
|
||||
@@ -60,7 +55,7 @@ private:
|
||||
// The VCS command to update the working tree.
|
||||
std::string UpdateCommand;
|
||||
std::string SourceDirectory;
|
||||
int UpdateType;
|
||||
int UpdateType = e_CVS;
|
||||
|
||||
int DetectVCS(const std::string& dir);
|
||||
bool SelectVCS();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cm/vector>
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestUploadHandler.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
@@ -35,12 +35,12 @@ void cmCTestUploadCommand::CheckArguments()
|
||||
});
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
|
||||
std::unique_ptr<cmCTestGenericHandler>
|
||||
cmCTestUploadCommand::InitializeHandler()
|
||||
{
|
||||
cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
|
||||
handler->Initialize(this->CTest);
|
||||
auto handler = cm::make_unique<cmCTestUploadHandler>(this->CTest);
|
||||
handler->SetFiles(
|
||||
std::set<std::string>(this->Files.begin(), this->Files.end()));
|
||||
handler->SetQuiet(this->Quiet);
|
||||
return handler;
|
||||
return std::unique_ptr<cmCTestGenericHandler>(std::move(handler));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
protected:
|
||||
void BindArguments() override;
|
||||
void CheckArguments() override;
|
||||
cmCTestGenericHandler* InitializeHandler() override;
|
||||
std::unique_ptr<cmCTestGenericHandler> InitializeHandler() override;
|
||||
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::string>> Files;
|
||||
};
|
||||
|
||||
@@ -11,12 +11,9 @@
|
||||
#include "cmVersion.h"
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
cmCTestUploadHandler::cmCTestUploadHandler() = default;
|
||||
|
||||
void cmCTestUploadHandler::Initialize(cmCTest* ctest)
|
||||
cmCTestUploadHandler::cmCTestUploadHandler(cmCTest* ctest)
|
||||
: Superclass(ctest)
|
||||
{
|
||||
this->Superclass::Initialize(ctest);
|
||||
this->Files.clear();
|
||||
}
|
||||
|
||||
void cmCTestUploadHandler::SetFiles(std::set<std::string> const& files)
|
||||
@@ -50,7 +47,7 @@ int cmCTestUploadHandler::ProcessHandler()
|
||||
xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site"));
|
||||
xml.Attribute("Generator",
|
||||
std::string("ctest-") + cmVersion::GetCMakeVersion());
|
||||
this->CTest->AddSiteProperties(xml);
|
||||
this->CTest->AddSiteProperties(xml, this->CMake);
|
||||
xml.StartElement("Upload");
|
||||
xml.Element("Time", std::chrono::system_clock::now());
|
||||
|
||||
|
||||
@@ -22,15 +22,13 @@ class cmCTestUploadHandler : public cmCTestGenericHandler
|
||||
public:
|
||||
using Superclass = cmCTestGenericHandler;
|
||||
|
||||
cmCTestUploadHandler();
|
||||
cmCTestUploadHandler(cmCTest* ctest);
|
||||
|
||||
/*
|
||||
* The main entry point for this class
|
||||
*/
|
||||
int ProcessHandler() override;
|
||||
|
||||
void Initialize(cmCTest* ctest) override;
|
||||
|
||||
/** Specify a set of files to submit. */
|
||||
void SetFiles(std::set<std::string> const& files);
|
||||
|
||||
|
||||
+97
-227
@@ -42,16 +42,9 @@
|
||||
|
||||
#include "cmCMakePresetsGraph.h"
|
||||
#include "cmCTestBuildAndTest.h"
|
||||
#include "cmCTestBuildHandler.h"
|
||||
#include "cmCTestConfigureHandler.h"
|
||||
#include "cmCTestCoverageHandler.h"
|
||||
#include "cmCTestGenericHandler.h"
|
||||
#include "cmCTestMemCheckHandler.h"
|
||||
#include "cmCTestScriptHandler.h"
|
||||
#include "cmCTestSubmitHandler.h"
|
||||
#include "cmCTestTestHandler.h"
|
||||
#include "cmCTestUpdateHandler.h"
|
||||
#include "cmCTestUploadHandler.h"
|
||||
#include "cmCTestTypes.h"
|
||||
#include "cmCommandLineArgument.h"
|
||||
#include "cmDynamicLoader.h"
|
||||
#include "cmExecutionStatus.h"
|
||||
@@ -123,25 +116,7 @@ struct cmCTest::Private
|
||||
bool FlushTestProgressLine = false;
|
||||
|
||||
// these are helper classes
|
||||
cmCTestBuildHandler BuildHandler;
|
||||
cmCTestBuildAndTest BuildAndTest;
|
||||
cmCTestCoverageHandler CoverageHandler;
|
||||
cmCTestScriptHandler ScriptHandler;
|
||||
cmCTestTestHandler TestHandler;
|
||||
cmCTestUpdateHandler UpdateHandler;
|
||||
cmCTestConfigureHandler ConfigureHandler;
|
||||
cmCTestMemCheckHandler MemCheckHandler;
|
||||
cmCTestSubmitHandler SubmitHandler;
|
||||
cmCTestUploadHandler UploadHandler;
|
||||
|
||||
std::vector<cmCTestGenericHandler*> GetTestingHandlers()
|
||||
{
|
||||
return { &this->BuildHandler, &this->CoverageHandler,
|
||||
&this->ScriptHandler, &this->TestHandler,
|
||||
&this->UpdateHandler, &this->ConfigureHandler,
|
||||
&this->MemCheckHandler, &this->SubmitHandler,
|
||||
&this->UploadHandler };
|
||||
}
|
||||
|
||||
bool ShowOnly = false;
|
||||
bool OutputAsJson = false;
|
||||
@@ -214,6 +189,9 @@ struct cmCTest::Private
|
||||
|
||||
cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy;
|
||||
bool NoTestsModeSetInCli = false;
|
||||
|
||||
cmCTestTestOptions TestOptions;
|
||||
std::vector<std::string> CommandLineHttpHeaders;
|
||||
};
|
||||
|
||||
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
|
||||
@@ -721,62 +699,12 @@ bool cmCTest::CTestFileExists(const std::string& filename)
|
||||
return cmSystemTools::FileExists(testingDir);
|
||||
}
|
||||
|
||||
cmCTestBuildHandler* cmCTest::GetBuildHandler()
|
||||
{
|
||||
return &this->Impl->BuildHandler;
|
||||
}
|
||||
|
||||
cmCTestCoverageHandler* cmCTest::GetCoverageHandler()
|
||||
{
|
||||
return &this->Impl->CoverageHandler;
|
||||
}
|
||||
|
||||
cmCTestScriptHandler* cmCTest::GetScriptHandler()
|
||||
{
|
||||
return &this->Impl->ScriptHandler;
|
||||
}
|
||||
|
||||
cmCTestTestHandler* cmCTest::GetTestHandler()
|
||||
{
|
||||
return &this->Impl->TestHandler;
|
||||
}
|
||||
|
||||
cmCTestUpdateHandler* cmCTest::GetUpdateHandler()
|
||||
{
|
||||
return &this->Impl->UpdateHandler;
|
||||
}
|
||||
|
||||
cmCTestConfigureHandler* cmCTest::GetConfigureHandler()
|
||||
{
|
||||
return &this->Impl->ConfigureHandler;
|
||||
}
|
||||
|
||||
cmCTestMemCheckHandler* cmCTest::GetMemCheckHandler()
|
||||
{
|
||||
return &this->Impl->MemCheckHandler;
|
||||
}
|
||||
|
||||
cmCTestSubmitHandler* cmCTest::GetSubmitHandler()
|
||||
{
|
||||
return &this->Impl->SubmitHandler;
|
||||
}
|
||||
|
||||
cmCTestUploadHandler* cmCTest::GetUploadHandler()
|
||||
{
|
||||
return &this->Impl->UploadHandler;
|
||||
}
|
||||
|
||||
int cmCTest::ProcessSteps()
|
||||
{
|
||||
this->Impl->ExtraVerbose = this->Impl->Verbose;
|
||||
this->Impl->Verbose = true;
|
||||
this->Impl->ProduceXML = true;
|
||||
|
||||
for (auto& handler : this->Impl->GetTestingHandlers()) {
|
||||
handler->SetVerbose(this->Impl->Verbose);
|
||||
handler->SetSubmitIndex(this->Impl->SubmitIndex);
|
||||
}
|
||||
|
||||
const std::string currDir = cmSystemTools::GetCurrentWorkingDirectory();
|
||||
std::string workDir = currDir;
|
||||
if (!this->Impl->TestDir.empty()) {
|
||||
@@ -795,8 +723,7 @@ int cmCTest::ProcessSteps()
|
||||
this->BlockTestErrorDiagnostics();
|
||||
|
||||
int res = 0;
|
||||
cmCTestScriptHandler script;
|
||||
script.Initialize(this);
|
||||
cmCTestScriptHandler script(this);
|
||||
script.CreateCMake();
|
||||
cmMakefile& mf = *script.GetMakefile();
|
||||
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
|
||||
@@ -910,7 +837,7 @@ int cmCTest::ProcessSteps()
|
||||
if (this->Impl->Parts[PartNotes]) {
|
||||
this->UpdateCTestConfiguration();
|
||||
if (!this->Impl->NotesFiles.empty()) {
|
||||
this->GenerateNotesFile(this->Impl->NotesFiles);
|
||||
this->GenerateNotesFile(script.GetCMake(), this->Impl->NotesFiles);
|
||||
}
|
||||
}
|
||||
if (this->Impl->Parts[PartSubmit]) {
|
||||
@@ -1114,7 +1041,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
|
||||
return safevalue;
|
||||
}
|
||||
|
||||
void cmCTest::StartXML(cmXMLWriter& xml, bool append)
|
||||
void cmCTest::StartXML(cmXMLWriter& xml, cmake* cm, bool append)
|
||||
{
|
||||
if (this->Impl->CurrentTag.empty()) {
|
||||
cmCTestLog(this, ERROR_MESSAGE,
|
||||
@@ -1176,25 +1103,17 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append)
|
||||
xml.Attribute("ChangeId", changeId);
|
||||
}
|
||||
|
||||
this->AddSiteProperties(xml);
|
||||
this->AddSiteProperties(xml, cm);
|
||||
}
|
||||
|
||||
void cmCTest::AddSiteProperties(cmXMLWriter& xml)
|
||||
void cmCTest::AddSiteProperties(cmXMLWriter& xml, cmake* cm)
|
||||
{
|
||||
cmCTestScriptHandler* ch = this->GetScriptHandler();
|
||||
cmake* cm = ch->GetCMake();
|
||||
// if no CMake then this is the old style script and props like
|
||||
// this will not work anyway.
|
||||
if (!cm) {
|
||||
return;
|
||||
}
|
||||
// This code should go when cdash is changed to use labels only
|
||||
cmValue subproject = cm->GetState()->GetGlobalProperty("SubProject");
|
||||
if (subproject) {
|
||||
xml.StartElement("Subproject");
|
||||
xml.Attribute("name", *subproject);
|
||||
cmValue labels =
|
||||
ch->GetCMake()->GetState()->GetGlobalProperty("SubProjectLabels");
|
||||
cmValue labels = cm->GetState()->GetGlobalProperty("SubProjectLabels");
|
||||
if (labels) {
|
||||
xml.StartElement("Labels");
|
||||
cmList args{ *labels };
|
||||
@@ -1246,7 +1165,7 @@ void cmCTest::EndXML(cmXMLWriter& xml)
|
||||
xml.EndDocument();
|
||||
}
|
||||
|
||||
int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, cmake* cm,
|
||||
std::vector<std::string> const& files)
|
||||
{
|
||||
std::string buildname =
|
||||
@@ -1263,7 +1182,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
xml.Attribute("Name", this->GetCTestConfiguration("Site"));
|
||||
xml.Attribute("Generator",
|
||||
std::string("ctest-") + cmVersion::GetCMakeVersion());
|
||||
this->AddSiteProperties(xml);
|
||||
this->AddSiteProperties(xml, cm);
|
||||
xml.StartElement("Notes");
|
||||
|
||||
for (std::string const& file : files) {
|
||||
@@ -1297,7 +1216,8 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cmCTest::GenerateNotesFile(std::vector<std::string> const& files)
|
||||
int cmCTest::GenerateNotesFile(cmake* cm,
|
||||
std::vector<std::string> const& files)
|
||||
{
|
||||
cmGeneratedFileStream ofs;
|
||||
if (!this->OpenOutputFile(this->Impl->CurrentTag, "Notes.xml", ofs)) {
|
||||
@@ -1305,11 +1225,11 @@ int cmCTest::GenerateNotesFile(std::vector<std::string> const& files)
|
||||
return 1;
|
||||
}
|
||||
cmXMLWriter xml(ofs);
|
||||
this->GenerateCTestNotesOutput(xml, files);
|
||||
this->GenerateCTestNotesOutput(xml, cm, files);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmCTest::GenerateNotesFile(const std::string& cfiles)
|
||||
int cmCTest::GenerateNotesFile(cmake* cm, const std::string& cfiles)
|
||||
{
|
||||
if (cfiles.empty()) {
|
||||
return 1;
|
||||
@@ -1323,7 +1243,7 @@ int cmCTest::GenerateNotesFile(const std::string& cfiles)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return this->GenerateNotesFile(files);
|
||||
return this->GenerateNotesFile(cm, files);
|
||||
}
|
||||
|
||||
int cmCTest::GenerateDoneFile()
|
||||
@@ -1632,24 +1552,6 @@ bool cmCTest::AddVariableDefinition(const std::string& arg)
|
||||
return false;
|
||||
}
|
||||
|
||||
void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->GetTestHandler()->SetPersistentOption(optionName, value);
|
||||
this->GetMemCheckHandler()->SetPersistentOption(optionName, value);
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTest::AddPersistentMultiOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName)
|
||||
{
|
||||
if (!value.empty()) {
|
||||
this->GetTestHandler()->AddPersistentMultiOption(optionName, value);
|
||||
this->GetMemCheckHandler()->AddPersistentMultiOption(optionName, value);
|
||||
}
|
||||
}
|
||||
|
||||
bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
bool listPresets)
|
||||
{
|
||||
@@ -1784,17 +1686,17 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
expandedPreset->Output->SubprojectSummary.value_or(true);
|
||||
|
||||
if (expandedPreset->Output->MaxPassedTestOutputSize) {
|
||||
this->Impl->TestHandler.SetTestOutputSizePassed(
|
||||
*expandedPreset->Output->MaxPassedTestOutputSize);
|
||||
this->Impl->TestOptions.OutputSizePassed =
|
||||
*expandedPreset->Output->MaxPassedTestOutputSize;
|
||||
}
|
||||
|
||||
if (expandedPreset->Output->MaxFailedTestOutputSize) {
|
||||
this->Impl->TestHandler.SetTestOutputSizeFailed(
|
||||
*expandedPreset->Output->MaxFailedTestOutputSize);
|
||||
this->Impl->TestOptions.OutputSizeFailed =
|
||||
*expandedPreset->Output->MaxFailedTestOutputSize;
|
||||
}
|
||||
|
||||
if (expandedPreset->Output->TestOutputTruncation) {
|
||||
this->Impl->TestHandler.TestOutputTruncation =
|
||||
this->Impl->TestOptions.OutputTruncation =
|
||||
*expandedPreset->Output->TestOutputTruncation;
|
||||
}
|
||||
|
||||
@@ -1805,10 +1707,12 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
|
||||
if (expandedPreset->Filter) {
|
||||
if (expandedPreset->Filter->Include) {
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Include->Name, "IncludeRegularExpression");
|
||||
this->AddPersistentMultiOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Include->Label, "LabelRegularExpression");
|
||||
this->Impl->TestOptions.IncludeRegularExpression =
|
||||
expandedPreset->Filter->Include->Name;
|
||||
if (!expandedPreset->Filter->Include->Label.empty()) {
|
||||
this->Impl->TestOptions.LabelRegularExpression.push_back(
|
||||
expandedPreset->Filter->Include->Label);
|
||||
}
|
||||
|
||||
if (expandedPreset->Filter->Include->Index) {
|
||||
if (expandedPreset->Filter->Include->Index->IndexFile.empty()) {
|
||||
@@ -1822,38 +1726,32 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
indexOptions +=
|
||||
cmJoin(expandedPreset->Filter->Include->Index->SpecificTests, ",");
|
||||
|
||||
this->SetPersistentOptionIfNotEmpty(indexOptions,
|
||||
"TestsToRunInformation");
|
||||
this->Impl->TestOptions.TestsToRunInformation = indexOptions;
|
||||
} else {
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Include->Index->IndexFile,
|
||||
"TestsToRunInformation");
|
||||
this->Impl->TestOptions.TestsToRunInformation =
|
||||
expandedPreset->Filter->Include->Index->IndexFile;
|
||||
}
|
||||
}
|
||||
|
||||
if (expandedPreset->Filter->Include->UseUnion.value_or(false)) {
|
||||
this->GetTestHandler()->SetPersistentOption("UseUnion", "true");
|
||||
this->GetMemCheckHandler()->SetPersistentOption("UseUnion", "true");
|
||||
}
|
||||
this->Impl->TestOptions.UseUnion =
|
||||
expandedPreset->Filter->Include->UseUnion.value_or(false);
|
||||
}
|
||||
|
||||
if (expandedPreset->Filter->Exclude) {
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Exclude->Name, "ExcludeRegularExpression");
|
||||
this->AddPersistentMultiOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Exclude->Label,
|
||||
"ExcludeLabelRegularExpression");
|
||||
this->Impl->TestOptions.ExcludeRegularExpression =
|
||||
expandedPreset->Filter->Exclude->Name;
|
||||
if (!expandedPreset->Filter->Exclude->Label.empty()) {
|
||||
this->Impl->TestOptions.ExcludeLabelRegularExpression.push_back(
|
||||
expandedPreset->Filter->Exclude->Label);
|
||||
}
|
||||
|
||||
if (expandedPreset->Filter->Exclude->Fixtures) {
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Exclude->Fixtures->Any,
|
||||
"ExcludeFixtureRegularExpression");
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Exclude->Fixtures->Setup,
|
||||
"ExcludeFixtureSetupRegularExpression");
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Filter->Exclude->Fixtures->Cleanup,
|
||||
"ExcludeFixtureCleanupRegularExpression");
|
||||
this->Impl->TestOptions.ExcludeFixtureRegularExpression =
|
||||
expandedPreset->Filter->Exclude->Fixtures->Any;
|
||||
this->Impl->TestOptions.ExcludeFixtureSetupRegularExpression =
|
||||
expandedPreset->Filter->Exclude->Fixtures->Setup;
|
||||
this->Impl->TestOptions.ExcludeFixtureCleanupRegularExpression =
|
||||
expandedPreset->Filter->Exclude->Fixtures->Cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1870,8 +1768,8 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
|
||||
this->Impl->ParallelLevelSetInCli = true;
|
||||
}
|
||||
|
||||
this->SetPersistentOptionIfNotEmpty(
|
||||
expandedPreset->Execution->ResourceSpecFile, "ResourceSpecFile");
|
||||
this->Impl->TestOptions.ResourceSpecFile =
|
||||
expandedPreset->Execution->ResourceSpecFile;
|
||||
|
||||
if (expandedPreset->Execution->TestLoad) {
|
||||
auto testLoad = *expandedPreset->Execution->TestLoad;
|
||||
@@ -2142,64 +2040,39 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
return true;
|
||||
};
|
||||
auto const dashI = [this](std::string const& tests) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("TestsToRunInformation",
|
||||
tests);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("TestsToRunInformation",
|
||||
tests);
|
||||
this->Impl->TestOptions.TestsToRunInformation = tests;
|
||||
return true;
|
||||
};
|
||||
auto const dashU = [this](std::string const&) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("UseUnion", "true");
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("UseUnion", "true");
|
||||
this->Impl->TestOptions.UseUnion = true;
|
||||
return true;
|
||||
};
|
||||
auto const dashR = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("IncludeRegularExpression",
|
||||
expr);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("IncludeRegularExpression",
|
||||
expr);
|
||||
this->Impl->TestOptions.IncludeRegularExpression = expr;
|
||||
return true;
|
||||
};
|
||||
auto const dashE = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("ExcludeRegularExpression",
|
||||
expr);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("ExcludeRegularExpression",
|
||||
expr);
|
||||
this->Impl->TestOptions.ExcludeRegularExpression = expr;
|
||||
return true;
|
||||
};
|
||||
auto const dashL = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.AddPersistentMultiOption("LabelRegularExpression",
|
||||
expr);
|
||||
this->Impl->MemCheckHandler.AddPersistentMultiOption(
|
||||
"LabelRegularExpression", expr);
|
||||
this->Impl->TestOptions.LabelRegularExpression.push_back(expr);
|
||||
return true;
|
||||
};
|
||||
auto const dashLE = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.AddPersistentMultiOption(
|
||||
"ExcludeLabelRegularExpression", expr);
|
||||
this->Impl->MemCheckHandler.AddPersistentMultiOption(
|
||||
"ExcludeLabelRegularExpression", expr);
|
||||
this->Impl->TestOptions.ExcludeLabelRegularExpression.push_back(expr);
|
||||
return true;
|
||||
};
|
||||
auto const dashFA = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption(
|
||||
"ExcludeFixtureRegularExpression", expr);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption(
|
||||
"ExcludeFixtureRegularExpression", expr);
|
||||
this->Impl->TestOptions.ExcludeFixtureRegularExpression = expr;
|
||||
return true;
|
||||
};
|
||||
auto const dashFS = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption(
|
||||
"ExcludeFixtureSetupRegularExpression", expr);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption(
|
||||
"ExcludeFixtureSetupRegularExpression", expr);
|
||||
this->Impl->TestOptions.ExcludeFixtureSetupRegularExpression = expr;
|
||||
return true;
|
||||
};
|
||||
auto const dashFC = [this](std::string const& expr) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption(
|
||||
"ExcludeFixtureCleanupRegularExpression", expr);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption(
|
||||
"ExcludeFixtureCleanupRegularExpression", expr);
|
||||
this->Impl->TestOptions.ExcludeFixtureCleanupRegularExpression = expr;
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -2488,8 +2361,8 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
[this](std::string const& sz) -> bool {
|
||||
long outputSize;
|
||||
if (cmStrToLong(sz, &outputSize)) {
|
||||
this->Impl->TestHandler.SetTestOutputSizePassed(
|
||||
static_cast<int>(outputSize));
|
||||
this->Impl->TestOptions.OutputSizePassed =
|
||||
static_cast<int>(outputSize);
|
||||
} else {
|
||||
cmCTestLog(
|
||||
this, WARNING,
|
||||
@@ -2502,8 +2375,8 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
[this](std::string const& sz) -> bool {
|
||||
long outputSize;
|
||||
if (cmStrToLong(sz, &outputSize)) {
|
||||
this->Impl->TestHandler.SetTestOutputSizeFailed(
|
||||
static_cast<int>(outputSize));
|
||||
this->Impl->TestOptions.OutputSizeFailed =
|
||||
static_cast<int>(outputSize);
|
||||
} else {
|
||||
cmCTestLog(
|
||||
this, WARNING,
|
||||
@@ -2515,7 +2388,8 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
CommandArgument{
|
||||
"--test-output-truncation", CommandArgument::Values::One,
|
||||
[this](std::string const& mode) -> bool {
|
||||
if (!this->Impl->TestHandler.SetTestOutputTruncation(mode)) {
|
||||
if (!SetTruncationMode(this->Impl->TestOptions.OutputTruncation,
|
||||
mode)) {
|
||||
cmSystemTools::Error(
|
||||
cmStrCat("Invalid value for '--test-output-truncation': ", mode));
|
||||
return false;
|
||||
@@ -2569,7 +2443,7 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
} },
|
||||
CommandArgument{ "--http-header", CommandArgument::Values::One,
|
||||
[this](std::string const& h) -> bool {
|
||||
this->Impl->SubmitHandler.AddCommandLineHttpHeader(h);
|
||||
this->Impl->CommandLineHttpHeaders.push_back(h);
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--submit-index", CommandArgument::Values::One,
|
||||
@@ -2637,39 +2511,29 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
dashFC },
|
||||
CommandArgument{ "--resource-spec-file", CommandArgument::Values::One,
|
||||
[this](std::string const& file) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption(
|
||||
"ResourceSpecFile", file);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption(
|
||||
"ResourceSpecFile", file);
|
||||
this->Impl->TestOptions.ResourceSpecFile = file;
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--tests-from-file", CommandArgument::Values::One,
|
||||
[this](std::string const& file) -> bool {
|
||||
this->Impl->TestOptions.TestListFile = file;
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{
|
||||
"--tests-from-file", CommandArgument::Values::One,
|
||||
[this](std::string const& file) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("TestListFile", file);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("TestListFile", file);
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--exclude-from-file", CommandArgument::Values::One,
|
||||
[this](std::string const& file) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption(
|
||||
"ExcludeTestListFile", file);
|
||||
this->Impl->MemCheckHandler.SetPersistentOption(
|
||||
"ExcludeTestListFile", file);
|
||||
this->Impl->TestOptions.ExcludeTestListFile = file;
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--schedule-random", CommandArgument::Values::Zero,
|
||||
[this](std::string const&) -> bool {
|
||||
this->Impl->ScheduleType = "Random";
|
||||
this->Impl->TestOptions.ScheduleRandom = true;
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--rerun-failed", CommandArgument::Values::Zero,
|
||||
[this](std::string const&) -> bool {
|
||||
this->Impl->TestOptions.RerunFailed = true;
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{
|
||||
"--rerun-failed", CommandArgument::Values::Zero,
|
||||
[this](std::string const&) -> bool {
|
||||
this->Impl->TestHandler.SetPersistentOption("RerunFailed", "true");
|
||||
this->Impl->MemCheckHandler.SetPersistentOption("RerunFailed", "true");
|
||||
return true;
|
||||
} },
|
||||
};
|
||||
|
||||
// process the command line arguments
|
||||
@@ -2785,14 +2649,7 @@ int cmCTest::RunScripts(
|
||||
cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
|
||||
}
|
||||
|
||||
for (auto& handler : this->Impl->GetTestingHandlers()) {
|
||||
handler->SetVerbose(this->Impl->ExtraVerbose);
|
||||
handler->SetSubmitIndex(this->Impl->SubmitIndex);
|
||||
}
|
||||
|
||||
cmCTestScriptHandler* ch = this->GetScriptHandler();
|
||||
ch->Initialize(this);
|
||||
ch->SetVerbose(this->Impl->Verbose);
|
||||
auto ch = cm::make_unique<cmCTestScriptHandler>(this);
|
||||
for (auto const& script : scripts) {
|
||||
ch->AddConfigurationScript(script.first, script.second);
|
||||
}
|
||||
@@ -2837,7 +2694,7 @@ int cmCTest::ExecuteTests()
|
||||
|
||||
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
|
||||
|
||||
this->GetTestHandler()->Initialize(this);
|
||||
cmCTestTestHandler handler(this);
|
||||
|
||||
{
|
||||
cmake cm(cmake::RoleScript, cmState::CTest);
|
||||
@@ -2847,11 +2704,11 @@ int cmCTest::ExecuteTests()
|
||||
cmGlobalGenerator gg(&cm);
|
||||
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
|
||||
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
|
||||
this->GetTestHandler()->PopulateCustomVectors(&mf);
|
||||
handler.PopulateCustomVectors(&mf);
|
||||
}
|
||||
|
||||
this->GetTestHandler()->SetVerbose(this->Impl->Verbose);
|
||||
if (this->GetTestHandler()->ProcessHandler() < 0) {
|
||||
handler.SetVerbose(this->Impl->Verbose);
|
||||
if (handler.ProcessHandler() < 0) {
|
||||
cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n");
|
||||
if (!this->Impl->OutputTestOutputOnTestFailure) {
|
||||
const std::string lastTestLog =
|
||||
@@ -3234,6 +3091,11 @@ bool cmCTest::GetExtraVerbose() const
|
||||
return this->Impl->ExtraVerbose;
|
||||
}
|
||||
|
||||
int cmCTest::GetSubmitIndex() const
|
||||
{
|
||||
return this->Impl->SubmitIndex;
|
||||
}
|
||||
|
||||
bool cmCTest::GetLabelSummary() const
|
||||
{
|
||||
return this->Impl->LabelSummary;
|
||||
@@ -3279,6 +3141,16 @@ std::string cmCTest::GetBuildID() const
|
||||
return this->Impl->BuildID;
|
||||
}
|
||||
|
||||
cmCTestTestOptions const& cmCTest::GetTestOptions() const
|
||||
{
|
||||
return this->Impl->TestOptions;
|
||||
}
|
||||
|
||||
std::vector<std::string> cmCTest::GetCommandLineHttpHeaders() const
|
||||
{
|
||||
return this->Impl->CommandLineHttpHeaders;
|
||||
}
|
||||
|
||||
void cmCTest::AddSubmitFile(Part part, const std::string& name)
|
||||
{
|
||||
this->Impl->Parts[part].SubmitFiles.emplace_back(name);
|
||||
@@ -3410,8 +3282,6 @@ void cmCTest::SetCMakeVariables(cmMakefile& mf)
|
||||
set("CTEST_TLS_VERSION", "TLSVersion");
|
||||
set("CTEST_CURL_OPTIONS", "CurlOptions");
|
||||
set("CTEST_SUBMIT_INACTIVITY_TIMEOUT", "SubmitInactivityTimeout");
|
||||
|
||||
this->GetTestHandler()->SetCMakeVariables(mf);
|
||||
}
|
||||
|
||||
bool cmCTest::RunCommand(std::vector<std::string> const& args,
|
||||
@@ -3543,7 +3413,7 @@ void cmCTest::SetOutputLogFileName(const std::string& name)
|
||||
|
||||
void cmCTest::SetOutputJUnitFileName(const std::string& name)
|
||||
{
|
||||
this->Impl->TestHandler.SetJUnitXMLFileName(name);
|
||||
this->Impl->TestOptions.JUnitXMLFileName = name;
|
||||
// Turn test output compression off.
|
||||
// This makes it easier to include test output in the resulting
|
||||
// JUnit XML report.
|
||||
|
||||
+11
-32
@@ -19,19 +19,12 @@
|
||||
#include "cmDuration.h"
|
||||
#include "cmProcessOutput.h"
|
||||
|
||||
class cmCTestBuildHandler;
|
||||
class cmCTestCoverageHandler;
|
||||
class cmCTestScriptHandler;
|
||||
class cmCTestTestHandler;
|
||||
class cmCTestUpdateHandler;
|
||||
class cmCTestConfigureHandler;
|
||||
class cmCTestMemCheckHandler;
|
||||
class cmCTestSubmitHandler;
|
||||
class cmCTestUploadHandler;
|
||||
class cmake;
|
||||
class cmGeneratedFileStream;
|
||||
class cmMakefile;
|
||||
class cmValue;
|
||||
class cmXMLWriter;
|
||||
struct cmCTestTestOptions;
|
||||
|
||||
/** \class cmCTest
|
||||
* \brief Represents a ctest invocation.
|
||||
@@ -236,7 +229,7 @@ public:
|
||||
static std::string SafeBuildIdField(const std::string& value);
|
||||
|
||||
/** Start CTest XML output file */
|
||||
void StartXML(cmXMLWriter& xml, bool append);
|
||||
void StartXML(cmXMLWriter& xml, cmake* cm, bool append);
|
||||
|
||||
/** End CTest XML output file */
|
||||
void EndXML(cmXMLWriter& xml);
|
||||
@@ -288,19 +281,6 @@ public:
|
||||
bool GetProduceXML();
|
||||
void SetProduceXML(bool v);
|
||||
|
||||
/**
|
||||
* Get the handler object
|
||||
*/
|
||||
cmCTestBuildHandler* GetBuildHandler();
|
||||
cmCTestCoverageHandler* GetCoverageHandler();
|
||||
cmCTestScriptHandler* GetScriptHandler();
|
||||
cmCTestTestHandler* GetTestHandler();
|
||||
cmCTestUpdateHandler* GetUpdateHandler();
|
||||
cmCTestConfigureHandler* GetConfigureHandler();
|
||||
cmCTestMemCheckHandler* GetMemCheckHandler();
|
||||
cmCTestSubmitHandler* GetSubmitHandler();
|
||||
cmCTestUploadHandler* GetUploadHandler();
|
||||
|
||||
/**
|
||||
* Set the CTest variable from CMake variable
|
||||
*/
|
||||
@@ -331,7 +311,7 @@ public:
|
||||
void AddCTestConfigurationOverwrite(const std::string& encstr);
|
||||
|
||||
/** Create XML file that contains all the notes specified */
|
||||
int GenerateNotesFile(std::vector<std::string> const& files);
|
||||
int GenerateNotesFile(cmake* cm, std::vector<std::string> const& files);
|
||||
|
||||
/** Create XML file to indicate that build is complete */
|
||||
int GenerateDoneFile();
|
||||
@@ -405,8 +385,9 @@ public:
|
||||
|
||||
bool GetVerbose() const;
|
||||
bool GetExtraVerbose() const;
|
||||
int GetSubmitIndex() const;
|
||||
|
||||
void AddSiteProperties(cmXMLWriter& xml);
|
||||
void AddSiteProperties(cmXMLWriter& xml, cmake* cm);
|
||||
|
||||
bool GetLabelSummary() const;
|
||||
bool GetSubprojectSummary() const;
|
||||
@@ -443,13 +424,11 @@ public:
|
||||
/** Reread the configuration file */
|
||||
bool UpdateCTestConfiguration();
|
||||
|
||||
private:
|
||||
void SetPersistentOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName);
|
||||
void AddPersistentMultiOptionIfNotEmpty(const std::string& value,
|
||||
const std::string& optionName);
|
||||
cmCTestTestOptions const& GetTestOptions() const;
|
||||
std::vector<std::string> GetCommandLineHttpHeaders() const;
|
||||
|
||||
int GenerateNotesFile(const std::string& files);
|
||||
private:
|
||||
int GenerateNotesFile(cmake* cm, const std::string& files);
|
||||
|
||||
void BlockTestErrorDiagnostics();
|
||||
|
||||
@@ -477,7 +456,7 @@ private:
|
||||
static bool ColoredOutputSupportedByConsole();
|
||||
|
||||
/** Create note from files. */
|
||||
int GenerateCTestNotesOutput(cmXMLWriter& xml,
|
||||
int GenerateCTestNotesOutput(cmXMLWriter& xml, cmake* cm,
|
||||
std::vector<std::string> const& files);
|
||||
|
||||
/** Check if the argument is the one specified */
|
||||
|
||||
Reference in New Issue
Block a user