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:
Zach Mullen 2009-12-16 14:50:16 -05:00
parent 56fe170043
commit 9add940eb6
6 changed files with 41 additions and 5 deletions

View File

@ -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,9 +1276,9 @@ 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";
}
}
//----------------------------------------------------------------------
@ -1355,7 +1363,7 @@ void cmCTestTestHandler
std::vector<std::string> &attemptedConfigs,
std::string filepath,
std::string &filename)
{
{
std::string tempPath;
if (filepath.size() &&
@ -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());

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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.",