diff options
author | Zach Mullen <zach.mullen@kitware.com> | 2009-12-16 19:50:16 (GMT) |
---|---|---|
committer | Zach Mullen <zach.mullen@kitware.com> | 2009-12-16 19:50:16 (GMT) |
commit | 9add940eb6a23b32da6a86b857d05fed900fea74 (patch) | |
tree | 949d99f8fdc69b3194a021739859de2ce3ae0764 /Source | |
parent | 56fe170043548e42728105ada644941fc3ae978b (diff) | |
download | CMake-9add940eb6a23b32da6a86b857d05fed900fea74.zip CMake-9add940eb6a23b32da6a86b857d05fed900fea74.tar.gz CMake-9add940eb6a23b32da6a86b857d05fed900fea74.tar.bz2 |
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.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 27 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 1 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 6 | ||||
-rw-r--r-- | Source/cmCTest.h | 4 | ||||
-rw-r--r-- | Source/cmSetTestsPropertiesCommand.h | 4 | ||||
-rw-r--r-- | Source/ctest.cxx | 4 |
6 files changed, 41 insertions, 5 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index effa995..900165e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -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()); diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index d4e92f0..a78cada 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -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, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7e3a81b..25a80ff 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 983202a..6fe1eb3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -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; diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 2893f84..bc5d91f 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -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); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 8b6889d..c9b875d 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -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.", |