cmCTest: Improve readability adding "RunCMakeAndTest()" and "ExecuteTests()"

This commit is contained in:
Jean-Christophe Fillion-Robin 2016-06-28 18:04:07 -04:00 committed by Brad King
parent 898cb987b4
commit 280d0a6947
2 changed files with 71 additions and 58 deletions

View File

@ -2134,22 +2134,18 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// now what should cmake do? if --build-and-test was specified then
// we run the build and test handler and return
if (cmakeAndTest) {
this->Verbose = true;
cmCTestBuildAndTestHandler* handler =
static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest"));
int retv = handler->ProcessHandler();
*output = handler->GetOutput();
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
#endif
if (retv != 0) {
cmCTestLog(this, DEBUG,
"build and test failing returning: " << retv << std::endl);
}
return retv;
return this->RunCMakeAndTest(output);
}
if (executeTests) {
return this->ExecuteTests();
}
return 1;
}
int cmCTest::ExecuteTests()
{
int res;
// call process directory
if (this->RunConfigurationScript) {
@ -2157,8 +2153,8 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl);
}
cmCTest::t_TestingHandlers::iterator it;
for (it = this->TestingHandlers.begin();
it != this->TestingHandlers.end(); ++it) {
for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end();
++it) {
it->second->SetVerbose(this->ExtraVerbose);
it->second->SetSubmitIndex(this->SubmitIndex);
}
@ -2175,8 +2171,8 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
this->ExtraVerbose = this->Verbose;
this->Verbose = true;
cmCTest::t_TestingHandlers::iterator it;
for (it = this->TestingHandlers.begin();
it != this->TestingHandlers.end(); ++it) {
for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end();
++it) {
it->second->SetVerbose(this->Verbose);
it->second->SetSubmitIndex(this->SubmitIndex);
}
@ -2197,7 +2193,21 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
return res;
}
return 1;
int cmCTest::RunCMakeAndTest(std::string* output)
{
this->Verbose = true;
cmCTestBuildAndTestHandler* handler =
static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest"));
int retv = handler->ProcessHandler();
*output = handler->GetOutput();
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
#endif
if (retv != 0) {
cmCTestLog(this, DEBUG, "build and test failing returning: " << retv
<< std::endl);
}
return retv;
}
void cmCTest::SetNotesFiles(const char* notes)

View File

@ -579,6 +579,9 @@ private:
//! Output errors from a test
void OutputTestErrors(std::vector<char> const& process_output);
int RunCMakeAndTest(std::string* output);
int ExecuteTests();
bool SuppressUpdatingCTestConfiguration;
bool Debug;