summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/ctest_test.rst6
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx47
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h3
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx64
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/ctest_test/CMakeLists.txt.in4
-rw-r--r--Tests/RunCMake/ctest_test/CTestConfig.cmake.in1
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/ctest_test/TestQuiet-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_test/test.cmake.in16
11 files changed, 105 insertions, 50 deletions
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst
index 5f28083..ee76e91 100644
--- a/Help/command/ctest_test.rst
+++ b/Help/command/ctest_test.rst
@@ -31,3 +31,9 @@ tests should all stop running.
The APPEND option marks results for append to those previously
submitted to a dashboard server since the last ctest_start. Append
semantics are defined by the dashboard server in use.
+
+The QUIET option suppresses any CTest-specific non-error messages
+that would have otherwise been printed to the console. Output from
+the underlying test command is not affected. Summary info detailing
+the percentage of passing tests is also unaffected by the QUIET
+option.
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index f223127..eb33d8e 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -113,7 +113,8 @@ void cmCTestMultiProcessHandler::RunTests()
//---------------------------------------------------------
void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "test " << test << "\n");
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "test " << test << "\n", this->Quiet);
this->TestRunningMap[test] = true; // mark the test as running
// now remove the test itself
this->EraseTest(test);
@@ -639,39 +640,44 @@ void cmCTestMultiProcessHandler::PrintTestList()
if(!p.Labels.empty()) //print the labels
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:",
+ this->Quiet);
}
for(std::vector<std::string>::iterator label = p.Labels.begin();
label != p.Labels.end(); ++label)
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label,
+ this->Quiet);
}
if(!p.Labels.empty()) //print the labels
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl,
+ this->Quiet);
}
if (this->TestHandler->MemCheck)
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check");
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Memory Check",
+ this->Quiet);
}
else
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " Test");
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Test", this->Quiet);
}
std::ostringstream indexStr;
indexStr << " #" << p.Index << ":";
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex()))
- << indexStr.str());
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
- cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl);
+ << indexStr.str(), this->Quiet);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ p.Name.c_str() << std::endl, this->Quiet);
//pop working dir
cmSystemTools::ChangeDirectory(current_dir);
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
- << this->Total << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
+ << this->Total << std::endl, this->Quiet);
}
void cmCTestMultiProcessHandler::PrintLabels()
@@ -686,16 +692,19 @@ void cmCTestMultiProcessHandler::PrintLabels()
if(!allLabels.empty())
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ "All Labels:" << std::endl, this->Quiet);
}
else
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ "No Labels Exist" << std::endl, this->Quiet);
}
for(std::set<std::string>::iterator label = allLabels.begin();
label != allLabels.end(); ++label)
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " " << *label << std::endl, this->Quiet);
}
}
@@ -758,8 +767,8 @@ int cmCTestMultiProcessHandler::FindMaxIndex()
//Returns true if no cycles exist in the dependency graph
bool cmCTestMultiProcessHandler::CheckCycles()
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Checking test dependency graph..." << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Checking test dependency graph..." << std::endl, this->Quiet);
for(TestMap::iterator it = this->Tests.begin();
it != this->Tests.end(); ++it)
{
@@ -794,7 +803,7 @@ bool cmCTestMultiProcessHandler::CheckCycles()
}
}
}
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Checking test dependency graph end" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Checking test dependency graph end" << std::endl, this->Quiet);
return true;
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 605de31..6440fbc 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -57,6 +57,8 @@ public:
cmCTestTestHandler * GetTestHandler()
{ return this->TestHandler; }
+
+ void SetQuiet(bool b) { this->Quiet = b; }
protected:
// Start the next test or tests as many as are allowed by
// ParallelLevel
@@ -118,6 +120,7 @@ protected:
cmCTestTestHandler * TestHandler;
cmCTest* CTest;
bool HasCycles;
+ bool Quiet;
};
#endif
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index d209094..8b357ac 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -103,6 +103,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
{
this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]);
}
+ handler->SetQuiet(this->Quiet);
return handler;
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 925e3c9..0e84fbf 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -527,10 +527,10 @@ int cmCTestTestHandler::ProcessHandler()
this->TestResults.clear();
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
(this->MemCheck ? "Memory check" : "Test")
<< " project " << cmSystemTools::GetCurrentWorkingDirectory()
- << std::endl);
+ << std::endl, this->Quiet);
if ( ! this->PreProcessHandler() )
{
return -1;
@@ -567,13 +567,13 @@ int cmCTestTestHandler::ProcessHandler()
if (this->HandlerVerbose && !passed.empty() &&
(this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag))
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
- << "The following tests passed:" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
+ << "The following tests passed:" << std::endl, this->Quiet);
for(std::vector<std::string>::iterator j = passed.begin();
j != passed.end(); ++j)
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j
- << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j
+ << std::endl, this->Quiet);
}
}
@@ -593,8 +593,8 @@ int cmCTestTestHandler::ProcessHandler()
}
char realBuf[1024];
sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start));
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
- << realBuf << "\n" );
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet );
if (!failed.empty())
{
@@ -614,11 +614,11 @@ int cmCTestTestHandler::ProcessHandler()
if ( ftit->Status != cmCTestTestHandler::COMPLETED )
{
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3)
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3)
<< ftit->TestCount << " - "
<< ftit->Name << " ("
<< this->GetTestStatus(ftit->Status) << ")"
- << std::endl);
+ << std::endl, this->Quiet);
}
}
}
@@ -700,7 +700,8 @@ void cmCTestTestHandler::PrintLabelSummary()
// now print times
if(!labels.empty())
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:",
+ this->Quiet);
}
for(std::set<std::string>::const_iterator i = labels.begin();
i != labels.end(); ++i)
@@ -709,8 +710,8 @@ void cmCTestTestHandler::PrintLabelSummary()
label.resize(maxlen +3, ' ');
char buf[1024];
sprintf(buf, "%6.2f sec", labelTimes[*i]);
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n"
- << label << " = " << buf );
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n"
+ << label << " = " << buf, this->Quiet );
if ( this->LogFile )
{
*this->LogFile << "\n" << *i << " = "
@@ -723,7 +724,7 @@ void cmCTestTestHandler::PrintLabelSummary()
{
*this->LogFile << "\n";
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n");
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet);
}
}
@@ -1063,6 +1064,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
parallel->SetCTest(this->CTest);
parallel->SetParallelLevel(this->CTest->GetParallelLevel());
parallel->SetTestHandler(this);
+ parallel->SetQuiet(this->Quiet);
*this->LogFile << "Start testing: "
<< this->CTest->CurrentTime() << std::endl
@@ -1334,8 +1336,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
for ( it = vec.begin(); it != vec.end(); ++it )
{
int retVal = 0;
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
- << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " <<
+ *it << std::endl, this->Quiet);
if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0,
cmSystemTools::OUTPUT_MERGE
/*this->Verbose*/) || retVal != 0 )
@@ -1541,8 +1543,7 @@ std::string cmCTestTestHandler
for(std::vector<std::string>::iterator i = failed.begin();
i != failed.end(); ++i)
{
- cmCTestLog(ctest, HANDLER_OUTPUT,
- i->c_str() << "\n");
+ cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n");
}
}
@@ -1571,8 +1572,8 @@ void cmCTestTestHandler::GetListOfTests()
{
this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp.c_str());
}
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Constructing a list of tests" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Constructing a list of tests" << std::endl, this->Quiet);
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
@@ -1628,8 +1629,8 @@ void cmCTestTestHandler::GetListOfTests()
{
return;
}
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Done constructing a list of tests" << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Done constructing a list of tests" << std::endl, this->Quiet);
}
//----------------------------------------------------------------------
@@ -2016,8 +2017,8 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
<< "><Value>File " << filename
<< " not found</Value></NamedMeasurement>"
<< std::endl;
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename
- << "\" not found." << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename
+ << "\" not found." << std::endl, this->Quiet);
}
cxml.erase(measurementfile.start(),
measurementfile.end() - measurementfile.start());
@@ -2265,7 +2266,8 @@ bool cmCTestTestHandler::SetTestsProperties(
bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
{
const std::string& testname = args[0];
- cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl);
+ cmCTestOptionalLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl,
+ this->Quiet);
if (this->UseExcludeRegExpFlag &&
this->UseExcludeRegExpFirst &&
@@ -2288,8 +2290,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
if ( found )
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: "
- << *it << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Ignore memcheck: " << *it << std::endl, this->Quiet);
return true;
}
}
@@ -2308,8 +2310,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
if ( found )
{
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: "
- << *it << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: "
+ << *it << std::endl, this->Quiet);
return true;
}
}
@@ -2318,8 +2320,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.Name = testname;
test.Args = args;
test.Directory = cmSystemTools::GetCurrentWorkingDirectory();
- cmCTestLog(this->CTest, DEBUG, "Set test directory: "
- << test.Directory << std::endl);
+ cmCTestOptionalLog(this->CTest, DEBUG, "Set test directory: "
+ << test.Directory << std::endl, this->Quiet);
test.IsInBasedOnREOptions = true;
test.WillFail = false;
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 9bce7a3..4861202 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -133,6 +133,7 @@ add_RunCMake_test(ctest_build)
add_RunCMake_test(ctest_configure)
add_RunCMake_test(ctest_start)
add_RunCMake_test(ctest_submit)
+add_RunCMake_test(ctest_test)
add_RunCMake_test(file)
add_RunCMake_test(find_library)
add_RunCMake_test(find_package)
diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
new file mode 100644
index 0000000..cedf379
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.1)
+project(CTestTest@CASE_NAME@ NONE)
+include(CTest)
+add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/ctest_test/CTestConfig.cmake.in b/Tests/RunCMake/ctest_test/CTestConfig.cmake.in
new file mode 100644
index 0000000..9004419
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestConfig.cmake.in
@@ -0,0 +1 @@
+set(CTEST_PROJECT_NAME "CTestTest@CASE_NAME@")
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
new file mode 100644
index 0000000..d906290
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -0,0 +1,10 @@
+include(RunCTest)
+
+set(CASE_CTEST_TEST_ARGS "")
+
+function(run_ctest_test CASE_NAME)
+ set(CASE_CTEST_TEST_ARGS "${ARGN}")
+ run_ctest(${CASE_NAME})
+endfunction()
+
+run_ctest_test(TestQuiet QUIET)
diff --git a/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt b/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt
new file mode 100644
index 0000000..14613c5
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt
@@ -0,0 +1,2 @@
+ 0 Compiler warnings
+ Start 1: RunCMakeVersion
diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in
new file mode 100644
index 0000000..1350abe
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/test.cmake.in
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.1)
+
+set(CTEST_SITE "test-site")
+set(CTEST_BUILD_NAME "test-build-name")
+set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+
+set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
+ctest_start(Experimental)
+ctest_configure()
+ctest_build()
+ctest_test(${ctest_test_args})