Added an option to conditionally attach files to a test submission only if the test does not pass. Also some preliminary changes for test output compression.
This commit is contained in:
parent
56fe170043
commit
9add940eb6
|
@ -1259,6 +1259,14 @@ void cmCTestTestHandler::WriteTestResultFooter(std::ostream& os,
|
|||
void cmCTestTestHandler::AttachFiles(std::ostream& os,
|
||||
cmCTestTestResult* result)
|
||||
{
|
||||
if(result->Status != cmCTestTestHandler::COMPLETED
|
||||
&& result->Properties->AttachOnFail.size())
|
||||
{
|
||||
result->Properties->AttachedFiles.insert(
|
||||
result->Properties->AttachedFiles.end(),
|
||||
result->Properties->AttachOnFail.begin(),
|
||||
result->Properties->AttachOnFail.end());
|
||||
}
|
||||
for(std::vector<std::string>::const_iterator file =
|
||||
result->Properties->AttachedFiles.begin();
|
||||
file != result->Properties->AttachedFiles.end(); ++file)
|
||||
|
@ -1268,8 +1276,8 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os,
|
|||
os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" "
|
||||
"compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">"
|
||||
"\n\t\t\t<Value>\n\t\t\t"
|
||||
<< base64
|
||||
<< "\n\t\t\t</Value>\n\t\t</NamedMeasurement>\n";
|
||||
<< base64
|
||||
<< "\n\t\t\t</Value>\n\t\t</NamedMeasurement>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2077,6 +2085,17 @@ bool cmCTestTestHandler::SetTestsProperties(
|
|||
rtit->AttachedFiles.push_back(*f);
|
||||
}
|
||||
}
|
||||
if ( key == "ATTACHED_FILES_ON_FAIL" )
|
||||
{
|
||||
std::vector<std::string> lval;
|
||||
cmSystemTools::ExpandListArgument(val.c_str(), lval);
|
||||
|
||||
for(std::vector<std::string>::iterator f = lval.begin();
|
||||
f != lval.end(); ++f)
|
||||
{
|
||||
rtit->AttachOnFail.push_back(*f);
|
||||
}
|
||||
}
|
||||
if ( key == "TIMEOUT" )
|
||||
{
|
||||
rtit->Timeout = atof(val.c_str());
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
std::vector<std::string> RequiredFiles;
|
||||
std::vector<std::string> Depends;
|
||||
std::vector<std::string> AttachedFiles;
|
||||
std::vector<std::string> AttachOnFail;
|
||||
std::vector<std::pair<cmsys::RegularExpression,
|
||||
std::string> > ErrorRegularExpressions;
|
||||
std::vector<std::pair<cmsys::RegularExpression,
|
||||
|
|
|
@ -221,6 +221,7 @@ cmCTest::cmCTest()
|
|||
this->ShowOnly = false;
|
||||
this->RunConfigurationScript = false;
|
||||
this->UseHTTP10 = false;
|
||||
this->CompressTestOutput = true;
|
||||
this->TestModel = cmCTest::EXPERIMENTAL;
|
||||
this->MaxTestNameWidth = 30;
|
||||
this->InteractiveDebugMode = true;
|
||||
|
@ -1705,6 +1706,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
|
|||
this->SetParallelLevel(plevel);
|
||||
}
|
||||
|
||||
if(this->CheckArgument(arg, "--no-compress-output"))
|
||||
{
|
||||
this->CompressTestOutput = false;
|
||||
}
|
||||
|
||||
if(this->CheckArgument(arg, "--http1.0"))
|
||||
{
|
||||
this->UseHTTP10 = true;
|
||||
|
|
|
@ -195,6 +195,8 @@ public:
|
|||
|
||||
bool ShouldUseHTTP10() { return this->UseHTTP10; }
|
||||
|
||||
bool ShouldCompressTestOutput() { return this->CompressTestOutput; }
|
||||
|
||||
//Used for parallel ctest job scheduling
|
||||
std::string GetScheduleType() { return this->ScheduleType; }
|
||||
void SetScheduleType(std::string type) { this->ScheduleType = type; }
|
||||
|
@ -446,6 +448,8 @@ private:
|
|||
|
||||
bool CompressXMLFiles;
|
||||
|
||||
bool CompressTestOutput;
|
||||
|
||||
void InitStreams();
|
||||
std::ostream* StreamOut;
|
||||
std::ostream* StreamErr;
|
||||
|
|
|
@ -78,7 +78,9 @@ public:
|
|||
"for the test to be run.\n"
|
||||
"ATTACHED_FILES: Set this property to a list of files that will be "
|
||||
"encoded and submitted to the dashboard as an addition to the test "
|
||||
"result.\n";
|
||||
"result.\n"
|
||||
"ATTACHED_FILES_ON_FAIL: Same as ATTACHED_FILES, but these files will "
|
||||
"only be included if the test does not pass.\n";
|
||||
}
|
||||
|
||||
cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);
|
||||
|
|
|
@ -221,6 +221,10 @@ static const char * cmDocumentationOptions[][3] =
|
|||
{"--http1.0", "Submit using HTTP 1.0.",
|
||||
"This option will force CTest to use HTTP 1.0 to submit files to the "
|
||||
"dashboard, instead of HTTP 1.1."},
|
||||
{"--no-compress-output", "Do not compress test output when submitting.",
|
||||
"This flag will turn off automatic compression of test output. Use this "
|
||||
"to maintain compatibility with an older version of CDash which doesn't "
|
||||
"support compressed test output."},
|
||||
{"--help-command <cmd> [<file>]", "Show help for a single command and exit.",
|
||||
"Prints the help for the command to stdout or to the specified file." },
|
||||
{"--help-command-list [<file>]", "List available commands and exit.",
|
||||
|
|
Loading…
Reference in New Issue