summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-09-08 15:07:51 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-09-08 15:07:51 (GMT)
commit81fa6bbcc7daca38517da1f347de91d70db6a02f (patch)
treea923aa765b8d171323a1c5dac6ffb6d68f18bf6f
parentc9b0e1da5cf449ad54f873bc2b4d45df9197efb5 (diff)
parent32242affea45eb3c3ffa2691657e970eaac49799 (diff)
downloadCMake-81fa6bbcc7daca38517da1f347de91d70db6a02f.zip
CMake-81fa6bbcc7daca38517da1f347de91d70db6a02f.tar.gz
CMake-81fa6bbcc7daca38517da1f347de91d70db6a02f.tar.bz2
Merge topic 'ctest-show-labels'
32242af Added CTest command --print-labels
-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
-rw-r--r--Tests/CMakeLists.txt5
7 files changed, 68 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index d50eaaa..0d14c2d 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 cc330f7..1483440 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 a4a4863..6dd348d 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 d12fde0..dcdc8e1 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 3d7d117..e54a205 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 24921c4..3937d8d 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.",
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5383bda..8e8d0ca 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1315,6 +1315,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log"
)
+ ADD_TEST(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels)
+ SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2")
+ SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION
+ "All Labels:.* Label1.* Label2")
+
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake"