diff options
author | Betsy McPhail <betsy.mcphail@kitware.com> | 2017-06-27 19:23:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-07-10 20:25:18 (GMT) |
commit | d08ec4d25a8113388092bf342002f3859f6b8de4 (patch) | |
tree | 9e07c94036183d61f702a38a85531da58feb56db /Source | |
parent | c705f0af63e2e438d0c6de2400cd90a005576125 (diff) | |
download | CMake-d08ec4d25a8113388092bf342002f3859f6b8de4.zip CMake-d08ec4d25a8113388092bf342002f3859f6b8de4.tar.gz CMake-d08ec4d25a8113388092bf342002f3859f6b8de4.tar.bz2 |
Add CTEST_LABELS_FOR_SUBPROJECTS as a CTest module and script variable
Use this variable to specify a list of labels that will be reported to
CDash as subprojects.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureHandler.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 1 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 30 | ||||
-rw-r--r-- | Source/cmCTest.h | 3 |
10 files changed, 56 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 4c82760..64ef8de 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -153,6 +153,12 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() this->Quiet); } + if (const char* labelsForSubprojects = + this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) { + this->CTest->SetCTestConfiguration("LabelsForSubprojects", + labelsForSubprojects, this->Quiet); + } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 18ef05c..f9116e3 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -488,6 +488,7 @@ int cmCTestBuildHandler::ProcessHandler() void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml) { this->CTest->StartXML(xml, this->AppendXML); + this->CTest->GenerateSubprojectsOutput(xml); xml.StartElement("Build"); xml.Element("StartDateTime", this->StartBuild); xml.Element("StartBuildTime", diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 73e893d..aca5bd3 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -141,6 +141,12 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } } + if (const char* labelsForSubprojects = + this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) { + this->CTest->SetCTestConfiguration("LabelsForSubprojects", + labelsForSubprojects, this->Quiet); + } + cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("configure"); if (!handler) { diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 5d87f3f..56a038e 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -73,6 +73,7 @@ int cmCTestConfigureHandler::ProcessHandler() if (os) { cmXMLWriter xml(os); this->CTest->StartXML(xml, this->AppendXML); + this->CTest->GenerateSubprojectsOutput(xml); xml.StartElement("Configure"); xml.Element("StartDateTime", start_time); xml.Element("StartConfigureTime", start_time_time); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index c35f0bc..6026a2a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -291,6 +291,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) return; } this->CTest->StartXML(xml, this->AppendXML); + this->CTest->GenerateSubprojectsOutput(xml); xml.StartElement("DynamicAnalysis"); switch (this->MemoryTesterStyle) { case cmCTestMemCheckHandler::VALGRIND: diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 1d29dfa..c566c5c 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -394,7 +394,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) return 0; } -// extract variabels from the script to set ivars +// extract variables from the script to set ivars int cmCTestScriptHandler::ExtractVariables() { // Temporary variables diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 075b140..3346d86 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -124,6 +124,12 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() } handler->SetTestLoad(testLoad); + if (const char* labelsForSubprojects = + this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) { + this->CTest->SetCTestConfiguration("LabelsForSubprojects", + labelsForSubprojects, this->Quiet); + } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 674be60..cce1516 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1277,6 +1277,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) } this->CTest->StartXML(xml, this->AppendXML); + this->CTest->GenerateSubprojectsOutput(xml); xml.StartElement("Testing"); xml.Element("StartDateTime", this->StartTest); xml.Element("StartTestTime", this->StartTestTime); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e260556..1eedaf1 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -11,6 +11,7 @@ #include "cmsys/Process.h" #include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" +#include <algorithm> #include <ctype.h> #include <iostream> #include <map> @@ -1363,6 +1364,35 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml) } } +void cmCTest::GenerateSubprojectsOutput(cmXMLWriter& xml) +{ + std::vector<std::string> subprojects = this->GetLabelsForSubprojects(); + std::vector<std::string>::const_iterator i; + for (i = subprojects.begin(); i != subprojects.end(); ++i) { + xml.StartElement("Subproject"); + xml.Attribute("name", *i); + xml.Element("Label", *i); + xml.EndElement(); // Subproject + } +} + +std::vector<std::string> cmCTest::GetLabelsForSubprojects() +{ + std::string labelsForSubprojects = + this->GetCTestConfiguration("LabelsForSubprojects"); + std::vector<std::string> subprojects; + cmSystemTools::ExpandListArgument(labelsForSubprojects, subprojects); + + // sort the array + std::sort(subprojects.begin(), subprojects.end()); + // remove duplicates + std::vector<std::string>::iterator new_end = + std::unique(subprojects.begin(), subprojects.end()); + subprojects.erase(new_end, subprojects.end()); + + return subprojects; +} + void cmCTest::EndXML(cmXMLWriter& xml) { xml.EndElement(); // Site diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 60f3295..190269a 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -453,6 +453,9 @@ public: /** Return true if test should run until fail */ bool GetRepeatUntilFail() { return this->RepeatUntilFail; } + void GenerateSubprojectsOutput(cmXMLWriter& xml); + std::vector<std::string> GetLabelsForSubprojects(); + private: int RepeatTests; bool RepeatUntilFail; |