diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index effa995d0..900165eb9 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::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" "\n\t\t\t\n\t\t\t" - << base64 - << "\n\t\t\t\n\t\t\n"; - } + << base64 + << "\n\t\t\t\n\t\t\n"; + } } //---------------------------------------------------------------------- @@ -1355,7 +1363,7 @@ void cmCTestTestHandler std::vector &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 lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + + for(std::vector::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 d4e92f0a8..a78cada67 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -87,6 +87,7 @@ public: std::vector RequiredFiles; std::vector Depends; std::vector AttachedFiles; + std::vector AttachOnFail; std::vector > ErrorRegularExpressions; std::vectorShowOnly = 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 983202a91..6fe1eb36d 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 2893f8411..bc5d91f45 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 8b6889d18..c9b875dcb 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 []", "Show help for a single command and exit.", "Prints the help for the command to stdout or to the specified file." }, {"--help-command-list []", "List available commands and exit.",