summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2010-08-31 10:41:23 -0400
committerZach Mullen <zach.mullen@kitware.com>2010-08-31 10:41:23 -0400
commit32242affea45eb3c3ffa2691657e970eaac49799 (patch)
tree6d75ae8b204aac75d8b8baae644e14f4f88557e5 /Source
parentaac1680648634a87dd4eee3ae603aef387798244 (diff)
downloadcmake-32242affea45eb3c3ffa2691657e970eaac49799.tar.gz
Added CTest command --print-labels
This command allows a user to quickly see the list of all available test labels. The labels are also printed in verbose show only mode, alongside their corresponding tests.
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx42
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx9
-rw-r--r--Source/cmCTest.cxx6
-rw-r--r--Source/cmCTest.h3
-rw-r--r--Source/ctest.cxx5
6 files changed, 63 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index d50eaaa81f..0d14c2d74b 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -516,11 +516,13 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
int count = 0;
+
for (PropertiesMap::iterator it = this->Properties.begin();
it != this->Properties.end(); ++it)
{
count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+
//push working dir
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(p.Directory.c_str());
@@ -530,6 +532,20 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode
+ if(p.Labels.size()) //print the labels
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
+ }
+ for(std::vector<std::string>::iterator label = p.Labels.begin();
+ label != p.Labels.end(); ++label)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
+ }
+ if(p.Labels.size()) //print the labels
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
+ }
+
if (this->TestHandler->MemCheck)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check");
@@ -548,10 +564,36 @@ void cmCTestMultiProcessHandler::PrintTestList()
//pop working dir
cmSystemTools::ChangeDirectory(current_dir.c_str());
}
+
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl);
}
+void cmCTestMultiProcessHandler::PrintLabels()
+{
+ std::set<std::string> allLabels;
+ for (PropertiesMap::iterator it = this->Properties.begin();
+ it != this->Properties.end(); ++it)
+ {
+ cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+ allLabels.insert(p.Labels.begin(), p.Labels.end());
+ }
+
+ if(allLabels.size())
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl);
+ }
+ for(std::set<std::string>::iterator label = allLabels.begin();
+ label != allLabels.end(); ++label)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl);
+ }
+}
+
//---------------------------------------------------------
void cmCTestMultiProcessHandler::CheckResume()
{
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index cc330f7a6d..1483440c60 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -39,6 +39,7 @@ public:
void SetParallelLevel(size_t);
virtual void RunTests();
void PrintTestList();
+ void PrintLabels();
void SetPassFailVectors(std::vector<cmStdString>* passed,
std::vector<cmStdString>* failed)
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index a4a48633e3..6dd348def3 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -567,7 +567,7 @@ int cmCTestTestHandler::ProcessHandler()
if (total == 0)
{
- if ( !this->CTest->GetShowOnly() )
+ if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!"
<< std::endl);
@@ -1079,7 +1079,12 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
parallel->SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
parallel->SetTestResults(&this->TestResults);
- if(this->CTest->GetShowOnly())
+
+ if(this->CTest->ShouldPrintLabels())
+ {
+ parallel->PrintLabels();
+ }
+ else if(this->CTest->GetShowOnly())
{
parallel->PrintTestList();
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d12fde0f8d..dcdc8e15b2 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -304,6 +304,7 @@ cmCTest::cmCTest()
this->ShowOnly = false;
this->RunConfigurationScript = false;
this->UseHTTP10 = false;
+ this->PrintLabels = false;
this->CompressTestOutput = true;
this->ComputedCompressOutput = false;
this->TestModel = cmCTest::EXPERIMENTAL;
@@ -1877,6 +1878,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->CompressTestOutput = false;
}
+ if(this->CheckArgument(arg, "--print-labels"))
+ {
+ this->PrintLabels = true;
+ }
+
if(this->CheckArgument(arg, "--http1.0"))
{
this->UseHTTP10 = true;
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 3d7d1179b8..e54a205c36 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -210,6 +210,8 @@ public:
bool ShouldUseHTTP10() { return this->UseHTTP10; }
+ bool ShouldPrintLabels() { return this->PrintLabels; }
+
bool ShouldCompressTestOutput();
std::string GetCDashVersion();
@@ -413,6 +415,7 @@ private:
bool ProduceXML;
bool LabelSummary;
bool UseHTTP10;
+ bool PrintLabels;
bool Failover;
bool BatchJobs;
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 24921c428f..3937d8d17b 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -152,7 +152,7 @@ static const char * cmDocumentationOptions[][3] =
"popups and interactive "
"debugging."},
{"--no-label-summary", "Disable timing summary information for labels.",
- "This option tells ctest to not print summary information for each label "
+ "This option tells ctest not to print summary information for each label "
"associated with the tests run. If there are no labels on the "
"tests, nothing extra is printed."},
{"--build-and-test", "Configure, build and run a test.",
@@ -229,6 +229,9 @@ static const char * cmDocumentationOptions[][3] =
"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."},
+ {"--print-labels", "Print all available test labels.",
+ "This option will not run any tests, it will simply print the list of "
+ "all labels associated with the test set."},
{"--help-command <cmd> [<file>]", "Show help for a single command and exit.",
"Prints the help for the command to stdout or to the specified file." },
{"--help-command-list [<file>]", "List available commands and exit.",