mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
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.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -481,6 +481,7 @@ Variables for CTest
|
||||
/variable/CTEST_GIT_UPDATE_OPTIONS
|
||||
/variable/CTEST_HG_COMMAND
|
||||
/variable/CTEST_HG_UPDATE_OPTIONS
|
||||
/variable/CTEST_LABELS_FOR_SUBPROJECTS
|
||||
/variable/CTEST_MEMORYCHECK_COMMAND
|
||||
/variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS
|
||||
/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS
|
||||
|
||||
@@ -758,6 +758,15 @@ Configuration settings include:
|
||||
* :module:`CTest` module variable: :variable:`CMAKE_COMMAND`
|
||||
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
|
||||
@@ -780,6 +789,14 @@ Configuration settings include:
|
||||
* :module:`CTest` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``,
|
||||
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``
|
||||
Command-line to launch the software build process.
|
||||
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.
|
||||
|
||||
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``
|
||||
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.
|
||||
|
||||
5
Help/variable/CTEST_LABELS_FOR_SUBPROJECTS.rst
Normal file
5
Help/variable/CTEST_LABELS_FOR_SUBPROJECTS.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
CTEST_LABELS_FOR_SUBPROJECTS
|
||||
----------------------------
|
||||
|
||||
Specify the CTest ``LabelsForSubprojects`` setting
|
||||
in a :manual:`ctest(1)` dashboard client script.
|
||||
@@ -16,6 +16,9 @@ Site: @SITE@
|
||||
# Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++
|
||||
BuildName: @BUILDNAME@
|
||||
|
||||
# Subprojects
|
||||
LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@
|
||||
|
||||
# Submission information
|
||||
IsCDash: @CTEST_DROP_SITE_CDASH@
|
||||
CDashVersion: @CTEST_CDASH_VERSION@
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user