Commit d08ec4d2 authored by Betsy McPhail's avatar Betsy McPhail Committed by Brad King

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.
parent c705f0af
This diff is collapsed.
...@@ -481,6 +481,7 @@ Variables for CTest ...@@ -481,6 +481,7 @@ Variables for CTest
/variable/CTEST_GIT_UPDATE_OPTIONS /variable/CTEST_GIT_UPDATE_OPTIONS
/variable/CTEST_HG_COMMAND /variable/CTEST_HG_COMMAND
/variable/CTEST_HG_UPDATE_OPTIONS /variable/CTEST_HG_UPDATE_OPTIONS
/variable/CTEST_LABELS_FOR_SUBPROJECTS
/variable/CTEST_MEMORYCHECK_COMMAND /variable/CTEST_MEMORYCHECK_COMMAND
/variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS /variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS
/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS /variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS
......
...@@ -758,6 +758,15 @@ Configuration settings include: ...@@ -758,6 +758,15 @@ Configuration settings include:
* :module:`CTest` module variable: :variable:`CMAKE_COMMAND` * :module:`CTest` module variable: :variable:`CMAKE_COMMAND`
followed by :variable:`PROJECT_SOURCE_DIR` followed by :variable:`PROJECT_SOURCE_DIR`
``LabelsForSubprojects``
Specify a semicolon-separated list of labels that will be treated as
subprojects. This mapping will be passed on to CDash when configure, test or
build results are submitted.
* `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
* :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
.. _`CTest Build Step`: .. _`CTest Build Step`:
CTest Build Step CTest Build Step
...@@ -780,6 +789,14 @@ Configuration settings include: ...@@ -780,6 +789,14 @@ Configuration settings include:
* :module:`CTest` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``, * :module:`CTest` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``,
initialized by the ``CMAKE_CONFIG_TYPE`` environment variable initialized by the ``CMAKE_CONFIG_TYPE`` environment variable
``LabelsForSubprojects``
Specify a semicolon-separated list of labels that will be treated as
subprojects. This mapping will be passed on to CDash when configure, test or
build results are submitted.
* `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
* :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
``MakeCommand`` ``MakeCommand``
Command-line to launch the software build process. Command-line to launch the software build process.
It will be executed in the location specified by the It will be executed in the location specified by the
...@@ -815,6 +832,15 @@ Arguments to the command may specify some of the step settings. ...@@ -815,6 +832,15 @@ Arguments to the command may specify some of the step settings.
Configuration settings include: Configuration settings include:
``LabelsForSubprojects``
Specify a semicolon-separated list of labels that will be treated as
subprojects. This mapping will be passed on to CDash when configure, test or
build results are submitted.
* `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
* :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
``TestLoad`` ``TestLoad``
While running tests in parallel (e.g. with ``-j``), try not to start While running tests in parallel (e.g. with ``-j``), try not to start
tests when they may cause the CPU load to pass above a given threshold. tests when they may cause the CPU load to pass above a given threshold.
......
CTEST_LABELS_FOR_SUBPROJECTS
----------------------------
Specify the CTest ``LabelsForSubprojects`` setting
in a :manual:`ctest(1)` dashboard client script.
...@@ -16,6 +16,9 @@ Site: @SITE@ ...@@ -16,6 +16,9 @@ Site: @SITE@
# Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++ # Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++
BuildName: @BUILDNAME@ BuildName: @BUILDNAME@
# Subprojects
LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@
# Submission information # Submission information
IsCDash: @CTEST_DROP_SITE_CDASH@ IsCDash: @CTEST_DROP_SITE_CDASH@
CDashVersion: @CTEST_CDASH_VERSION@ CDashVersion: @CTEST_CDASH_VERSION@
......
...@@ -153,6 +153,12 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() ...@@ -153,6 +153,12 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
this->Quiet); this->Quiet);
} }
if (const char* labelsForSubprojects =
this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
labelsForSubprojects, this->Quiet);
}
handler->SetQuiet(this->Quiet); handler->SetQuiet(this->Quiet);
return handler; return handler;
} }
......
...@@ -488,6 +488,7 @@ int cmCTestBuildHandler::ProcessHandler() ...@@ -488,6 +488,7 @@ int cmCTestBuildHandler::ProcessHandler()
void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml) void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
{ {
this->CTest->StartXML(xml, this->AppendXML); this->CTest->StartXML(xml, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("Build"); xml.StartElement("Build");
xml.Element("StartDateTime", this->StartBuild); xml.Element("StartDateTime", this->StartBuild);
xml.Element("StartBuildTime", xml.Element("StartBuildTime",
......
...@@ -141,6 +141,12 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() ...@@ -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 = cmCTestGenericHandler* handler =
this->CTest->GetInitializedHandler("configure"); this->CTest->GetInitializedHandler("configure");
if (!handler) { if (!handler) {
......
...@@ -73,6 +73,7 @@ int cmCTestConfigureHandler::ProcessHandler() ...@@ -73,6 +73,7 @@ int cmCTestConfigureHandler::ProcessHandler()
if (os) { if (os) {
cmXMLWriter xml(os); cmXMLWriter xml(os);
this->CTest->StartXML(xml, this->AppendXML); this->CTest->StartXML(xml, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("Configure"); xml.StartElement("Configure");
xml.Element("StartDateTime", start_time); xml.Element("StartDateTime", start_time);
xml.Element("StartConfigureTime", start_time_time); xml.Element("StartConfigureTime", start_time_time);
......
...@@ -291,6 +291,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) ...@@ -291,6 +291,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml)
return; return;
} }
this->CTest->StartXML(xml, this->AppendXML); this->CTest->StartXML(xml, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("DynamicAnalysis"); xml.StartElement("DynamicAnalysis");
switch (this->MemoryTesterStyle) { switch (this->MemoryTesterStyle) {
case cmCTestMemCheckHandler::VALGRIND: case cmCTestMemCheckHandler::VALGRIND:
......
...@@ -394,7 +394,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) ...@@ -394,7 +394,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
return 0; return 0;
} }
// extract variabels from the script to set ivars // extract variables from the script to set ivars
int cmCTestScriptHandler::ExtractVariables() int cmCTestScriptHandler::ExtractVariables()
{ {
// Temporary variables // Temporary variables
......
...@@ -124,6 +124,12 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() ...@@ -124,6 +124,12 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
} }
handler->SetTestLoad(testLoad); 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); handler->SetQuiet(this->Quiet);
return handler; return handler;
} }
......
...@@ -1277,6 +1277,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) ...@@ -1277,6 +1277,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
} }
this->CTest->StartXML(xml, this->AppendXML); this->CTest->StartXML(xml, this->AppendXML);
this->CTest->GenerateSubprojectsOutput(xml);
xml.StartElement("Testing"); xml.StartElement("Testing");
xml.Element("StartDateTime", this->StartTest); xml.Element("StartDateTime", this->StartTest);
xml.Element("StartTestTime", this->StartTestTime); xml.Element("StartTestTime", this->StartTestTime);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "cmsys/Process.h" #include "cmsys/Process.h"
#include "cmsys/String.hxx" #include "cmsys/String.hxx"
#include "cmsys/SystemInformation.hxx" #include "cmsys/SystemInformation.hxx"
#include <algorithm>
#include <ctype.h> #include <ctype.h>
#include <iostream> #include <iostream>
#include <map> #include <map>
...@@ -1363,6 +1364,35 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml) ...@@ -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) void cmCTest::EndXML(cmXMLWriter& xml)
{ {
xml.EndElement(); // Site xml.EndElement(); // Site
......
...@@ -453,6 +453,9 @@ public: ...@@ -453,6 +453,9 @@ public:
/** Return true if test should run until fail */ /** Return true if test should run until fail */
bool GetRepeatUntilFail() { return this->RepeatUntilFail; } bool GetRepeatUntilFail() { return this->RepeatUntilFail; }
void GenerateSubprojectsOutput(cmXMLWriter& xml);
std::vector<std::string> GetLabelsForSubprojects();
private: private:
int RepeatTests; int RepeatTests;
bool RepeatUntilFail; bool RepeatUntilFail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment