diff options
author | Zack Galbreath <zack.galbreath@kitware.com> | 2021-06-08 18:48:57 (GMT) |
---|---|---|
committer | Zack Galbreath <zack.galbreath@kitware.com> | 2021-06-09 12:31:32 (GMT) |
commit | 02f1271bdf810107ad5d3c0cffb74b472d706054 (patch) | |
tree | 64c61a8d698537524000ff115ffdfffd823c09d7 /Source/CTest | |
parent | 5e26887c35be116a83ba049098f5780309ced073 (diff) | |
download | CMake-02f1271bdf810107ad5d3c0cffb74b472d706054.zip CMake-02f1271bdf810107ad5d3c0cffb74b472d706054.tar.gz CMake-02f1271bdf810107ad5d3c0cffb74b472d706054.tar.bz2 |
ctest: allow test output to override the 'details' field
Parse test output for <CTestDetails>...</CTestDetails>.
If found, use this value to override the default 'Details' string reported
to CDash.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 16 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 5a6c775..a892113 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -40,6 +40,22 @@ void cmCTestRunTest::CheckOutput(std::string const& line) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex() << ": " << line << std::endl); + + // Check for special CTest XML tags in this line of output. + // If any are found, this line is excluded from ProcessOutput. + if (!line.empty() && line.find("<CTest") != std::string::npos) { + if (this->TestHandler->CustomCompletionStatusRegex.find(line)) { + this->TestResult.CustomCompletionStatus = + this->TestHandler->CustomCompletionStatusRegex.match(1); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + this->GetIndex() << ": " + << "Test Details changed to '" + << this->TestResult.CustomCompletionStatus + << "'" << std::endl); + return; + } + } + this->ProcessOutput += line; this->ProcessOutput += "\n"; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index fd38f39..730ec0f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -308,6 +308,10 @@ cmCTestTestHandler::cmCTestTestHandler() // regex to detect each individual <DartMeasurement>...</DartMeasurement> this->DartStuff1.compile( "(<DartMeasurement[^<]*</DartMeasurement[a-zA-Z]*>)"); + + // regex to detect <CTestDetails>...</CTestDetails> + this->CustomCompletionStatusRegex.compile( + "<CTestDetails>(.*)</CTestDetails>"); } void cmCTestTestHandler::Initialize() @@ -1460,7 +1464,11 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Completion Status"); - xml.Element("Value", result.CompletionStatus); + if (result.CustomCompletionStatus.empty()) { + xml.Element("Value", result.CompletionStatus); + } else { + xml.Element("Value", result.CustomCompletionStatus); + } xml.EndElement(); // NamedMeasurement xml.StartElement("NamedMeasurement"); diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 9f5b3da..bd51738 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -175,6 +175,7 @@ public: std::string ExceptionStatus; bool CompressOutput; std::string CompletionStatus; + std::string CustomCompletionStatus; std::string Output; std::string DartString; int TestCount; @@ -358,6 +359,7 @@ private: ListOfTests TestList; size_t TotalNumberOfTests; cmsys::RegularExpression DartStuff; + cmsys::RegularExpression CustomCompletionStatusRegex; std::ostream* LogFile; |